[rrd-users] Create Graph with 2 "AREA"

Simon Hobson linux at thehobsons.co.uk
Sat Aug 18 00:31:16 CEST 2012


Martin Friberg wrote:

>yes itried that but for some reason it still goes up on the axis
>
>
>
>code to generate the db
>
>$RRDTOOL create $FILE -s 60 \
>DS:ping:GAUGE:120:0:65535 \
>RRA:AVERAGE:0.5:1:2880
>
>
>code to update db
>
>UPDATECMD=$(ping -c 3 -w 6 $HOST | grep rtt | awk -F "/" '{ print $5 }' )
>$RRDTOOL update $FILE N:$UPDATECMD
>
>UPDATECMD2=$(ping -c 3 -w 6 $HOST2 | grep rtt | awk -F "/" '{ print 
>$5 * -1 }' )
>
>$RRDTOOL update $FILE N:$UPDATECMiD2

And what have you in the file after this ? I suspect not what you want.

First, I wouldn't munge the data before storing it. Your ping times 
aren't negative, so don't store them as such. Do the negation when 
you plot the data - which also means you have the right data should 
you decide later (after perhaps collecting a year of history) that 
you need something different.

Secondly, I can't see what you are trying to achieve here. I can only 
see you updating one file.


>code to generate graph
>
>$RRDTOOL graph $OUTPUT \
>         -t "WAN Ping" -v "Time in ms" \
>         --start="now-1d" \
>         --end="now" \
>         --height="320" \
>         --width="640" \
>         -c "BACK#000000" \
>         -c "SHADEA#000000" \
>         -c "SHADEB#000000" \
>         -c "FONT#DDDDDD" \
>         -c "CANVAS#202020" \
>         -c "GRID#666666" \
>         -c "MGRID#AAAAAA" \
>         -c "FRAME#202020" \
>         -c "ARROW#FFFFFF" \
>         "DEF:ping_time=$FILE:ping:AVERAGE" \

Where's the data for the second host ?
If you bung in something like this, it will convert your positive 
data to negative :

     CDEF:ping_inv=ping_time,-1,*

and then use ping_inv where you've referenced ping_time in later statements.

>         "CDEF:shading2=ping_time,0.98,*" "AREA:shading2#F90000:$HOST" \
>         "CDEF:shading3=ping_time,0.98,*" "AREA:shading3#fff000:$HOST2" \

Is there a reason for knocking 2% off your values ?

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list