[rrd-users] Re: Rrdtool/Liveice/Perl

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Feb 5 13:17:59 MET 2003


On Wed, Feb 05, 2003 at 08:50:23AM +0100, Harald Nesland wrote:

> while(<>) {
>   if(/VOLUME (\d*) (\d*)/) {
>     $vol1 = $1;
>     $vol2 = $2;
>     $time = time;
>     if($time>$oldtime) {
>       print "$time:$vol1:$vol2\n";
>       if($vol1>$vol2) { $vol3 = $vol1 - $vol2;} else { $vol3 = $vol2 -
> $vol1; }
>       system("rrdtool update liveice.rrd $time:$vol1:$vol2 ");
>     }
>     $oldtime = $time;
>   }
> }

Without an explanation, $vol1 and $vol2 don't mean anything to me.
$vol3 is calculated but never used.

> This is the perl script that reads data from liveice. The data is piped to
> the script with
> `liveice -@ 1 | perl script.pl`.

You could consider piping the data into one rrdtool instance:

   liveice -@ 1 | per script.pl | rrdtool -

Your script should then echo the rrdtool command to stdout, like this:

   update liveice.rrd $time:$vol1:$vol2


> The maximum value liveice outputs is "32768". And the lowest I've
> come to is about "1000". The range is very big, and I'm not sure
> how the rrd should be created, nor how the graph should be created.

You could try a logaritmic scale.  Or, alternatively, you could define
some levels inside your perl script.

I'm no radio expert but isn't there something like a reception scale
where 1 means bad (or: unreadable) and 5 means good?

> rrdtool create liveice.rrd             \
>         --start `date +%s`          \

Unless you want to process historic data, you don't need "--start"
in your create command.

>         --step 3 \

data should come in about every three seconds ...
(each "bucket" is three seconds)

>         DS:a:GAUGE:100:0:32768 \
>         DS:b:GAUGE:100:0:32768 \

expect data at least every 100 seconds

>         RRA:AVERAGE:0.5:1:600 \

remember 600 values times 3 seconds per value --> 1800 seconds == 0.5 hour

>         RRA:AVERAGE:0.5:6:700 \

remember 700 values times 18 seconds per value --> 12600 seconds == 3.5 hour

>         RRA:AVERAGE:0.5:24:775 \
>         RRA:AVERAGE:0.5:288:797 \

and so on


> rrdtool graph liveice.png \
>          --start -600  \
>          --title "LiveIce activity" \
>          --width=600 \
>          --height=250 \

display "now" to "now-600" with a width of 600 pixels -->  600 seconds
at one pixel per second --> 3 pixels per "bucket".

>          DEF:a=liveice.rrd:a:AVERAGE \
>          LINE2:a#0000ff \
>          DEF:b=liveice.rrd:b:AVERAGE \
>          LINE2:b#ff0000

show "$vol1" in blue and "$vol2" in red.

Suggestion:  name the DEFs vol1 and vol2.  There's no need to do so
             for RRDtool but it makes it more easy to correlate
             script.pl and the rrdtool script.

Suggestion:  when you have a nice graph, submit it to the image gallery
             together with a small HOWTO.

Alex
-- 
Much of what looks like rudeness in hacker circles is not intended to give
offence. Rather, it's the product of the direct, cut-through-the-bullshit
communications style that is natural to people who are more concerned about
solving problems than making others feel warm and fuzzy.

http://www.tuxedo.org/~esr/faqs/smart-questions.html

--
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