[rrd-users] Rrdtool/Liveice/Perl

Harald Nesland harald at interweb.no
Wed Feb 5 08:50:23 MET 2003


I've finally put together my own rrd. I've made a perl script that reads
output from
liveice and appends it to a rrd. Liveice' output is volume data, a integer
that increases
when the sound get louder, and decreases otherwise. I connected a
radioscanner to line-in of
my computer, and ran the script a couple of days on the local police
channel. I now have some
statistics of when there's activity on the channel. I haven't seen this kind
of monitoring by
rrdtool before, so I thought it would interest you :)

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;

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

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.

I got something working, though (It really writes anything at all on the
graph! :) I haven't studied
rrdtool in detail.. ;P
rrdtool create liveice.rrd             \
        --start `date +%s`          \
        --step 3 \
        DS:a:GAUGE:100:0:32768 \
        DS:b:GAUGE:100:0:32768 \
        RRA:AVERAGE:0.5:1:600 \
        RRA:AVERAGE:0.5:6:700 \
        RRA:AVERAGE:0.5:24:775 \
        RRA:AVERAGE:0.5:288:797 \
        RRA:MAX:0.5:1:600 \
        RRA:MAX:0.5:6:700 \
        RRA:MAX:0.5:24:775 \
        RRA:MAX:0.5:288:797 \
And the graph is created with:
rrdtool graph liveice.png \
         --start -600  \
         --title "LiveIce activity" \
         --width=600 \
         --height=250 \
         DEF:a=liveice.rrd:a:AVERAGE \
         LINE2:a#0000ff \
         DEF:b=liveice.rrd:b:AVERAGE \

I was wondering if anybody had any comments about this, perhaps other ways
to create the graph/rrd?


Harald Nesland
harald at iw.no

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