Friday, January 3, 2014

adding a data input to an rrd


i need to add an additional data source to my rrd file.  in my specific case, 
a new temperature probe; probe 7.

i also managed to forget the specifics of the rrd.  that's okay.

# rrdtool info /var/stats/rrd/envmon/temp.rrd

filename = "temp.rrd"
rrd_version = "0003"
step = 60
last_update = 1388770922
ds[probe1].type = "GAUGE"
ds[probe1].minimal_heartbeat = 300
ds[probe1].min = 5.5000000000e+01
ds[probe1].max = 9.5000000000e+01

cool.  we have the step and type and heartbeat and min and max.

# cpan install RRD::Simple



use strict; 
use RRD::Simple (); 

my $rrd = RRD::Simple->new(); 
my $rrdfile=$ARGV[0]; 
my $source=$ARGV[1]; 
my $type=$ARGV[2]; 
$rrd->add_source($rrdfile, $source => $type); 

... script

usage: ./ file.rrd ds GAUGE

# ./ /var/stats/rrd/envmon/temp.rrd probe7 GAUGE:300:55:95
that wasn't so hard.
Post a Comment