Advanced Ping with Cacti

I use an advanced ping template with Cacti to monitor ICMP latency. Advanced Ping is based on a template originally found on the Cacti forums, but modified to look more like Smoke Ping. My thanks go to my colleague at Talia, Enno, for making it look beautiful as well as functional.



  1. Download the Advanced Ping tar archive.
  2. Extract the xml template and ss_fping.php.
  3. Copy ss_fping.php to the Cacti “scripts” directory, such as /var/www/cacti/scripts.
  4. Ensure ss_fping.php is readable by the web server’s user. Readable by all is safe. It does not need to be executable.
  5. In the Cacti web interface, import cacti_graph_template__00_advanced_ping.xml.
  6. Optionally, rename the template to remove the leading 00 (I prefer this graph to be sorted above all others), or to change its width from 750 to 500 pixels.

Add this graph template to a host and create the graph. You will be prompted what type of ping (ICMP or UDP), timeout, and port (if UDP).


  1. caver’s avatar

    Be aware, at some cases you can damage your cacti instance, due to multi add of colors with 0 id.
    To repair, execute a SQL query “delete from colors where id =0”


  2. Hussain’s avatar

    when importing the XML file I get an error which is

    Hash version does not exist. any help please ?


  3. Silvia’s avatar

    Hello, I have installed Advanced Ping but i have some problems. Cacti graphs latency in ms but the data quuery associated is empty.. Somebody could help me?


  4. rk4k’s avatar

    Add it successfuly and also graph correctly

    Some modification needed manually.

    1. Add name to data template
    2. Add name to graph template.

    Thats all.


  5. Anna Patil’s avatar

    Add it successfuly and also graph correctly,

    but Packet Loss showing as nan


    1. Tyler Wagner’s avatar

      That’s correct. How would you expect packet loss to register? Numbers are for replies in ms.


    2. Manoel Lemos’s avatar


      Thanks for this material!

      However, I need some help.

      I tried to import this template to my Cacti install (Version 0.8.8.b) and it is not working.

      I get this error message while importing: Error: XML: Hash version does not exist.

      And in the Graph Templates list I get an empty line.

      And also many empty lines on the CDEF’s.

      And I can’t make the graph to work.

      Can you provide any help on how to make it work?

      Thanks in adance!



      1. Tyler Wagner’s avatar

        The first result on this page explains the problem.

        Quoting: Cacti supports importing templates exported with an older version into a newer version, but not the reverse.

        Update your Cacti. 0.8.8b is ancient.


      2. Teddy’s avatar

        I am trying to do UDP ping with Advanced Ping and it works well for port 53 (DNS) but it does not work with port 123 (NTP). Any ideas? Tried Advanced Ping Alt – same thing… Here is the RRDTool Command output:

        /usr/bin/rrdtool graph – \
        –imgformat=PNG \
        –start=’-86400′ \
        –end=’-300′ \
        –title=’ntp4 service test – Advanced Ping’ \
        –rigid \
        –base=’1000′ \
        –height=’120′ \
        –width=’500′ \
        –alt-autoscale-max \
        –lower-limit=’0′ \
        –vertical-label=’seconds’ \
        –slope-mode \
        –font TITLE:10: \
        –font AXIS:7: \
        –font LEGEND:8: \
        –font UNIT:7: \
        DEF:a=’/var/lib/cacti/rra/ntp4_service_test_loss_1959.rrd’:’min’:AVERAGE \
        DEF:b=’/var/lib/cacti/rra/ntp4_service_test_loss_1959.rrd’:’avg’:AVERAGE \
        DEF:c=’/var/lib/cacti/rra/ntp4_service_test_loss_1959.rrd’:’max’:AVERAGE \
        DEF:d=’/var/lib/cacti/rra/ntp4_service_test_loss_1959.rrd’:’loss’:AVERAGE \
        DEF:e=’/var/lib/cacti/rra/ntp4_service_test_loss_1959.rrd’:’dev’:AVERAGE \
        CDEF:cdefa=’a,1000,/’ \
        CDEF:cdefb=’b,1000,/’ \
        CDEF:cdefc=’c,1000,/’ \
        CDEF:cdefe=’e,1000,/’ \
        CDEF:cdefg=’b,a,-,e,-,e,-,1000,/’ \
        CDEF:cdefh=’e,1000,/’ \
        CDEF:cdefbb=’c,b,-,e,-,e,-,1000,/’ \
        CDEF:cdefbh=’d,0,GT,d,2,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefbi=’d,3,GT,d,5,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefbj=’d,5,GT,d,10,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefca=’d,10,GT,d,15,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefcb=’d,15,GT,d,50,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefcc=’d,50,GT,d,95,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefcd=’d,95,GT,d,99,GT,UNKN,b,IF,UNKN,IF,1000,/’ \
        CDEF:cdefce=’d,99,GT,d,100,GT,UNKN,INF,IF,UNKN,IF’ \
        COMMENT:’ ‘ \
        COMMENT:’ ‘ \
        COMMENT:’ ‘ \
        COMMENT:’ ‘ \
        COMMENT:’ ‘ \
        AREA:cdefa#FFFFFFFF:” \
        AREA:cdefg#CCCCCCFF:”:STACK \
        AREA:cdefh#AAAAAAFF:”:STACK \
        AREA:cdefh#888888FF:”:STACK \
        AREA:cdefh#888888FF:”:STACK \
        AREA:cdefh#AAAAAAFF:”:STACK \
        AREA:cdefbb#CCCCCCFF:”:STACK \
        AREA:cdefh#FFFFFFFF:”:STACK \
        AREA:cdefh#FFFFFFFF:”:STACK \
        AREA:cdefa#FFFFFFFF:” \
        COMMENT:’Pkt Loss (color)\:’ \
        LINE1:cdefb#00BD27FF:’0%’ \
        LINE1:cdefbh#AFECEDFF:’01-02%’ \
        LINE1:cdefbi#55D6D3FF:’03-05%’ \
        LINE1:cdefbj#7CB3F1FF:’06-10%’ \
        LINE1:cdefca#4668E4FF:’11-15%’ \
        LINE1:cdefcb#A150AAFF:’16-50%’ \
        LINE1:cdefcc#FF00FFFF:’51-95%’ \
        LINE1:cdefcd#F51D30FF:’96-100%\n’ \
        AREA:cdefce#F51D30FF:” \
        COMMENT:’Pkt Loss\:’ \
        GPRINT:d:LAST:’ Last\:%6.2lf%%’ \
        GPRINT:d:MIN:’Min\:%6.2lf%%’ \
        GPRINT:d:AVERAGE:’Avg\:%6.2lf%%’ \
        GPRINT:d:MAX:’Max\:%6.2lf%%\n’ \
        COMMENT:’RTT (color)\:’ \
        HRULE:0#888888FF:'(rttavg +- 1*sdev)’ \
        HRULE:0#AAAAAAFF:'(rttavg +- 2*sdev)’ \
        HRULE:0#CCCCCCFF:'(rttavg +- 3*sdev)\n’ \
        HRULE:0#FFFFFFFF:” \
        COMMENT:’RTT Min\:’ \
        GPRINT:cdefa:LAST:’Last\:%8.2lf %s’ \
        GPRINT:cdefa:MIN:’Min\:%8.2lf %s’ \
        GPRINT:cdefa:AVERAGE:’Avg\:%8.2lf %s’ \
        GPRINT:cdefa:MAX:’Max\:%8.2lf %s\n’ \
        COMMENT:’RTT Avg\:’ \
        GPRINT:cdefb:LAST:’Last\:%8.2lf %s’ \
        GPRINT:cdefb:MIN:’Min\:%8.2lf %s’ \
        GPRINT:cdefb:AVERAGE:’Avg\:%8.2lf %s’ \
        GPRINT:cdefb:MAX:’Max\:%8.2lf %s\n’ \
        COMMENT:’RTT Max\:’ \
        GPRINT:cdefc:LAST:’Last\:%8.2lf %s’ \
        GPRINT:cdefc:MIN:’Min\:%8.2lf %s’ \
        GPRINT:cdefc:AVERAGE:’Avg\:%8.2lf %s’ \
        GPRINT:cdefc:MAX:’Max\:%8.2lf %s\n’ \
        COMMENT:’Std Dev\:’ \
        GPRINT:cdefe:LAST:’Last\:%8.2lf %s’ \
        GPRINT:cdefe:MIN:’Min\:%8.2lf %s’ \
        GPRINT:cdefe:AVERAGE:’Avg\:%8.2lf %s’ \
        GPRINT:cdefe:MAX:’Max\:%8.2lf %s\n’

        RRDTool Says:



        1. Tyler Wagner’s avatar

          Sorry, I’ve not tried that. But note that the command you posted merely asks rrdtool to graph data already stored in the RRA file. Doing a “UDP ping” means crafting a UDP packet, specific to the software you are querying, and hoping that the remote side answers or responds with an ICMP port unreachable message. Start by constructing such a packet with a tool like hping2/3, and you might be able to make this work.

          Cacti is a poor service interrogation tool (black box software probe), which is what you are attempting here. If you do get it working, please document it here or link me to it! Good luck!


        2. Kevin’s avatar

          I was able to add this to my Cacti v1.1.27. Script OK, xml imported OK. I was able to add graph to a device, but I was not prompted to change the settings for ICMP, etc. Where can I do this manually after the fact?
          Also, does this support 1m polling? I imported using my 1m polling template in the new Cacti but on the graph it still says ‘every 300 seconds’. is this hard coded into the graph?


          1. Tyler Wagner’s avatar

            The template above is configured for 300s polling, so you’d need to change it to 1-minute polling using the same steps as that guide. Also change the text in the template that says “300 seconds”, but this is just appearance.


          2. boris64’s avatar

            Hey Kevin,

            did you find out why there’s no prompt for the settings? I’m having exactly the same problem. Of course I could manually create all the sources, but this really is too much overhead (i need ~15 ping different graphs) . I’m using cacti 1.1.38 here…



Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.