EDIT: Advanced Ping Template Version 1.3 for Cacti 0.8.6g

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

Moderators: Developers, Moderators

Post Reply
DinSoft
Posts: 1
Joined: Tue Oct 07, 2008 6:57 am

Weird issue _

Post by DinSoft »

Hi all,

I have an unexplained behaviour in Catci with the advanced ping plugin:

I am in Vietnam, and I am pinging a host in Switzerland.

There is no way that the RTT is less than 300 ms. It is actually very often over 500 ms. This is why I changed the ping timeout setting from the default 500 ms to 1000 ms.

But, on the graph, it looks like there are RTTs of < 100ms (around 16:00 and 18:00 - 18:20)

How can this happen ?

(I also paste here cacti's log file, without the SNMP data I gather from another device since it is probably irrelevant)
Attachments
The bogus graph
The bogus graph
cacti-smokeping.PNG (38.29 KiB) Viewed 14189 times
cacti-log.txt
Cacti's log file
(25.98 KiB) Downloaded 402 times
jhendrickson
Posts: 2
Joined: Fri Oct 17, 2008 9:55 am

Inconsistent graphs

Post by jhendrickson »

I am getting inconsistent graphs using the Advanced Ping. I have a tcp ping to CNN on port 80 which doesn't graph anything but loss. I have other hosts like Yahoo and Google that graph just fine. I also have another graph that is not displaying anything.

Data Source Debug

/usr/bin/rrdtool create \
/usr/share/cacti/site/rra/cnn_tcp_loss_2277.rrd \
--step 300 \
DS:min:GAUGE:450:0:500 \
DS:dev:GAUGE:450:0:500 \
DS:max:GAUGE:450:0:500 \
DS:avg:GAUGE:450:0:500 \
DS:loss:GAUGE:450:0:100 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \

/usr/bin/rrdtool create \
/usr/share/cacti/site/rra/sprint_kc_ds3_loss_1862.rrd \
--step 300 \
DS:min:GAUGE:450:0:500 \
DS:dev:GAUGE:450:0:500 \
DS:loss:GAUGE:450:0:100 \
DS:avg:GAUGE:450:0:500 \
DS:max:GAUGE:450:0:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \
Attachments
graph_image.php.png
graph_image.php.png (28.51 KiB) Viewed 13985 times
graph_image.php.png
graph_image.php.png (29.03 KiB) Viewed 13985 times
jhendrickson
Posts: 2
Joined: Fri Oct 17, 2008 9:55 am

More Inconsistent Graphs

Post by jhendrickson »

Running from the command line to another host I get different results. Also, the data listed at the bottom of the graph doesn't seem to match the graph.

/usr/share/cacti/site/scripts/ss_fping.php ss_fping sl-gw34-fw-6-0-TS9.sprintlink.net 20 ICMP
min:7.5800 avg:9.6450 max:27.1100 dev:4.6313 loss:0.0000
Attachments
graph_image.php.png
graph_image.php.png (40.04 KiB) Viewed 14008 times
jug
Posts: 4
Joined: Fri Oct 10, 2008 5:20 am
Location: Italy

Changed Advanced Ping Templates

Post by jug »

ATTENTION: Valid only for cacti versions 0.8.6 for 0.8.7 see later post (http://forums.cacti.net/viewtopic.php?p=173542#173542)

Thanks a lot for this Template it gave me the base to have Latency graphs inside my CACTI installation. I changed them a bit so that all Comments are visible and also that the "smoke" is visible in both directions max -> avg -> min.

I also changed the ss_fping.php so that it can run with a non privileged user, using the fping binary which has to be installed (this is better than using normal ping).

If your interested in this changed graph templates and the modified ss_fping.php I will attach the files exported from a CACTI version 0.8.6j to this post.

ATTENTION: I have seen an error in the exported graph TEMPLATE and changed the attachement (just of the 1 person which already downloaded it ;) Please have a look at the version number of the file!
Attachments
cacti_graph_template_ping_advanced_ping_v2_1.xml
Cacti v0.8.6j Advanced Ping v2.1 Template
(41.26 KiB) Downloaded 1711 times
ss_fping.zip
Modified ss_fping.php file using /usr/sbin/fping when called as not privileged user.
(1.56 KiB) Downloaded 1264 times
Last edited by jug on Wed Sep 23, 2009 5:17 am, edited 2 times in total.
ryusez
Posts: 25
Joined: Thu Sep 28, 2006 9:36 pm

Post by ryusez »

can i import new advance ping 2.1 into 0.8.7b

or any one , had import experence ....

thank you
lozzd
Posts: 30
Joined: Thu Dec 08, 2005 7:13 pm
Contact:

Re: Changed Advanced Ping Templates

Post by lozzd »

jug wrote:I also changed the ss_fping.php so that it can run with a non privileged user, using the fping binary which has to be installed (this is better than using normal ping).
GOOD LORD I read this entire thread thinking "There is no way in hell I'm running the poller as root why the hell has no one used 'fping' when the script is called 'fping'" and here I am, last page, the first person with the necessary level of intelligence. Installed and it worked straight off with no problems. THANK YOU!
neteng30
Posts: 12
Joined: Thu Nov 13, 2008 12:43 pm

after install

Post by neteng30 »

After install my graph will not appear because cacti says...+

ERROR: the RRD does not contain an RRA matching the chosen CF
any ideas?
neteng30
Posts: 12
Joined: Thu Nov 13, 2008 12:43 pm

also

Post by neteng30 »

The logs indicate this.

12/04/2008 02:05:03 PM - SPINE: Poller[0] Host[2] DS[874] SS[0] WARNING: Result from SERVER not valid. Partial Result: ...
12/04/2008 02:05:03 PM - PHPSVR: Poller[0] WARNING: Function does not exist
12/04/2008 02:05:03 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist


I have imported the template and the ss_fping script. Am I missing something?
neteng30
Posts: 12
Joined: Thu Nov 13, 2008 12:43 pm

additional lines from log

Post by neteng30 »

12/04/2008 02:45:08 PM - SPINE: Poller[0] DEBUG: PHP Script Server Pipes Closed
12/04/2008 02:45:08 PM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
12/04/2008 02:45:08 PM - SPINE: Poller[0] DEBUG: SS[0] Script Server Shutdown Started
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DS[875] SS[0] SERVER: path_cacti/scripts/ss_fping.php ss_fping hostnameattemptsprotocolport, output: U
12/04/2008 02:45:02 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist
12/04/2008 02:45:02 PM - PHPSVR: Poller[0] DEBUG: INC: 'path_cacti/scripts/ss_fping.php' FUNC: 'ss_fping' PARMS: 'hostnameattemptsprotocolport'
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DS[7] SCRIPT: perl /usr/share/cacti/scripts/unix_processes.pl, output: 118
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DEBUG: The POPEN returned the following File Descriptor 9
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DS[6] SCRIPT: perl /usr/share/cacti/scripts/unix_users.pl , output: 1
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DEBUG: The POPEN returned the following File Descriptor 9
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DS[5] SCRIPT: perl /usr/share/cacti/scripts/loadavg_multi.pl, output: 1min:0.21 5min:0.17 10min:0.21
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DEBUG: The POPEN returned the following File Descriptor 9
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DS[4] SCRIPT: perl /usr/share/cacti/scripts/linux_memory.pl SwapFree:, output: 2031540
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DEBUG: The POPEN returned the following File Descriptor 9
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DS[3] SCRIPT: perl /usr/share/cacti/scripts/linux_memory.pl MemFree:, output: 31000
12/04/2008 02:45:02 PM - SPINE: Poller[0] Host[1] DEBUG: The POPEN returned the following File Descriptor 9
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: SS[0] Confirmed PHP Script Server running
12/04/2008 02:45:02 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is spine
12/04/2008 02:45:02 PM - PHPSVR: Poller[0] DEBUG: FILENM: /usr/share/cacti/script_server.php
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: SS[0] PHP Script Server Child FORK Success
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: SS[0] PHP Script Server About to FORK Child Process
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: SS[0] PHP Script Server Routine Starting
12/04/2008 02:45:02 PM - SPINE: Poller[0] SPINE: Initializing PHP Script Server(s)
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: The PHP Script Server is Required
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: StartHost='0', EndHost='23', TotalPHPScripts='1'
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: The number of php script servers to run is 1
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: The script timeout is 25
12/04/2008 02:45:02 PM - SPINE: Poller[0] DEBUG: SQL:'SELECT value FROM settings WHERE name = 'script_timeout''


Any help?
neteng30
Posts: 12
Joined: Thu Nov 13, 2008 12:43 pm

more info

Post by neteng30 »

If i try to run a php script I get no response.

[root@localhost cacti]# php script_server.php
PHP Script Server has Started - Parent is cmd


^C
[root@localhost cacti]# cd scripts
[root@localhost scripts]# php ss_fping.php 4.2.2.1 ICMP
[root@localhost scripts]#
reboot
Posts: 16
Joined: Sun Mar 05, 2006 7:45 am
Location: The Netherlands

Re: more info

Post by reboot »

neteng30 wrote:After install my graph will not appear because cacti says...+

ERROR: the RRD does not contain an RRA matching the chosen CF
any ideas?
neteng30 wrote:If i try to run a php script I get no response.

[root@localhost cacti]# php script_server.php
PHP Script Server has Started - Parent is cmd


^C
[root@localhost cacti]# cd scripts
[root@localhost scripts]# php ss_fping.php 4.2.2.1 ICMP
[root@localhost scripts]#
Got the same problem over here. I do not get anything.
I've commented line 12. (edited it to: //error_reporting(0);
This enables errors php is giving.
When I run the command it gives an error:

Fatal error: Call to undefined function read_config_option() in /usr/share/cacti/site/scripts/ss_fping.php on line 42.

This script seems to be old and some functions it needs do not exist in the included files (seems correct, because these are in lib/functions.php).

So I traced the function calls for read_config_option() in ss_fping.php.
I commented the rows by adding two slashes for the row and manually typed a value for the variable.

scripts/ss_fping.php line 42:

Code: Select all

        $script_timeout = 10;
        $ping_timeout = 5;
//      $script_timeout = read_config_option("script_timeout");
//      $ping_timeout = read_config_option("ping_timeout");
There was also a function call at line 100. I replaced this call by a variable;

scripts/ss_fping.php line 100:

Code: Select all

        $i = 0;
        while ($i < $ping_sweeps) {
                $result = $ping->ping(AVAIL_PING,
                                        $method,
                                        $ping_timeout,
                                        1);
Now, when I run the command: sudo /usr/bin/php ss_fping.php localhost
I get:
min:0.0600 avg:0.0683 max:0.1100 dev:0.0186 loss:0.0000

So this fixes my script problem. I've imported the latest script a few post above this one. But i'm not getting any graphs. I will debug for a while and report later.

I've found out cacti doesn't like the template:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="ping test - Advanced Ping" \
--base=1000 \
--height=120 \
--width=500 \
--upper-limit=10 \
--lower-limit=0 \
--units-exponent=1 \
--vertical-label="milliseconds" \
--slope-mode \
--font TITLE:9: \
--font AXIS:7: \
--font LEGEND:7: \
--font UNIT:7: \
DEF:a="/var/lib/cacti/rra/ping_test_max_328.rrd":min:AVERAGE \
DEF:b="/var/lib/cacti/rra/ping_test_max_328.rrd":avg:AVERAGE \
DEF:c="/var/lib/cacti/rra/ping_test_max_328.rrd":max:AVERAGE \
DEF:d="/var/lib/cacti/rra/ping_test_max_328.rrd":loss:AVERAGE \
DEF:e="/var/lib/cacti/rra/ping_test_max_328.rrd":dev:AVERAGE \
DEF:f="/var/lib/cacti/rra/ping_test_max_328.rrd":avg:MAX \
DEF:g="/var/lib/cacti/rra/ping_test_max_328.rrd":avg:LAST \
DEF:h="/var/lib/cacti/rra/ping_test_max_328.rrd":min:LAST \
DEF:i="/var/lib/cacti/rra/ping_test_max_328.rrd":loss:MAX \
DEF:j="/var/lib/cacti/rra/ping_test_max_328.rrd":min:MAX \
DEF:ba="/var/lib/cacti/rra/ping_test_max_328.rrd":max:MAX \
DEF:bb="/var/lib/cacti/rra/ping_test_max_328.rrd":dev:MAX \
CDEF:cdefg=d,0,GT,d,2,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefh=d,3,GT,d,5,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefi=d,5,GT,d,10,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefj=d,10,GT,d,15,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefba=d,15,GT,d,50,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefbb=d,50,GT,d,95,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefbc=d,95,GT,d,100,GT,UNKN,INF,IF,UNKN,IF \
CDEF:cdefbe=e,2,/ \
CDEF:cdefbg=c,b,-,e,-,3,/ \
CDEF:cdefca=b,a,-,0.2,* \
CDEF:cdefch=d,0,GT,d,2,GT,UNKN,a,IF,UNKN,IF \
CDEF:cdefci=d,3,GT,d,5,GT,UNKN,a,IF,UNKN,IF \
CDEF:cdefcj=d,5,GT,d,10,GT,UNKN,a,IF,UNKN,IF \
CDEF:cdefda=d,10,GT,d,15,GT,UNKN,a,IF,UNKN,IF \
CDEF:cdefdb=d,15,GT,d,50,GT,a,INF,IF,UNKN,IF \
CDEF:cdefdc=d,50,GT,d,95,GT,UNKN,a,IF,UNKN,IF \
CDEF:cdefdd=d,95,GT,d,100,GT,UNKN,a,IF,UNKN,IF \
LINE1:a:""  \
LINE1:b:""  \
LINE1:c:""  \
LINE1:d:""  \
LINE1:e:""  \
COMMENT:"   Pkt Loss\:"  \
AREA:cdefg#AFECEDFF:"1-2%"  \
AREA:cdefh#55D6D3FF:"3-5%"  \
AREA:cdefi#7CB3F1FF:"6-10%"  \
AREA:cdefj#4668E4FF:"11-15%"  \
AREA:cdefba#A150AAFF:"16-50%"  \
AREA:cdefbb#FF00FFFF:"51-95%"  \
AREA:cdefbc#F51D30FF:"96-100%\n"  \
AREA:g#FFFFFFFF:""  \
AREA:cdefbe#333333FF:"":STACK \
AREA:cdefbe#555555FF:"":STACK \
AREA:cdefbg#888888FF:"":STACK \
AREA:cdefbg#AAAAAAFF:"":STACK \
AREA:cdefbg#CCCCCCFF:"":STACK \
AREA:h#FFFFFFFF:""  \
AREA:cdefca#CCCCCCFF:"":STACK \
AREA:cdefca#AAAAAAFF:"":STACK \
AREA:cdefca#888888FF:"":STACK \
AREA:cdefca#555555FF:"":STACK \
AREA:cdefca#333333FF:"":STACK \
GPRINT:d:AVERAGE:"   Avg Loss\:%6.2lf%%"  \
GPRINT:i:MAX:"Max Loss\:%6.2lf%%\n"  \
AREA:cdefch#AFECEDFF:""  \
AREA:cdefci#55D6D3FF:""  \
AREA:cdefcj#7CB3F1FF:""  \
AREA:cdefda#4668E4FF:""  \
AREA:cdefdb#A150AAFF:""  \
AREA:cdefdc#FF00FFFF:""  \
AREA:cdefdd#F51D30FF:""  \
COMMENT:"    Latency\:"  \
GPRINT:h:LAST:"Min\:%8.2lf ms"  \
GPRINT:g:LAST:"Avg\:%8.2lf ms"  \
GPRINT:c:LAST:"Max\:%8.2lf ms"  \
GPRINT:e:LAST:"Dev\:%8.2lf ms\n"  \
COMMENT:"Avg Latency\:"  \
GPRINT:a:MIN:"Min\:%8.2lf ms"  \
GPRINT:b:AVERAGE:"Avg\:%8.2lf ms"  \
GPRINT:ba:MAX:"Max\:%8.2lf ms"  \
GPRINT:e:AVERAGE:"Dev\:%8.2lf ms\n"  \
LINE1:g#00BD27FF:"" 

RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF
I have no idea what this error means. Anyone?!
plotting4fun
Posts: 24
Joined: Thu Dec 11, 2008 10:42 am

Post by plotting4fun »

12/16/2008 01:50:44 PM - PHPSVR: Poller[0] DEBUG: INC: 'lt;path_cactigt;/scripts/ss_fping.php' FUNC: 'ss_fping' PARMS: 'lt;hostnamegt; lt;attemptsgt; lt;prot
ocolgt; lt;portgt;'
12/16/2008 01:50:44 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist
12/16/2008 01:50:44 PM - PHPSVR: Poller[0] WARNING: Function does not exist
12/16/2008 01:50:44 PM - CMDPHP: Poller[0] Host[30] DS[442] WARNING: Result from SERVER not valid. Partial Result: WARNING: Function do
12/16/2008 01:50:44 PM - CMDPHP: Poller[0] Host[30] DS[442] SERVER: lt;path_cactigt;/scripts/ss_fping.php ss_fping lt;hostnamegt; lt;attemptsgt; lt;protocolg
t; lt;portgt;, output: U
I've got this in my logs, and my graph is empty, what is the problem ?
[root@ukmon002 cli]# cat /etc/cron.d/cacti
*/5 * * * * root /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
[root@ukmon002 cli]# php /var/lib/cacti/scripts/ss_fping.php ukjira001 20 ICMP
min:0.0200 avg:6.5525 max:30.1500 dev:9.2221 loss:0.0000
[root@ukmon002 cli]#
reboot
Posts: 16
Joined: Sun Mar 05, 2006 7:45 am
Location: The Netherlands

Post by reboot »

I've found the solution by using my modified php script (see previous post) and using the basic template in the start post of this topic.

When you get results by runnig the script through the command line, you should be able to get stats in cacti by using the correct template.
plotting4fun
Posts: 24
Joined: Thu Dec 11, 2008 10:42 am

Post by plotting4fun »

[root@ukmon002 ~]# php /var/lib/cacti/scripts/ss_fping.php ukmon001
min:0.8800 avg:4.9633 max:15.1300 dev:5.3669 loss:0.0000[root@ukmon002 ~]#

Thanks ! But in my case, the script works. :o
andreagabellini
Posts: 1
Joined: Mon Dec 29, 2008 11:25 am

Post by andreagabellini »

Hello,

I'm new in this forum and I just started to use this amazing template (version 2.1). To solve the error:

ERROR: the RRD does not contain an RRA matching the chosen CF

you have to add the "LAST" Consolidation Function to the rrd files. Cacti 0.8.7 defaults to only "AVERAGE" and "MAX". You can achieve this in two ways:

1) In "Data Sources" -> RRAs, modify the available RRAs adding LAST consolidation function. In this way you change the default.
2) In "Data Sources" -> RRAs, adds 5 RRAs cloning the existing and add LAST consolidation function as above, and in the Data Template modify "Associated RRA's" to use the new created RRAs.

Before the graphs works, you need to remove the rrd files and wait the poller...
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests