[rrd-users] multiplicate -1

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Fri Mar 20 16:43:08 CET 2015

> Im re-learning rrdtool  so i started with a simple ping graph, now i think 
> i remember i could create 2 areas for 2 ping hosts if i multiplicated the 
> result with *-1 i tested to add this  in the script that updates the .rrd
> (ping -c 3 -w 6 www.google.com | grep rtt | awk -F "/" '{ print $5*-1 }' )
> and it will return "-11.87" although in the graph it comes out as a 
> positive result and graphs upwards when it should graph in a negative area

Test what you feed RRDtool.
You probably have a script which calls "rrdtool name.rrd $data" or similar.
Duplicate that line and prepend "echo " to it, and append " >> rrdlog.txt"

Also rtfm of awk.   ... | grep ... | awk ...  is (almost?) always too much, 
as awk can do what you let grep do.
>From memory:   awk -F "/" '/rtt/{print $5}'

> Im trying to google and read since i have a faint memory of that you could 
> miltiplicate the info it feteches from the .rrd when you create the graph.

CDEF is your friend here:  CDEF:negated=orig,-1,*
and then of course graph negated.


More information about the rrd-users mailing list