Script Server - Questions

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Script Server - Questions

Post by eterzella.r.t »

I made a script in php, would run the Server Scripts, trying to better the time of my poller.

The strange is that the configuration of cacti, sent my script using the Script Server, but no view cache poller, it appears the method and not Script Script Server.

Someone knows what could be happening?

##############################################

Data Cacti - Performace Monitor Gauge Script: /var/www/cliente/scripts/ss_check_nt.php 1248 iis 10.0.0.152 get outputPerfmon "Active Server Pages-Requests Queued"
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_ds_value_gauge_1280.rrd
Data Cacti - Performace Monitor Gauge Script: /var/www/cliente/scripts/ss_check_nt.php 1248 iis 10.0.0.152 get outputPerfmon "Active Server Pages-Sessions Current"
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_ds_value_gauge_1281.rrd
Data Cacti - Performace Monitor Gauge Script: /var/www/cliente/scripts/ss_check_nt.php 1248 iis 10.0.0.152 get outputPerfmon "Web Service(_Total)-Current Connections"
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_ds_value_gauge_1282.rrd

Windows 2003 - web2.rede.msft - CPU Utilization - CPU0 Script Server: /var/www/cliente/scripts/ss_host_cpu.php ss_host_cpu 10.0.0.152 42 2:161:1000:public:::MD5::DES: get usage 0
RRD:
/var/www/cliente/rra/windows_2003_-_web2_rede_msft_cpu_1276.rrd
Windows 2003 - web2.rede.msft - CPU Utilization - CPU1 Script Server:
/var/www/cliente/scripts/ss_host_cpu.php ss_host_cpu 10.0.0.152 42 2:161:1000:public:::MD5::DES: get usage 1
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_cpu_1277.rrd
Windows 2003 - web2.rede.msft - CPU Utilization - CPU2 Script Server: /var/www/cliente/scripts/ss_host_cpu.php ss_host_cpu 10.0.0.152 42 2:161:1000:public:::MD5::DES: get usage 2
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_cpu_1278.rrd
Windows 2003 - web2.rede.msft - CPU Utilization - CPU3 Script Server: /var/www/aiec/scripts/ss_host_cpu.php ss_host_cpu 10.0.0.152 42 2:161:1000:public:::MD5::DES: get usage 3
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_cpu_1279.rrd
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Post by eterzella.r.t »

When I was creating a Data Input Methods using Script - Script Server (PHP), it will not let me add a "Input Fields," clicked on ADD, and in the "Field [Input] Choose the associated field Input from the field," appeared a combo box. So can not register nor Input value.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please test your script with the script server as given by http://forums.cacti.net/viewtopic.php?t=7738
Reinhard
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Post by eterzella.r.t »

I already had testing, is working perfectly.

Run php script_server.php

And

/ Var / www / client / scripts / ss_check_nt.php ss_check_nt 1248 iis 10.0.0.152 get outputPerfmon "Web Service (_Total) - Current Connections"

However not able to make it run with a function ss_check_nt, even putting it to use the "Data Input Vestec-Script Server Data (Indexed)."
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Pleae post the php script server script ss_check_nt.php
Reinhard
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Post by eterzella.r.t »

root@localhost:/var/www/cliente/scripts#
root@localhost:/var/www/cliente/scripts#
root@localhost:/var/www/cliente/scripts# php ../script_server.php
PHP Script Server has Started - Parent is cmd
/var/www/cliente/scripts/ss_check_nt.php ss_check_nt 1248 iis 10.0.0.152 get outputPerfmon "Web Service(_Total)-Current Connections"
51
U
quit
PHP Script Server Shutdown request received, exiting
root@localhost:/var/www/cliente/scripts#
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Post by eterzella.r.t »

I do not understand why the poller.php not called my scripts with:

Script Server: / var / www / client / scripts / ss_check_nt.php 1248 iis 10.0.0.152 get outputPerfmon "Web Service (_Total) - Current Connections"
RRD: / var/www/cliente/rra/windows_2003_-_web2_rede_msft_ds_value_gauge_1282.r

He calls the scripts that I did with just

Script: / var / www / client / scripts / ss_check_nt.php 1248 iis 10.0.0.152 get outputPerfmon "Web Service (_Total) - Current Connections"
RRD: / var/www/cliente/rra/windows_2003_-_web2_rede_msft_ds_value_gauge_1282.rrd


PS: Sorry for scripts, I am starting to move now with the php. I am simply using php pra draw months in perl scripts that are already ready.


my ss_check_nt

<?php
$no_http_headers = true;

/* display No errors */
error_reporting(E_ERROR);

include_once(dirname(__FILE__) . "/../include/config.php");
include_once(dirname(__FILE__) . "/../lib/snmp.php");

if (!isset($called_by_script_server)) {
array_shift($_SERVER["argv"]);
print call_user_func_array("ss_check_nt", $_SERVER["argv"]);
}



function ss_check_nt($port, $value, $hostname, $acao, $value2, $arg,$arg1,$arg2,$arg3,$arg4)
{

if ($acao == "index")
{
$a = `/var/www/scripts/check_nt_query_perfmon $port $value $hostname $acao`;
print $a;
}

if ($acao == "query")
{
if( $value2 == "descricao")
{
$a = `/var/www/cliente/scripts/check_nt_query_perfmon $port $value $hostname $acao $value2`;
print $a;
}

if( $value2 == "nome")
{
$a = `/var/www/cliente/scripts/check_nt_query_perfmon $port $value $hostname $acao $value2`;
print $a;
}

if( $value2 == "subtitle")
{
$a = `/var/www/cliente/scripts/check_nt_query_perfmon $port $value $hostname $acao $value2`;
print $a;
}
}

if ($acao == "get")
{


$b = "$arg $arg1 $arg2 $arg3 $arg4";


$a = "/var/www/cliente/scripts/check_nt_query_perfmon $port $value $hostname $acao $value2 $b";

$outputPerfmon = `$a`;

print $outputPerfmon;

}

}

?>
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

1) Script server must only output 1 line
2) It must output everything at one, no print a little followed by a little more

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Post by eterzella.r.t »

My output has only one exit. Look at the example of executacao that put the logo up:

Regarding item 1:

Root @ localhost: / var / www / client / php scripts # .. / script_server.php
PHP Script Server has Started-Parent is cmd
/ Var / www / client / scripts / ss_check_nt.php ss_check_nt 1248 iis 10.0.0.152 get outputPerfmon "Web Service (_Total) - Current Connections"
51
U
Quit
PHP Script Server Shutdown request received, exiting

Regarding item 2:

Not understand what you meant.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You output contains 2 lines. This is incorrect. Secondly, if you have this:

print "A";
print "B";

This is also invalid. It must be:

print "AB";

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests