RRD Graphing Monitoring Script | Cacti

I have been working a lot with Cacti lately I had a need to make a script to ensure Cacti graphs were working and alert if they were not

So I whipped up this little script that uses the rrdtool last update command which compares the value between polls

the expected behavior of the RRD tool is to change the last update time at each poll so if cacti is set up to poll every 1 minute then at minute 2, the value should be different than at minute 1.

At each poll, the value should increment if the value does not increment then the graph has been updated.

here is a manual view of this in action


rrdtool lastupdate local_linux_machine_load_1min_2.rrd
load_1min load_5min load_15min

1559757663: 0.33 0.45 0.50


As you can see the last update hash is 1559757663

After 1 Minute we can see that the hash has changed to 1559757728

rrdtool lastupdate local_linux_machine_load_1min_2.rrd
load_1min load_5min load_15min

1559757728: 0.34 0.44 0.49


This indicates the RRA file has been updated by the rrdtool

I have posted the script to my GitHub page here is the link to the script https://github.com/bmfmancini/rrd-monitor

To use the script simply specify the path to the RRA file you want to monitor and the path to the log file you want to write to in the case of cacti it would be the cacti.log file

then call the script via a cronjob every other minute so the script can compare the values

essentially as described above if the values are the same then something is not right and the script will write a graphs not updating message to the log.

If you have any problems or suggestions let me know!

Leave a Reply

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.