[rrd-users] Re: Graph Different

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Thu Mar 7 22:28:51 MET 2002

Guilherme Barile wrote:
> Hello
>  I just finished reading rrdtool's tutorial and now I can write a MRTG
> clone using it :)  Great, but if I wanted to have the same graphs as
> mrtg, i'd use mrtg, not rrdtool.

Not really... You could consider using rrdtool just because it uses
less resources.

>  What I want is graphs like mrtg but when the link is down or the
> packet loss goes up to 100% i'd like the backgroun to turn red...
>  Maybe when packets are lost, but less then 1005 (50% ?) i could have
> a yellow bg... There's an example of this on rrdtool homepage but not
> source code :( Also, they are not graphing bandwidth usage and packet
> loss on the same graph ...

If you really want the background to go red, you need to query
the database (use rrdtool graph with just a PRINT statement),
analyse the output and use the result to set a variabele.  This
variable can then be used in the graph script; in stead of a fixed
color.  Quick start, using a pseudo script language:

   get output of
   rrdtool graph /dev/null DEF:packetloss=.... PRINT:packetloss:MAX:%6.2lf
   into variable packetloss

   if packetloss > 50 then background="#FF0000" else background="#FFFFFF"
   rrdtool graph info.png -A PNG --color BACK:$background ...

If you want to change the color behind your line or area, you should
first draw a background using AREA and then overlay this with the
real line/area.  The background can be created by a CDEF that evaluates
to either NaN or INF.  If the computed value is INF, an AREA will fill
the space between the X-axis and the top of the graph.  If the value
is NaN, nothing will be shown.  Quick start:

   AREA:toomuchFF0000:"Too much packetloss"

Of course you should start simple (just one threshold) and when
this works you try to enhance your script.  My example code will
alert you when packetloss is 50% or more, assuming you're monitoring
a percentage.

 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
| Technical questions sent directly to me will be nuked. Use the list. | 
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-users mailing list