<br><tt><font size=2>I'm not an expert at all but I think I can help you</font></tt>
<br><tt><font size=2><br>
> - Are these values really bytes? </font></tt>
<br><tt><font size=2>Yes, it is the average number of bytes *per second*
seen during the considered time interval</font></tt>
<br><tt><font size=2>>How do I know what the values are? </font></tt>
<br><tt><font size=2>Because you always know what you measure. Don't you?
;-)<br>
> Is it contained in the RRD database file somewhere so I can have the
script auto-adapt? </font></tt>
<br><tt><font size=2>Yes it is contained in the file "/var/www/html/cacti/rra/326/28889.rrd".
You can use the "rrdtool dump <filename>" command to "see"
them by yourself.</font></tt>
<br><tt><font size=2>> - Am I 100% sure that $value[0] is always "IN"
and $value[1] is always "OUT"? </font></tt>
<br><tt><font size=2>For that particular file yes. But I'm pretty sure
it can be different from file to file depending on how you created them
(I guess $value[0] corresponds to the rrd file's first data source, $value[1]
to the rrd file's second data source, etc...)<br>
> - Does this look sane or is there a better way to do this? </font></tt>
<br><tt><font size=2>The script looks sane but I don't understand why you're
trying to do this. So I can't judge the sanity of your idea and can't tell
if there's a better way to achieve your goals.</font></tt>
<br><tt><font size=2>> - What's up with my time selection? Why does
3600 seconds only produce 4 samples even though the resolution is set to
300 seconds(3600/300=12)? </font></tt>
<br><tt><font size=2>Probably because your rrd database doesn't have data
at the time requested and $rrd->fetch_next() returns the nearest "consolidated
data points".</font></tt>
<br><tt><font size=2>From your sample, though strange, it looks like that
your rrd database keeps 10 minutes of data with a 5 minutes time interval,
then <x> minutes of data with a 45 minutes time interval. Run "rrdtool
info <filename>" on your rrd database to figure this out.</font></tt>
<br>
<br><tt><font size=2>Best regards,</font></tt>
<br>
<br><tt><font size=2>Cyrille<br>
</font></tt>
<br>
<br><tt><font size=2>rrd-users-bounces+cyrille.bollu=fedasil.be@lists.oetiker.ch
wrote on 15/06/2010 01:37:57:<br>
<br>
> Hello RRD-Users,<br>
> <br>
> I also posted this on the Cacti forum since it relates to Cacti data<br>
> directly but the RRD database is rrdtool specific. I'm having some
<br>
> trouble understanding what it is, exactly, I'm pulling from an RRD
<br>
> database file.<br>
> <br>
> Lets say, for example, that I have a graph of network traffic called<br>
> "aa11.acc - Traffic - Fa0/14". The data source template
being used <br>
> is "Interface - Traffic". And the datasource path is <br>
> "<path_rra>/326/28889.rrd". The graph template being
used is <br>
> "Interface - Traffic (bits/sec)" characterized by "(traffic_in):
<br>
> Inbound" and "(traffic_out): Outbound" as well as the
current, <br>
> average and maximum for each of those. <br>
> <br>
> I'd like to pull the values from the RRD file. I've created a script<br>
> to do this using the device name, interface name and a start/end <br>
> pair like this: <br>
</font></tt>
<br><tt><font size=2>> <br>
> Code:</font></tt>
<br><tt><font size=2>> <br>
> <br>
> #!/usr/bin/perl <br>
> use RRDTool::OO; <br>
> <br>
> # code to get the rrd file name from the cacti database omitted.
Instead <br>
> # I'll define it as: <br>
> $rrdfile = "/var/www/html/cacti/rra/326/28889.rrd"; <br>
> <br>
> $rrd = RRDTool::OO->new( file => $rrdfile ); <br>
> @ARGV[2] = time()-3600 if !@ARGV[2]; <br>
> @ARGV[3] = time() if !@ARGV[3]; <br>
> $rrd->fetch_start( <br>
> start => @ARGV[2], <br>
> end => @ARGV[3], <br>
> resolution => "300", <br>
> cfunc => "AVERAGE" <br>
> ); <br>
> $rrd->fetch_skip_undef(); <br>
> print "Start: ",time()-3600,"\nEnd: ",time(),"\n";
<br>
> print "Device: $devname\n"; <br>
> print "RRDFile: $rrdpath\n\n"; <br>
> while(my($time, @value) = $rrd->fetch_next()) { <br>
> print "$time: ",sprintf("%.2f", $value[0]),"
Bytes IN\n" if $value[0]; <br>
> print "$time: ",sprintf("%.2f", $value[1]),"
Bytes OUT\n" if $value[1]; <br>
> $sumin = $sumin + $value[0]; <br>
> $sumout = $sumout + $value[1]; <br>
> } <br>
> print "IN: ",sprintf("%.2f", $sumin),"
Bytes\n"; <br>
> print "OUT: ",sprintf("%.2f", $sumout),"
Bytes\n"; <br>
> print "TOTAL:",sprintf("%.2f", $sumin+$sumout),"
Bytes\n"; </font></tt>
<br><tt><font size=2>> <br>
> <br>
> <br>
> The values I get are the following, leaving off the start-end <br>
> parameters in my script defaults them to the last one hour (3600 <br>
> seconds) of data. <br>
</font></tt>
<br><tt><font size=2>> <br>
> Code:</font></tt>
<br><tt><font size=2>> <br>
> <br>
> [root@traf ~]# ./rrd-read.pl aa11 Fa0/14 <br>
> Start: 1276544454 <br>
> End: 1276548054 <br>
> Device: Fa0/14 <br>
> RRDFile: /var/www/html/cacti/rra/326/28889.rrd <br>
> <br>
> 1276544700: 22144.43 Bytes IN <br>
> 1276544700: 2484.16 Bytes OUT <br>
> 1276547400: 30579.32 Bytes IN <br>
> 1276547400: 3318.26 Bytes OUT <br>
> 1276547700: 22904.95 Bytes IN <br>
> 1276547700: 2469.39 Bytes OUT <br>
> 1276548000: 21962.23 Bytes IN <br>
> 1276548000: 2323.77 Bytes OUT <br>
> IN: 97590.94 Bytes <br>
> OUT: 10595.58 Bytes <br>
> TOTAL:108186.51 Bytes </font></tt>
<br><tt><font size=2>> <br>
> <br>
> <br>
> Questions: <br>
> - Are these values really bytes? How do I know what the values are?
<br>
> Is it contained in the RRD database file somewhere so I can have the<br>
> script auto-adapt? <br>
> - Am I 100% sure that $value[0] is always "IN" and $value[1]
is always "OUT"? <br>
> - Does this look sane or is there a better way to do this? <br>
> - What's up with my time selection? Why does 3600 seconds only <br>
> produce 4 samples even though the resolution is set to 300 <br>
> seconds(3600/300=12)? <br>
> <br>
> Thanks for taking the time to review this post to the list.<br>
> <br>
> Regards, <br>
> <br>
> Landon Stewart <LStewart@SUPERB.NET><br>
> SuperbHosting.Net by Superb Internet Corp.<br>
> Toll Free (US/Canada): 888-354-6128 x 4199<br>
> Direct: 206-438-5879<br>
> Web hosting and more "Ahead of the Rest": http://www.superbhosting.net<br>
> _______________________________________________<br>
> rrd-users mailing list<br>
> rrd-users@lists.oetiker.ch<br>
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users<br>
</font></tt>