EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

#226 Post by airwalk » Mon Nov 20, 2006 4:48 am

gandalf wrote:Please select a failing host and verify, that _this_ data sources has the "numbers of times to ping the host" set properly. But first, you may want to "php rebuild_poller_cache.php" to make sure that all is up to date. Afterwards, please check "Utilities -> Poller Cache" and search for your host to verify, that the settings are seen by the poller
Reinhard
Thank you for the tips provided. On some point I failed to trace the problem (there were many other problems) and complete reinstall of cacti was the resolution for that.

case_h99
Posts: 6
Joined: Sat Nov 25, 2006 3:57 pm

php problem?

#227 Post by case_h99 » Sat Nov 25, 2006 4:10 pm

Sorry.
I'm new with cacti.
BTW, I successfully installed this advanced ping script and template.
In fact if I run ss_fping.php from command line... that is, from script_server.php I can get some results but.... I also get the php headers:

Content-type: text/html
X-Powered-By: PHP/4.3.8

min:0.2200 avg:0.2467 max:0.3500 dev:0.0468 loss:0.0000


By this, the script/template is not polling anything: the graphic is blank.

My logs (in debug mode) are reporting:

11/25/2006 10:00:12 PM - PHPSVR: Poller[0] DEBUG: INC: '/var/www/cacti/scripts/ss_fping.php' FUNC: 'ss_fping' PARMS: 'ifc-gwr.ifc.cnr.it 20 ICMP'
11/25/2006 10:00:12 PM - CMDPHP: Poller[0] Host[3] DS[181] WARNING: Result from SERVER not valid. Partial Result: Content-type: text/h
11/25/2006 10:00:12 PM - CMDPHP: Poller[0] Host[3] DS[181] SERVER: /var/www/cacti/scripts/ss_fping.php ss_fping ifc-gwr.ifc.cnr.it 20 ICMP , output: U

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#228 Post by gandalf » Sat Nov 25, 2006 4:25 pm

The first one is easy: type "php -q" to suppress headers.
The script server should do so as default. Please read http://forums.cacti.net/viewtopic.php?t=7738 for more help
Reinhard

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#229 Post by gandalf » Sat Nov 25, 2006 4:31 pm

If the ping target is not reachable, the script only spits out a loss value of 100. This will cause rrdtool update errors. To omit those, please consider using the following patch to ss_fping.php

Code: Select all

--- ss_fping.php.orig   2006-11-25 22:27:19.000000000 +0100
+++ ss_fping.php        2006-11-25 22:27:23.000000000 +0100
@@ -80,7 +80,7 @@
        }

        if ($failed_results == $ping_sweeps) {
-               return "loss:100.00";
+               return "min:U avg:U max:U dev:U loss:100.00";
        }else{
                $loss = ($failed_results/$ping_sweeps) * 100;
                $avg = $total_time/($ping_sweeps-$failed_results);
I've only added some U outputs.

Reinhard

case_h99
Posts: 6
Joined: Sat Nov 25, 2006 3:57 pm

#230 Post by case_h99 » Sat Nov 25, 2006 4:57 pm

gandalf wrote:The script server should do so as default.
well, in my case it seems not doing that.... :(
the logs says that:
WARNING: Result from SERVER not valid. Partial Result: Content-type: text/h

... I have php-4.3.8 and cacti-0.8.6i

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#231 Post by gandalf » Sat Nov 25, 2006 4:58 pm

So did you try the link I advertised? Please post the results of those tests
Reinhard

case_h99
Posts: 6
Joined: Sat Nov 25, 2006 3:57 pm

#232 Post by case_h99 » Sat Nov 25, 2006 5:09 pm

gandalf wrote:So did you try the link I advertised? Please post the results of those tests
Yes I already try, as root.

Code: Select all

#php /var/www/cacti/script_server.php 
PHP Script Server has Started - Parent is cmd
Here I put /var/www/cacti/scripts/ss_fping.php ss_fping 192.168.1.1 20 ICMP

Then I get:

Code: Select all

Content-type: text/html
X-Powered-By: PHP/4.3.8

 
min:0.6200 avg:0.6790 max:0.8300 dev:0.0542 loss:0.0000
Thanks.

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#233 Post by gandalf » Sun Nov 26, 2006 6:44 am

You should run it as cactiuser, the user who runs the poller from cron. Then you'll see, that ICMP ping requires root or setuid root
Reinhard

case_h99
Posts: 6
Joined: Sat Nov 25, 2006 3:57 pm

#234 Post by case_h99 » Sun Nov 26, 2006 5:34 pm

gandalf wrote:You should run it as cactiuser, the user who runs the poller from cron. Then you'll see, that ICMP ping requires root or setuid root
Reinhard
The problem is the http header printed by php, not the icmp or udp method... btw running it as cactiuser give me headers.

case_h99
Posts: 6
Joined: Sat Nov 25, 2006 3:57 pm

#235 Post by case_h99 » Mon Nov 27, 2006 5:04 am

Sorry, I renew the question:
where is the problem if in cacti logs I can find these lines?

Code: Select all

11/27/2006 11:00:15 AM - PHPSVR: Poller[0] DEBUG: INC: '/var/www/cacti/scripts/ss_fping.php' FUNC: 'ss_fping' PARMS: '192.168.1.1 20 ICMP'
11/27/2006 11:00:15 AM - CMDPHP: Poller[0] Host[5] DS[58] WARNING: Result from SERVER not valid.  Partial Result: Content-type: text/h
11/27/2006 11:00:15 AM - CMDPHP: Poller[0] Host[5] DS[58] SERVER: /var/www/cacti/scripts/ss_fping.php ss_fping 192.168.1.1 20 ICMP , output: U

barney34
Posts: 6
Joined: Tue Dec 05, 2006 10:34 pm

Help Please

#236 Post by barney34 » Tue Dec 05, 2006 11:03 pm

I have 0.8.6i installed on debian. Everything works but when I added the cacti_graph_template_ping_advanced_ping_v1_3.xml from the begining of this post I can not get it to graph and I get this error.

RRDTool Says:

ERROR: invalid rpn expression in: d,0,GT,d,2,GT,UNKN,INF,IF,UNKN,IF


Thank you

barney34
Posts: 6
Joined: Tue Dec 05, 2006 10:34 pm

Re: Help Please

#237 Post by barney34 » Tue Dec 05, 2006 11:08 pm

barney34 wrote:I have 0.8.6i installed on debian. Everything works but when I added the cacti_graph_template_ping_advanced_ping_v1_3.xml from the begining of this post I can not get it to graph and I get this error.

RRDTool Says:

ERROR: invalid rpn expression in: d,0,GT,d,2,GT,UNKN,INF,IF,UNKN,IF


Thank you
Nevermind figured it out.

triplef
Posts: 2
Joined: Tue Dec 12, 2006 1:54 am

no data

#238 Post by triplef » Tue Dec 12, 2006 1:55 am

i get no data at all..

no idea why i do have a graph but nothin in it..

anyway to debug ? i get 0's for all data
using i version etc.

RRDtool 1.0.49

junkware
Posts: 1
Joined: Tue Dec 12, 2006 2:08 am

#239 Post by junkware » Tue Dec 12, 2006 2:18 am

i get no data too... :roll:

I have 4 ping templates (Advanced ping, Multiping, SmoleLike, Ping Latency), and only Ping Latency work.




FreeBSD 6.1-RELEASE FreeBSD 6.1-RELEASE

cacti-0.8.6i Web-driven graphing interface for RRDTool
cactid-0.8.6.g A multithreaded poller for Cacti written in C
php5-5.1.6_3 PHP Scripting Language (Apache Module and CLI)
php5-bz2-5.1.6_3 The bz2 shared extension for php
php5-gd-5.1.6_3 The gd shared extension for php
php5-mbstring-5.1.6_3 The mbstring shared extension for php
php5-mcrypt-5.1.6_3 The mcrypt shared extension for php
php5-mysql-5.1.6_3 The mysql shared extension for php
php5-openssl-5.1.6_3 The openssl shared extension for php
php5-pcre-5.1.6_3 The pcre shared extension for php
php5-session-5.1.6_3 The session shared extension for php
php5-snmp-5.1.6_3 The snmp shared extension for php
php5-xml-5.1.6_3 The xml shared extension for php
php5-zlib-5.1.6_3 The zlib shared extension for php
rrdtool-1.2.15 Round Robin Database Tools



[email protected]> ping 123.123.123.123 < /usr/local/share/cacti/scripts >
PING 123.123.123.123 (123.123.123.123): 56 data bytes
64 bytes from 123.123.123.123: icmp_seq=0 ttl=255 time=0.328 ms
64 bytes from 123.123.123.123: icmp_seq=1 ttl=255 time=0.313 ms
64 bytes from 123.123.123.123: icmp_seq=2 ttl=255 time=0.293 ms
^C
--- 123.123.123.123 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.293/0.311/0.328/0.014 ms


[email protected]> php /usr/local/share/cacti/script_server.php < /usr/local/share/cacti/scripts >
PHP Script Server has Started - Parent is cmd
ss_fping.php ss_fping 123.123.123.123 20 ICMP
min:0.0000 avg:0.0000 max:0.0000 dev:0.0000 loss:0.0000



[email protected]> php ss_fping.php 123.123.123.123 ICMP < /usr/local/share/cacti/scripts >

Notice: Undefined index: snmp_community in /usr/local/share/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/share/cacti/lib/ping.php on line 537

[email protected]> php ss_fping.php 123.123.123.123 ICMP < /usr/local/share/cacti/scripts >

Notice: Undefined index: snmp_community in /usr/local/share/cacti/lib/ping.php on line 537
[email protected]> < /usr/local/share/cacti/scripts >


[email protected]> cactid --verbosity=5 -S

<...>

DEBUG: MySQL Query ID '109': OK

Host[36] DEBUG: The POPEN returned the following File Descriptor 26

Host[36] DS[184] SCRIPT: perl /usr/local/bin/ping_latency.pl 123.123.123.123, output: roundtrip:U packetloss:100

Host[36] DEBUG: The POPEN returned the following File Descriptor 26

Host[36] ERROR: The POPEN timed out

Host[36] DS[188] WARNING: Result from SCRIPT not valid. Partial Result: ...

Host[36] DS[188] SCRIPT: perl /usr/local/share/cacti/scripts/multi_ping.pl, output: U

Host[36] DEBUG: The POPEN returned the following File Descriptor 26

Host[36] DS[185] SCRIPT: perl /usr/local/share/cacti/scripts/ping.pl 123.123.123.123, output: 44.404

Host[36] DEBUG: The POPEN returned the following File Descriptor 26

Host[36] DS[187] WARNING: Result from SCRIPT not valid. Partial Result:
Notice: Undefined i...

Host[36] DS[187] SCRIPT: php /usr/local/share/cacti/scripts/ss_fping.php 123.123.123.123 20 ICMP , output: U

Host[36] DEBUG: The POPEN returned the following File Descriptor 26

Host[36] DS[186] WARNING: Result from SCRIPT not valid. Partial Result:
Notice: Undefined i...

Host[36] DS[186] SCRIPT: php /usr/local/share/cacti/scripts/ss_fping.php 123.123.123.123 20 ICMP , output: U

DEBUG: MySQL Insert ID '59': 'INSERT INTO poller_output (local_data_id, rrd_name, time, output) VALUES (184,'','2006-12-19 12:44:08','roundtrip:U packetloss:1
00'),(188,'','2006-12-19 12:44:08','U'),(185,'ping','2006-12-19 12:44:08','44.404'),(187,'','2006-12-19 12:44:08','U'),(186,'','2006-12-19 12:44:08','U')'

DEBUG: MySQL Insert ID '59': OK

Host[36] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function

DEBUG: The Value of Active Threads is 0

DEBUG: Valid Thread to be Created

DEBUG: The Value of Active Threads is 1

DEBUG: In Poller, About to Start Polling of Host

MYSQL: Connecting to MySQL database 'cacti' on 'localhost'...

MYSQL: Connected to MySQL database 'cacti' on 'localhost'...


<...>

jdr
Posts: 42
Joined: Sun Dec 25, 2005 9:02 pm

#240 Post by jdr » Fri Dec 29, 2006 12:01 pm

I have the same problem on solaris9:

# /usr/local/bin/php -q /var/htdocs/cacti/scripts/ss_fping.php 127.0.0.1 10 ICMP

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537

Notice: Undefined index: snmp_community in /usr/local/apache2/htdocs/cacti/lib/ping.php on line 537
min:0.0000 avg:0.0000 max:0.0000 dev:0.0000 loss:0.0000

# /usr/local/bin/php --version
PHP 5.2.0 (cli) (built: Dec 21 2006 22:12:07)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

Anyone can help?

Post Reply