[rrd-users] Translate shell to a VDEF

Paul Halliday paul.halliday at gmail.com
Tue Jan 20 16:02:53 CET 2009


I have a few shell commands that I use to generate stats that I then
plot along with my other VDEFs.

This one in particular is a bit of a kludge and I was wondering if it
is possible the achieve the same result with rrdtool alone.

What I have looks like this:

_dt_per() {

m_args=`rrdtool fetch $rrd_dir/pings_${1}.rrd AVERAGE -s $2 -e $e_t |
sed 1,2d | wc -l | tr -d " "`
echo "scale=5; 100-(`rrdtool fetch $rrd_dir/pings_${1}.rrd AVERAGE -s
$2 -e $e_t | sed 1,2d | grep nan | wc -l | tr -d " "`/$m_args*100)" |
bc;

}

m_args gets the number of items in the time constraint. Then we divide
the number of nans for the same time constraint.

Yeah, ugly. What makes it worse is that it is nested in 2 loops that
go through 14 different RRD's with 4 different date arguments.

Is there an easier way to do this?

Thanks.



More information about the rrd-users mailing list