Script Server - Questions
Moderators: Developers, Moderators
-
- Cacti User
- Posts: 75
- Joined: Thu Oct 25, 2007 8:20 pm
Script Server - Questions
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:161public:::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:161public:::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:161public:::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:161public:::MD5::DES: get usage 3
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_cpu_1279.rrd
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:161public:::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:161public:::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:161public:::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:161public:::MD5::DES: get usage 3
RRD: /var/www/cliente/rra/windows_2003_-_web2_rede_msft_cpu_1279.rrd
-
- Cacti User
- Posts: 75
- Joined: Thu Oct 25, 2007 8:20 pm
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please test your script with the script server as given by http://forums.cacti.net/viewtopic.php?t=7738
Reinhard
Reinhard
-
- Cacti User
- Posts: 75
- Joined: Thu Oct 25, 2007 8:20 pm
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)."
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)."
-
- Cacti User
- Posts: 75
- Joined: Thu Oct 25, 2007 8:20 pm
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#
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#
-
- Cacti User
- Posts: 75
- Joined: Thu Oct 25, 2007 8:20 pm
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;
}
}
?>
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;
}
}
?>
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
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
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?
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?
-
- Cacti User
- Posts: 75
- Joined: Thu Oct 25, 2007 8:20 pm
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.
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.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
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
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?
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?
Who is online
Users browsing this forum: No registered users and 3 guests