All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [LARTC] tc & rrd question
@ 2004-07-30 13:53 Roy
  0 siblings, 0 replies; only message in thread
From: Roy @ 2004-07-30 13:53 UTC (permalink / raw)
  To: lartc


Basicaly it is easy to use rrd tool, the hardest part for me was to setup
rrd database correctly
here is example

RRDs::create("$rrd","-s",$period,
"DS:TR:GAUGE:300:0:U",
"RRA:AVERAGE:0.5:1:1440",                  #  0.5- uaualy leave as is : 1-
for first entry use 1  :1440 number of points
"RRA:AVERAGE:0.5:15:3072");                #: 0.5: 15 needs 15 updates to
create one average database entry  :3072


Complete example for perl, probably will be good for you too. have
resolution of 1 min for 1 day and 15 min resolution for 1 month. uopdates
should be done each minute
$time=time;
$rrd="./data/$ip.rrd";  #$rrd is filename
    if (!(-e "$rrd")) { print "creating $rrd\n";
       RRDs::create("$rrd","-s",$period,
        "DS:TR:GAUGE:300:0:U",
        "RRA:AVERAGE:0.5:1:1440",
        "RRA:AVERAGE:0.5:15:3072");
      if (my $error=RRDs::error()) {print "Cannot create $rrd: $error\n";}
    }

    RRDs::update("$rrd","$time:$tr");   # $tr is the data you want to add to
database

 if (my $error=RRDs::error()) {print "Cannot update $rrd: $error\n";}

}
##################
example for view script. shows load graph and total traffic per $period
$period is in seconds

$period600*24; #(for one day)

$start=time-$period; #starts from current time.
  $rrd="./data/$ip.rrd";
    RRDs::graph ("$cache/$name.png","--start=$start","--widthr0",
  "DEF:d=$rrd:TR:AVERAGE",
  "CDEF:down=d,UN,0,d,IF,$period,*",
  "LINE1:d#6600cc",
  "GPRINT:down:AVERAGE:%1.1lf%sB Download",
  );

    if (my $error=RRDs::error()) {print "Cannot graph $rrd: $error\n";}

    print "<img src=\"$cache/$name.png\"> \n";
    print "$name $ip<br>\n";
  }








----- Original Message ----- 
From: <adi@tettas.net>
To: <lartc@mailman.ds9a.nl>
Sent: Friday, July 30, 2004 12:21 PM
Subject: [LARTC] tc &amp; rrd question


> hello list,
> i've got a small question related to tc and rrd.
>
> my problem is as follows. i've written a small c app that takes the stats
> of tc using libs from iproute2 package and outputs a shell script that
> updates rrd files (2 ds: 1 gauge for speed, 1 counter for sent). i've
> followed the manuals from tobi's website on how to create and update the
> database. the dump is quite curious even after a hole day of updating
> (every 5 min).
>
> can anyone here share his/hers experience with these tools. any links or
> resources maybe even some example code are very welcome.
>
> thanks
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-30 13:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-30 13:53 [LARTC] tc &amp; rrd question Roy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.