php scripts work, but not graphing
Moderators: Developers, Moderators
php scripts work, but not graphing
Hi all,
I've i little misunderstanding on how to use php script to built some useful graph.
I wrote a php script for (Lucent)Ascend-MAX 3000 device, just to know the number of current connections, memory, time and so on; It works, 'cause if i run it like this:
<<
C:\Inetpub\wwwroot\cacti\scripts>php ss_mem_conn.php 10.10.10.253 >>
It reply correctly with
<<
Connected : 3 - chassisMemTotal:12672832 chassisMemAvaible:9952640 chassisMemThreshold:200000
>>
I can also display other informations, like ip Address, timeticks and so on..
If i try to run the same script with the script_server.php, it doesn't work, just move out from the server without any errors or warnings.
I've already created a data input method, with the method type "Script - Script Server (PHP)"; than i created the data templates and the graph template.. but in the end I received this error in the log
02/01/2007 04:17:58 PM - SYSTEM STATS: Time:2.4586 Method:cmd.php Processes:1 Threads:N/A Hosts:10 HostsPerProcess:10 DataSources:5 RRDsProcessed:3
02/01/2007 04:17:57 PM - CMDPHP: Poller[0] Host[5] DS[15] WARNING: Result from SERVER not valid. Partial Result: WARNING: Function do
02/01/2007 04:17:57 PM - PHPSVR: Poller[0] WARNING: Function does not exist
02/01/2007 04:17:57 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist
Host[5] is the Max-3000 device, all the other things seems to work fine(It's just slow)
cacti-0.8.6i.1.4.exe
MySQL 5.022 , PHP 5.1.6 w/TheWitness SNMP plugin , RRDTool 1.2.15 , Cygwin core 1.5.20 ,cactid 0.8.6i beta
so.. I need help!
Thanks in advance to all the community.
Za
I've i little misunderstanding on how to use php script to built some useful graph.
I wrote a php script for (Lucent)Ascend-MAX 3000 device, just to know the number of current connections, memory, time and so on; It works, 'cause if i run it like this:
<<
C:\Inetpub\wwwroot\cacti\scripts>php ss_mem_conn.php 10.10.10.253 >>
It reply correctly with
<<
Connected : 3 - chassisMemTotal:12672832 chassisMemAvaible:9952640 chassisMemThreshold:200000
>>
I can also display other informations, like ip Address, timeticks and so on..
If i try to run the same script with the script_server.php, it doesn't work, just move out from the server without any errors or warnings.
I've already created a data input method, with the method type "Script - Script Server (PHP)"; than i created the data templates and the graph template.. but in the end I received this error in the log
02/01/2007 04:17:58 PM - SYSTEM STATS: Time:2.4586 Method:cmd.php Processes:1 Threads:N/A Hosts:10 HostsPerProcess:10 DataSources:5 RRDsProcessed:3
02/01/2007 04:17:57 PM - CMDPHP: Poller[0] Host[5] DS[15] WARNING: Result from SERVER not valid. Partial Result: WARNING: Function do
02/01/2007 04:17:57 PM - PHPSVR: Poller[0] WARNING: Function does not exist
02/01/2007 04:17:57 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist
Host[5] is the Max-3000 device, all the other things seems to work fine(It's just slow)
cacti-0.8.6i.1.4.exe
MySQL 5.022 , PHP 5.1.6 w/TheWitness SNMP plugin , RRDTool 1.2.15 , Cygwin core 1.5.20 ,cactid 0.8.6i beta
so.. I need help!
Thanks in advance to all the community.
Za
- Attachments
-
- ss_mem_conn.zip
- (842 Bytes) Downloaded 255 times
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Your result is not correct. You MUST return a formatted string with exactly the following:
VariableA:ValueA VariableB:ValueB VariableC:ValueC
No units, not other characters no spaces between the Variable and the Value.
Also, you need to upgrade Cacti to J + Patches.
TheWitness
VariableA:ValueA VariableB:ValueB VariableC:ValueC
No units, not other characters no spaces between the Variable and the Value.
Also, you need to upgrade Cacti to J + Patches.
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?
well...
Thanks for the reply 'cause i really need to get php script works.
My version of cacti is the J one, and i've downloaded and replaced the files
The ss:sql.php script seems to work, but not the ss_fping.php
My version of cacti is the J one, and i've downloaded and replaced the files
with the prepatched files founded inhtml_tree.php, ping.php, rrd.php
Well, now i've the right format result
But I still have those errors on the logC:\Inetpub\wwwroot\cacti\scripts>php ss_mem_conn.php 10.10.10.253
chassisMemTotal:12672832 chassisMemAvaible:10021760 chassisMemThreshold:200000 Connessioni:0
C:\Inetpub\wwwroot\cacti\scripts>
If I try to execute the same script into the script_server.php this is the result:02/13/2007 06:31:00 PM - CMDPHP: Poller[0] Host[5] DS[24] WARNING: Result from SERVER not valid. Partial Result: WARNING: Function do
02/13/2007 06:31:00 PM - PHPSVR: Poller[0] WARNING: Function does not exist
02/13/2007 06:31:00 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist
The ss:sql.php script seems to work, but not the ss_fping.php
And i've the same error executing my script:C:\Inetpub\wwwroot\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
c:\inetpub\wwwroot\cacti\scripts\ss_sql.php ss_sql
Uptime:59031 Threads:5 Questions:78453 SlowQueries:0 Opens:1089 FlushTables:1 OpenTables:5 QPS:1.329
c:\inetpub\wwwroot\cacti\scripts\ss_fping.php ss_fping 10.10.10.253
Fatal error: Cannot redeclare db_connect_real() (previously declared in C:\Inetpub\wwwroot\cacti\lib\data
base.php:36) in c:\Inetpub\wwwroot\cacti\lib\database.php on line 58
C:\Inetpub\wwwroot\cacti>
And still i don't have data on the graph as the picture in the bottom could explain.[/quote]C:\Inetpub\wwwroot\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
c:\inetpub\wwwroot\cacti\scripts\ss_mem_conn.php ss_mem_conn 10.10.10.253
Fatal error: Cannot redeclare db_connect_real() (previously declared in C:\Inetpub\wwwroot\cacti\lib\data
base.php:36) in c:\Inetpub\wwwroot\cacti\lib\database.php on line 58
- Attachments
-
- NoData.JPG (42.67 KiB) Viewed 9013 times
-
- NoData1.JPG (31.28 KiB) Viewed 9013 times
Last edited by za on Wed Feb 14, 2007 4:13 am, edited 1 time in total.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
try this
- Attachments
-
- ss_fping.zip
- (1.19 KiB) Downloaded 271 times
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?
Thanks
I was looking your fping script and i noticed that there isn't a call to config.php, so i simply delete that call from my script and now it works..
Za
but.. is it ok?C:\Inetpub\wwwroot\cacti>php script_server.php
PHP Script Server has Started - Parent is cmd
c:\inetpub\wwwroot\cacti\scripts\ss_mem_conn.php ss_mem_conn 10.10.10.253
chassisMemTotal:12672832 chassisMemAvaible:10006720 chassisMemThreshold:200000 Connessioni:2
quit
PHP Script Server Shutdown request received, exiting
C:\Inetpub\wwwroot\cacti>
Za
trouble
Well.. i've the same problem with the ss_fping.php; as my script it works from the server_script.php, but they don't work properly when they have to populate the graph.
I follow this how-to guide
I follow this how-to guide
First i did the input type method, second the data template and then the graph template.
- Attachments
-
- 1.JPG (23.82 KiB) Viewed 8924 times
-
- 2.JPG (25.1 KiB) Viewed 8924 times
I've tried to look inside the .rrd file referred to the graph generated by the script ss_fping.php but this is the reply:
It's just and odd thing, or i'm just a looser?!?!
Za
As you can see in the three line marked up there are no data.. but also no errror..C:\rrdtool>rrdtool info c:\inetpub\wwwroot\cacti\rra\astaro_time_43.rrd
filename = "c:\inetpub\wwwroot\cacti\rra\astaro_time_43.rrd"
rrd_version = "0003"
step = 300
last_update = 1171549802
ds[time].type = "GAUGE"
ds[time].minimal_heartbeat = 600
ds[time].min = 0.0000000000e+00ds[time].unknown_sec = 2ds[time].max = NaN
ds[time].last_ds = "UNKN"
ds[time].value = NaN
rra[0].cf = "AVERAGE"
rra[0].rows = 600
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 700
rra[1].pdp_per_row = 6
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 775
rra[2].pdp_per_row = 24
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = 0.0000000000e+00
rra[2].cdp_prep[0].unknown_datapoints = 5
rra[3].cf = "AVERAGE"
rra[3].rows = 797
rra[3].pdp_per_row = 288
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = 0.0000000000e+00
rra[3].cdp_prep[0].unknown_datapoints = 173
rra[4].cf = "MAX"
rra[4].rows = 600
rra[4].pdp_per_row = 1
rra[4].xff = 5.0000000000e-01
rra[4].cdp_prep[0].value = NaN
rra[4].cdp_prep[0].unknown_datapoints = 0
rra[5].cf = "MAX"
rra[5].rows = 700
rra[5].pdp_per_row = 6
rra[5].xff = 5.0000000000e-01
rra[5].cdp_prep[0].value = NaN
rra[5].cdp_prep[0].unknown_datapoints = 0
rra[6].cf = "MAX"
rra[6].rows = 775
rra[6].pdp_per_row = 24
rra[6].xff = 5.0000000000e-01
rra[6].cdp_prep[0].value = 0.0000000000e+00
rra[6].cdp_prep[0].unknown_datapoints = 5
rra[7].cf = "MAX"
rra[7].rows = 797
rra[7].pdp_per_row = 288
rra[7].xff = 5.0000000000e-01
rra[7].cdp_prep[0].value = 0.0000000000e+00
rra[7].cdp_prep[0].unknown_datapoints = 173
It's just and odd thing, or i'm just a looser?!?!
Za
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Have you changed logging to DEBUG and then run the following from the command line yet:
php <path_cacti>/cmd.php host_id host_id
Where host_id is the host_id of the host having the problem? Did you get data back?
TheWitness
php <path_cacti>/cmd.php host_id host_id
Where host_id is the host_id of the host having the problem? Did you get data back?
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?
I'm wondering.. why??!!
This is the result..
Thanks!
Za
It seem the script server was started properly and i can see some output data.. so why i cannot get the same data on the graph?..02/19/2007 09:27:04 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select realm_id from user_auth_realm where user_id=1"
02/19/2007 09:27:04 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select username from user_auth where id=1"
02/19/2007 09:27:04 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='1' and user_auth_realm.realm_id='15'"
02/19/2007 09:27:04 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select id from user_auth where username='guest'"
02/19/2007 09:27:04 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select cacti from version"
02/19/2007 09:26:58 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select realm_id from user_auth_realm where user_id=1"
02/19/2007 09:26:58 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select username from user_auth where id=1"
02/19/2007 09:26:58 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='1' and user_auth_realm.realm_id='15'"
02/19/2007 09:26:58 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select id from user_auth where username='guest'"
02/19/2007 09:26:58 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select cacti from version"
02/19/2007 09:26:38 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select realm_id from user_auth_realm where user_id=1"
02/19/2007 09:26:38 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select username from user_auth where id=1"
02/19/2007 09:26:38 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='1' and user_auth_realm.realm_id='15'"
02/19/2007 09:26:38 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select id from user_auth where username='guest'"
02/19/2007 09:26:38 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select cacti from version"
02/19/2007 09:26:17 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select realm_id from user_auth_realm where user_id=1"
02/19/2007 09:26:17 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select username from user_auth where id=1"
02/19/2007 09:26:17 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='1' and user_auth_realm.realm_id='15'"
02/19/2007 09:26:17 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select id from user_auth where username='guest'"
02/19/2007 09:26:17 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select cacti from version"
02/19/2007 09:26:15 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select realm_id from user_auth_realm where user_id=1"
02/19/2007 09:26:15 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select username from user_auth where id=1"
02/19/2007 09:26:15 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='1' and user_auth_realm.realm_id='15'"
02/19/2007 09:26:15 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select id from user_auth where username='guest'"
02/19/2007 09:26:15 AM - CMDPHP: Poller[0] DEBUG: SQL Cell: "select cacti from version"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_time (poller_id, start_time, end_time) values (0, NOW(), NOW())"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Time: 0.9775 s, Theads: N/A, Hosts: 1
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (51, 'traffic_in', '2007-02-19 09:26:10', '3844790019')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[51] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.3, output: 3844790019
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (58, 'traffic_in', '2007-02-19 09:26:10', '173037507')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[58] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.10, output: 173037507
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (58, 'traffic_out', '2007-02-19 09:26:10', '173037432')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[58] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.10, output: 173037432
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (57, 'traffic_in', '2007-02-19 09:26:10', '1806408612')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[57] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.9, output: 1806408612
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (57, 'traffic_out', '2007-02-19 09:26:10', '1806408541')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[57] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.9, output: 1806408541
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (56, 'traffic_in', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[56] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.8, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (56, 'traffic_out', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[56] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.8, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (55, 'traffic_in', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[55] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.7, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (55, 'traffic_out', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[55] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.7, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (54, 'traffic_in', '2007-02-19 09:26:10', '1658340')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[54] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.6, output: 1658340
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (54, 'traffic_out', '2007-02-19 09:26:10', '1658340')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[54] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.6, output: 1658340
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (53, 'traffic_in', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[53] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.5, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (53, 'traffic_out', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[53] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.5, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (52, 'traffic_in', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[52] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.4, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (52, 'traffic_out', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[52] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.4, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (51, 'traffic_out', '2007-02-19 09:26:10', '3937195403')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[51] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.3, output: 3937195403
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (50, 'traffic_in', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[50] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.2, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (50, 'traffic_out', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[50] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.2, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (49, 'traffic_in', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[49] SNMP: v1: 10.10.10.253, dsname: traffic_in, oid: .1.3.6.1.2.1.2.2.1.10.1, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (49, 'traffic_out', '2007-02-19 09:26:10', '0')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[49] SNMP: v1: 10.10.10.253, dsname: traffic_out, oid: .1.3.6.1.2.1.2.2.1.16.1, output: 0
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (45, '', '2007-02-19 09:26:10', 'U')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[45] SERVER: php c:/Inetpub/wwwroot/cacti/scripts/ss_mem_conn.php 10.10.10.253, output: U
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] WARNING: Function does not exist
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: INC: 'php' FUNC: 'c:/Inetpub/wwwroot/cacti/scripts/ss_mem_conn.php' PARMS: '10.10.10.253'
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[45] WARNING: Result from SERVER not valid. Partial Result: Warning: include_onc
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (29, '', '2007-02-19 09:26:10', 'U')"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[29] SERVER: php c:/Inetpub/wwwroot/cacti/scripts/ss_mem_conn.php 10.10.10.253, output: U
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] DS[29] WARNING: Result from SERVER not valid. Partial Result:
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] WARNING: Function does not exist
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: INC: 'php' FUNC: 'c:/Inetpub/wwwroot/cacti/scripts/ss_mem_conn.php' PARMS: '10.10.10.253'
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "update poller_reindex set assert_value='3601954000' where host_id='5' and data_query_id='1' and arg1='.1.3.6.1.2.1.1.3.0'"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] RECACHE: Processing 1 items in the auto reindex cache for '10.10.10.253'.
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Assoc: "select poller_reindex.data_query_id, poller_reindex.action, poller_reindex.op, poller_reindex.assert_value, poller_reindex.arg1 from poller_reindex where poller_reindex.host_id=5"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "update host set status = '3', status_event_count = '0', status_fail_date = '0000-00-00 00:00:00', status_rec_date = '0000-00-00 00:00:00', status_last_error = '', min_time = '0.00000', max_time = '68.49000', cur_time = '6.14', avg_time = '5.75664481201', total_polls = '6995', failed_polls = '0', availability = '100' where hostname = '10.10.10.253'"
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] Host[5] SNMP: Host responded to SNMP
02/19/2007 09:26:10 AM - CMDPHP: Poller[0] PHP Script Server Started Properly
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is cmd
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: FILENM: c:\Inetpub\wwwroot\cacti\script_server.php
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: DIRNAM: c:/inetpub/wwwroot/cacti
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: GETCWD: c:/
02/19/2007 09:26:10 AM - PHPSVR: Poller[0] DEBUG: SERVER: cmd
Thanks!
Za
Code
This is the code of one script..
Za
Code: Select all
<?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_mem_conn", $_SERVER["argv"]);
}
function ss_mem_conn($hostname) {
$snmp_community = "public";
$snmp_version = "1";
$snmp_port = "161";
$snmp_timeout = "1000";
if (($snmp_version == "1" | $snmp_version == "2")) {
$snmpv3_auth_username = "";
$snmpv3_auth_password = "";
$snmpv3_auth_protocol = "";
$snmpv3_priv_passphrase = "";
$snmpv3_priv_protocol = "";
}
$oids = array(
"chassisMemTotal" => ".1.3.6.1.4.1.529.2.6.5.0",
"chassisMemAvaible" => ".1.3.6.1.4.1.529.2.6.6.0",
"chassisMemThreshold" => ".1.3.6.1.4.1.529.2.6.7.0",
);
$first = ".1.3.6.1.4.1.529.12.2.1.6.";
$conn = 0;
$result = "";
for ( $i=1; $i<=121; $i++ ){
$var_a = (cacti_snmp_get($hostname, $snmp_community, $first.$i, $snmp_version, $snmp_port, $snmp_timeout, SNMP_POLLER));
if ( $var_a == 3 ) $conn++;
}
for ($i=0;$i<(count($oids));$i++) {
$row = each($oids);
$var = (cacti_snmp_get($hostname, $snmp_community, $row["value"], $snmp_version, $snmpv3_auth_username, $snmpv3_auth_password, $snmp_port, $snmp_timeout, SNMP_POLLER));
$result = is_numeric($var) ? ( $result . $row["key"] . ":" . $var . " ") : ($result . $row["key"] . ":NaN ");
}
$result = " Connected : " . $conn . " - ". $result;
return trim($result);
}
?>
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
This script is messed up. Please re-read the documentation on creating a script server script. Also, please note that your Data Input method should be referring, as noted by Gandolf, the correct "type".
TheWitness
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?
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please change the first few lines to And you may want to pay extra attention to error handling, e.g. if target device does not respond. And, of course, there's no need to hard code the snmp parameters. Find help at the first link of my signature on how to provide those parms when calling the script.
Again my question: You may run this script using SCRIPT_SERVER, everything has been prepared for it
Reinhard
Code: Select all
<?php
$no_http_headers = true;
/* display No errors */
error_reporting(E_ERROR);
if (!isset($called_by_script_server)) {
include_once(dirname(__FILE__) . "/../include/config.php");
include_once(dirname(__FILE__) . "/../lib/snmp.php");
array_shift($_SERVER["argv"]);
print call_user_func_array("ss_mem_conn", $_SERVER["argv"]);
}
Again my question: You may run this script using SCRIPT_SERVER, everything has been prepared for it
Reinhard
Thanks Gandalf for the quick reply.
Well i replaced the line that you suggest, but the result is the same..
As I posted some day ago (up to this page) I can use the script server from MS-DoS prompt, and it correctly reply with all the data.
The trouble start when I try to drawing graph using that script..the first thing that i did it was adding a new data input method as Script - Script Server (PHP), after that a data template and last a graph template.
But all the field for data in the graph are fixed on nan..
I've tested all my script using the script_server from command line, and they works..i just don' know how to use the script as a source for the graph( I've already red the how to building graph using script)
I really need that!
Thanks
Za
Well i replaced the line that you suggest, but the result is the same..
As I posted some day ago (up to this page) I can use the script server from MS-DoS prompt, and it correctly reply with all the data.
The trouble start when I try to drawing graph using that script..the first thing that i did it was adding a new data input method as Script - Script Server (PHP), after that a data template and last a graph template.
But all the field for data in the graph are fixed on nan..
I've tested all my script using the script_server from command line, and they works..i just don' know how to use the script as a source for the graph( I've already red the how to building graph using script)
I really need that!
Thanks
Za
Who is online
Users browsing this forum: No registered users and 0 guests