I was excited to see that rrdtool 1.4 was finally released (in October), and with it rrdcached support finally in a main release. After updating rrdtool packages on a couple of my systems I sat out to make things start using the new caching daemon. Cacti was my first to play around with since it uses a fair amount of RRD files. Cacti has been coasting a while on Boost (which I have yet to try and is recommended to me by friends), so nobody is going out of their way to add rrdcached support yet.
A quick and dirty patch to Cacti enabled it:
--- lib/rrd.php.orig 2010-01-08 22:36:56.000000000 -0600
+++ lib/rrd.php 2010-01-08 23:25:30.000000000 -0600
@@ -68,6 +68,9 @@
function rrdtool_execute($command_line, $log_to_stdout, $output_flag, $rrd_struc = array(), $logopt = "WEBLOG") {
global $config;
+ $daemon_path = "unix:/var/run/rrdcached/rrdcached.sock";
+ $command_line = $command_line . " --daemon $daemon_path ";
+
if (!is_numeric($output_flag)) {
$output_flag = RRDTOOL_OUTPUT_STDOUT;
}
A strace of the rrdcached process showed it was being called when I was viewing graphs, but the poller wasn’t working. Turns out Cacti uses rrdtool update --template
everywhere, which is incompatible with rrdcached:
01/08/2010 11:29:14 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/tifa_abc_wann_net_load_5min_59.rrd --template load_5min 1263014937:0.05 --daemon unix:/var/run/rrdcached/rrdcached.sock
ERROR: The caching daemon cannot be used together with templates yet.
I don’t know offhand what the conflict with templates and rrdcached is. I can only guess that the cache internals doesn’t know how to deal with the extra DS information. Looks like we’ll be stuck with Boost a while longer.
rrdgraph vs rtgplot: ugly
libdbi support in RRDtool, RTG/JRTG
The other thing I’m interested in visiting again is the rrdgraph libdbi support. I heavily use the JRTG SNMP poller along with the old rtgplot from RTG to draw graphs from the data it stores in a MySQL table. I hate rtgplot. The output isn’t nowhere as polished as what rrdgraph can do.
More importantly, rtgplot has no concept of unknown time samples. If there’s no data for an interface (poller broke, router down) for several sample periods, it plots the in/out lines from last known values to the next known values, hiding the gap. (Zero delta-insert otherwise gets around this — if the router was actually polled and the counter was zero)
Enter DBI support in RRDtool. Using rrdgraph to plot my JRTG counter data in MySQL. It holds great promise, providing pretty graphs, the option to average, and finally being able to get rid of the last original bit of RTG. Unfortunately, the last time I tried DBI support in 1.3.999something I was sorely disappointed. It worked, but it was *slow*, especially on yearly plots. What took 2-3 seconds to render with rtgplot took *minutes* to do with rtgraph_libdbi.
I know for a fact my database server can return a year’s worth of counter data (105,120 rows) in 1-2 seconds, even with an empty query cache. (protip: UNIQUE KEY 'id' (id,dtime)
) It’s so silly, that I even wrote a rtg2rrd.pl script to dump a year’s worth of data, build a brand new RRD file on ramdisk with one massive RRDs::update
, and generated a graph from that: 5 seconds.
So hopefully rrdgraph_libdbi has improved since then. We’ll see!
Tags: centos, mysql