Reputation: 111
We have MRTG set up to monitor the network .So for that we are using RRD tool to fetch an plotting the graph data. Now i have created a script which actually fetch data from RRD files , so from fetched data i need max in and and max out in 24 Hours. Now with these max values , i calculate the badwidth utilization for each customer/link.
Now my question is there, single rrd command to fetch max in , max out, min in and min out values from RRD files.
Since i am newbee to this RRD so i would appreciate if command is also provided with your solution.
Please help.
Upvotes: 0
Views: 2260
Reputation: 4072
With an MRTG-created RRD files, the 'in' and 'out' datasources are named 'ds0' and 'ds1' respectively. There exist 8 RRAs; these correspond to granularities of 5min, 30min, 2hr and 1day with both AVG and MAX rollups. By default, these will be of length 400 (older versions of MRTG) or length 800 (newer versions of MRTG) which means that you are likely to have a time window of 2 days, 2 weeks, 2 months and 2 years respectively for these RRAs. (Note that RRDTool 1.5 may omit the 1pdp MAX RRA as this is functionally identical the the 1pdp AVG RRA)
What this means for you is the following:
IF you are only interested in claculating for the most recent 24h period, then all calculations can use the highest-granularity RRA.
Note that, because step boundaries are all calculated using UCT, unless you live in that timezone you can't use FETCH or XPORT to obtain the data you need as you need to summarise over a general time window.
To retrieve the data you can use something like this:
rrdtool graph /dev/null -e 00:00 -s "end-1day" --step 300
DEF:inrmax=target.rrd:ds0:AVERAGE:step=300:reduce=MAXIMUM
DEF:outrmax=target.rrd:ds1:AVERAGE:step=300:reduce=MAXIMUM
DEF:inrmin=target.rrd:ds0:AVERAGE:step=300:reduce=MINIMUM
DEF:outrmin=target.rrd:ds1:AVERAGE:step=300:reduce=MINIMUM
VDEF:inmax=inrmax,MAXIMUM
VDEF:inmin=inrmin,MINIMUM
VDEF:outmax=outrmax,MAXIMUM
VDEF:outmin=outrmin,MINIMUM
LINE:inrmax
PRINT:inmax:"In Max=%lf"
PRINT:inmin:"In Min=%lf"
PRINT:outmax:"Out Max=%lf"
PRINT:outmin:"Out Min=%lf"
A few notes on this:
When you call rrdtool::graph from your php script, simply pass it the parameters in the same way as you would for commandline operation. If you're not using Linux you might need to use something other than /dev/null.
Upvotes: 0