[rrd-users] How to get LAST, AVG, MAX data (that are in graph legend) in text/string format?
deele
nils_k at inbox.lv
Thu Jan 20 15:41:36 CET 2011
I just got some hint from one guy.
I can use FETCH, to get what I need, but still, it gives me loads of data, I
dont know if this is correct:
$d = getdate(); $m = $d['mon']-1; $y = $d['year']; if ($m < 1) { $m = 12;
$y--; }
$p = mktime(7, 0, 0, $m, 1, $y); $t = mktime(7, 0, 0, $d['mon'], 1,
$d['year']);
$file[0] = '/usr/local/share/cacti/rra/simonas_1_snmp_oid_22.rrd';
$file[1] = '/usr/local/share/cacti/rra/simonas_1_snmp_oid_23.rrd';
$query = 'fetch '.$file[0].' MAX -s '.$p.' -e '.$t.' -r 7200';
$output[0] = rrdtool_execute($query, false, RRDTOOL_OUTPUT_STDOUT,
$rrdtool_pipe);
$query = 'fetch '.$file[1].' MAX -s '.$p.' -e '.$t.' -r 7200';
$output[1] = rrdtool_execute($query, false, RRDTOOL_OUTPUT_STDOUT,
$rrdtool_pipe);
so, ending query looks like this:
rrdtool fetch /usr/local/share/cacti/rra/simonas_1_snmp_oid_22.rrd MAX -s
1291179600 -e 1293858000 -r 7200
rrdtool fetch /usr/local/share/cacti/rra/simonas_1_snmp_oid_23.rrd MAX -s
1291179600 -e 1293858000 -r 7200
The date calculation is so, that it takes previous month 1st date, and
previous month last date (1-30).
7200 (as I understood) is seconds in 2 hours, that goes in for resolution.
As I need like in "Monthly (2 Hour Average)".
But still, I don't understand. If this is what I need, cause it drops out
tons of space seperated data. Do I need to do recursive search for maximum
with a script?
--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/How-to-get-LAST-AVG-MAX-data-that-are-in-graph-legend-in-text-string-format-tp5943307p5944034.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
More information about the rrd-users
mailing list