[rrd-users] Combine average data to one CDEF

This is a discussion on [rrd-users] Combine average data to one CDEF within the RRD Users forums, part of the Networking and Network Related category; Hello, At the moment I am trying to combine several RRD data files into one graph. I'm storing network ...


Go Back   Usenet Forums > Networking and Network Related > RRD Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-21-2008
Hans van Kilsdonk
 
Posts: n/a
Default [rrd-users] Combine average data to one CDEF

Hello,

At the moment I am trying to combine several RRD data files into one
graph. I'm storing network traffic into the RRD files per IP
address and I want to add all the data into one CDEF. I have the
following command:

rrdtool graph test.png -s -1d -e now -t 'test graph' \
-l 0 -r -c GRID#666666 -c MGRID#888888 -w 495 -h 200 -a PNG \
-v 'bits per second' \
'DEF:kbin1:/home/data/1.rrd:ds0:AVERAGE' \
'DEF:kbout1:/home/data/1.rrd:ds1:AVERAGE' \
'DEF:kbin2:/home/data/2.rrd:ds0:AVERAGE' \
'DEF:kbout2:/home/data/2.rrd:ds1:AVERAGE' \
'DEF:kbin3:/home/data/3.rrd:ds0:AVERAGE' \
'DEF:kbout3:/home/data/3.rrd:ds1:AVERAGE' \
'CDEF:totalkbin=0,kbin1,+,kbin2,+,kbin3,+' \
'CDEF:totalkbout=0,kbout1,+,kbout2,+,kbout3,+' \
'AREA:totalkbin#CBCCCF:' \
'LINE1:totalkbout#B43F2E:'

This works like a charm. However, when I want to add another DEF where
the data in the RRD file starts later the whole graph starts at that
time. Any data before the latest start time is not shown in the graph.

Is there a way to avoid this?

Thanks in advance.

--
Hans

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Reply With Quote
  #2 (permalink)  
Old 05-21-2008
Simon Hobson
 
Posts: n/a
Default Re: [rrd-users] Combine average data to one CDEF

Hans van Kilsdonk wrote:

>This works like a charm. However, when I want to add another DEF where
>the data in the RRD file starts later the whole graph starts at that
>time. Any data before the latest start time is not shown in the graph.
>
>Is there a way to avoid this?



That's because the data is unknown - and could apply to any of the
rrd should the collection routine stop for any reason.

x + unknown = unknown

Thus is ANY of your values is unknown, the the total will also be unknown.

The answer is to test each one, something like this :

0,x,x,unkn,if

Check the rrd rpn pages for more details, but x,unkn, evaluates to
true if x is unknown, then 0,x,<expr>,if says if expr is true then
give x, otherwise give 0.

Apply such a formula to each value, then add up the results.

One downside is that if ALL the values are unknown, then you still
get zero, not a gap in the graph.

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Reply With Quote
  #3 (permalink)  
Old 05-21-2008
Erik de Mare
 
Posts: n/a
Default Re: [rrd-users] Combine average data to one CDEF




On Wed, 21 May 2008 09:25:18 +0200, Hans van Kilsdonk <hans@vankilsdonk.nl>
wrote:
> Hello,
>
> rrdtool graph test.png -s -1d -e now -t 'test graph' \
> -l 0 -r -c GRID#666666 -c MGRID#888888 -w 495 -h 200 -a PNG \
> -v 'bits per second' \
> 'DEF:kbin1:/home/data/1.rrd:ds0:AVERAGE' \
> 'DEF:kbout1:/home/data/1.rrd:ds1:AVERAGE' \
> 'DEF:kbin2:/home/data/2.rrd:ds0:AVERAGE' \
> 'DEF:kbout2:/home/data/2.rrd:ds1:AVERAGE' \
> 'DEF:kbin3:/home/data/3.rrd:ds0:AVERAGE' \
> 'DEF:kbout3:/home/data/3.rrd:ds1:AVERAGE' \
> 'CDEF:totalkbin=0,kbin1,+,kbin2,+,kbin3,+' \
> 'CDEF:totalkbout=0,kbout1,+,kbout2,+,kbout3,+' \
> 'AREA:totalkbin#CBCCCF:' \
> 'LINE1:totalkbout#B43F2E:'
>
> This works like a charm. However, when I want to add another DEF where
> the data in the RRD file starts later the whole graph starts at that
> time. Any data before the latest start time is not shown in the graph.
>
> Is there a way to avoid this?


Check for unknown, or use rrdtool 1.3.x there is a function to all NAN's
tot good values.
some thing like this.
kbin1,UN,0,kbin1,IF,kbin2,UN,0,kbin2,IF,kbin3,UN,0 ,kbin3,IF,+,+

>
> Thanks in advance.
>
> --
> Hans
>

Groeten,
Erik

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Reply With Quote
  #4 (permalink)  
Old 05-21-2008
Hans van Kilsdonk
 
Posts: n/a
Default Re: [rrd-users] Combine average data to one CDEF

On Wed, 21 May 2008 08:41:29 +0100
Simon Hobson <linux@thehobsons.co.uk> wrote:

> That's because the data is unknown - and could apply to any of the
> rrd should the collection routine stop for any reason.

<snip>

On Wed, 21 May 2008 09:51:51 +0200
Erik de Mare <erik@oezie.org> wrote:

> Check for unknown, or use rrdtool 1.3.x there is a function to all
> NAN's tot good values.
> some thing like this.
> kbin1,UN,0,kbin1,IF,kbin2,UN,0,kbin2,IF,kbin3,UN,0 ,kbin3,IF,+,+


Thanks Simon & Erik. Your solution works perfectly. The rpn
expression method is totally new for me so it probably took me weeks
before finding this out :-) (although next time I need to read the
manual better:

http://oss.oetiker.ch/rrdtool/tut/cd...nown_into_zero

Two thumbs up for your quick reponse.

--
Hans

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:34 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0