<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="+1"><tt>Hi CLUEbies,<br>
<br>
Well as you know I send an e-mail to this list whenever I'm kind of
stumped.&nbsp; I have an OpenWRT based Linux system with a 3G phone
interface.&nbsp; Due to the marketecture of 3G data plans, I need to try to
make sure this device does not exceed its monthly bandwidth allotment
per our data plan, so we don't get a $60,000 bill, or something.&nbsp; What
I was thinking was, since we are allowed 5GB in a month, that I would
figure out the total bandwidth used in the last 3 weeks, and if the
total bandwidth was 3/4 * 5GB then I would start throttling down the
available bandwidth on the interface using tc and traffic shaping.<br>
<br>
This seems like it should not be too hard to do.<br>
<br>
We have rrdtool and a "rra" datafile for the interface.&nbsp; The byte
counters are written from the interface into the RRA at more or less
regular intervals, and rrdtool stores them as a time series rate.&nbsp; For
those of you new to rrdtool, the COUNTER datatype in a rra means that
absolute values are converted to a rate upon insertion into the
database.<br>
<br>
It SEEMS like it should be really easy to get rrdtool to calculate and
show me the average value of the bandwidth usage for the last 3 weeks.&nbsp;
After all, AVERAGE is one of the command line options to rrdtool fetch,
and you can specify a time range for the fetch/query.<br>
<br>
Unfortunately, there seems to be no way to get rrdtool to actually do
the math on this for me.&nbsp; It returns a lot of rows of data with
constant-interval timestamps, and each data value is the average and
maximum value for (or around - it interpolates) each time stamp.&nbsp;
That's not what I want.&nbsp; What I want is ONE result, at the current
time, with the AVERAGE bandwidth usage for the amount of time I
specified on the command line.&nbsp; NaNs should be treated as zero (in the
event of missing data because it was powered off or something), since
presumably no data is being transferred over the 3G cell network while
it's off.&nbsp; However rrdtool refuses to do math on NaNs, and it also
doesn't seem like it wants to give me time intervals greater than 44.5
minutes.&nbsp; I'd like a 3 week time interval, and I want it to interpolate
and use zero for NaNs, and give me the AVERAGE BANDWIDTH USAGE FOR THE
LAST 3 WEEKS IN ONE NUMBER.<br>
<br>
Does anyone have any ideas?&nbsp; Believe it or not an entire morning of
google searching was unhelpful.&nbsp; There are other people who want to do
something like this and it seems they wind up using another Big Fancy
Tool, or taking the time to write a C program.&nbsp; Maybe rrdtool is the
wrong tool for this job, even though on the surface it seems like the
perfect tool for this job.<br>
<br>
Thanks for any CLUEs,<br>
Jim<br>
</tt></font>
<pre class="moz-signature" cols="72">-- 
Jim Ockers, P.Eng. (<a class="moz-txt-link-abbreviated" href="mailto:ockers@ockers.net">ockers@ockers.net</a>)
Contact info: <a class="moz-txt-link-freetext" href="http://www.ockers.net/msi.html">http://www.ockers.net/msi.html</a>

</pre>
</body>
</html>