[mrtg-developers] Calculating 95th percentile
Westlake, Simon
simon.westlake at twcable.com
Wed Oct 10 18:06:55 CEST 2007
Hello all,
I'm attempting to write a script to calculate 95th percentile usage
using RRD files generated using MRTG. I'm using PHP and PHP4RRDTool in
order to pull the information and calculate it and I'm running into an
issue which has maybe been hidden from me in the past as I use MRTG as a
collector for my RRD files.
A quick rundown of my method:
I have a loop that goes through and pulls 5 minute intervals of data
from the RRD file (by doing --start -10m --end -5m for example, and
moving backwards in steps of 5) for the last calendar month. It adds
this data to an array, sorts it from smallest to largest, strips the top
5% and calculates the average.
The script itself seems to work fine, but the data I get returned seems
weird.
After reading the RRD documentation, it appears that I should be able to
pull the information I want by using the following command:
$opts = array ( "AVERAGE", "--end", "-$timeframe", "--start",
"-$start");
Where the $opts array is an array of the options to send. This works and
gives me a value, however, the values seem to repeat identically. Here
is a (somewhat brief) example of the data returned over a series of 5
minute queries:
33748465.7228
33748465.7228
33748465.7228
33748465.7228
33748465.7228
33748465.7228
33748465.7228
33748465.7228
33748465.7228
34784619.7841
<34784619.7841 repeats many times>
34784619.7841
34993760.8949
34993760.8949
34993760.8949
34993760.8949
34993760.8949
34993760.8949
34993760.8949
34993760.8949
This seems wrong to me - even as an average, I would not be seeing
identical values over separate 5 minute intervals.
I have tried various changes to see if I receive different information,
and I do not.
Am I missing something blindly obvious here? Shouldn't different 5
minute intervals return different information?
--
Simon Westlake
Time Warner Cable Business Class
Network Engineer
Ph: 414.908.4791 | Cell: 414.688.7956
This E-mail and any of its attachments may contain Time Warner
Cable proprietary information, which is privileged, confidential,
or subject to copyright belonging to Time Warner Cable. This E-mail
is intended solely for the use of the individual or entity to which
it is addressed. If you are not the intended recipient of this
E-mail, you are hereby notified that any dissemination,
distribution, copying, or action taken in relation to the contents
of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify
the sender immediately and permanently delete the original and any
copy of this E-mail and any printout.
More information about the mrtg-developers
mailing list