Howto: Graphs which update more than once per minute

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Moderators, Developers

Post Reply
Cacti User
Posts: 86
Joined: Mon Oct 12, 2009 3:11 pm

Howto: Graphs which update more than once per minute

#1 Post by marcmerlin » Sat Jul 24, 2010 5:33 pm

Cacti by default is setup to run poller.php every minute.
This is often enough for more people.

Now, there may be times when you want to update your RRD more often that that. In my case it was to track electricity use that is sampled every second and that I wanted to log every 10 seconds to catch transient loads.

Running the poller more often (which you can't do via cron anyway since cron only runs once per minute) is not recommended since it would just put extra load on your system while the poller looks at all your graphs.

What you need to do is:
1) setup an RRA interval like this one (management/data sources/RRA):
Hourly (10sec avg for 1 month)
steps: 1
rows: 446400
timespan: 3600

2) Configure your data source to use that more precise RRA and change the step value from 60(sec) to 10(sec). Change heartbeat accordingly, e.g. to 20(sec).

Then let cacti run, create your RRD, gather data and make sure everything works (if you can't get that part working, refer to other guides on basic graph setup).
Once things are working, go in your Data Source, and uncheck data source active.

3) feed data manually into cacti. My cron job looks like this:
* * * * * root for i in 1 2 3 4 5 6; do /usr/bin/rrdtool update /var/lib/cacti/rra/houseecm1_25.rrd --template `parseecmpower --ecm1 --cacti-dump-header` `/var/local/scr/parseecmpower --ecm1 --rrdtool`; sleep 9; done
My script outputs:
gargamel [mc]# parseecmpower --ecm1 --cacti-dump-header
gargamel [mc]# /var/local/scr/parseecmpower --ecm1 --rrdtool

and that's it, you're done (read the rrdtool update man page for more details, just make sure you return epoch time in seconds first).

Note that if you are using COUNTER, DERIVE, or ABSOLUTE you will need that data to be very high resolution (i.e. you need it to change by several hundreds per poll unit), or you will see unsightly staircase effects if you get increases that look like 5 - 6 - 5 - 6 - 6 - 6 - 5 instead of 549 - 552 - 548 - 553 - 551 - 550 - 549.

Post Reply