[rrd-users] Re: VRULE midnight and HRULE maximum of timespan

Warnes, Jason SktnHR jason.warnes at saskatoonhealthregion.ca
Tue Jul 22 06:18:26 MEST 2003


Well for my HRULE I kind of cheated.  I haven't had time to explore to see
if there is a better way to do it because I was in a rush to get it done
(isn't everything always a rush?).  Anyway, what I did was before generating
the graph in my Perl script I did an RRDs::fetch for the time period I was
graphing.  Then I just looked for the highest value, stored it and the time
it happened in a variable and graphed it.  I then took the epoch time and
converted it to a more "readable" format.  Here is a bit of a code snippet
to show you what I mean:
---- Start Snippet ----
use RRDs;
# Get a week's worth of points from the MAX RRA of termserver.rrd
my
($start,$step,$names,$data)=RRDs::fetch("termserver.rrd","MAX","--start","-6
04800");
# Zero out all the variables
$maxweekconnections=0;
$maxweekdate=0;
# Find the max connections and time
foreach my $line (@data) {
	foreach my $val (@$line) {	# Check each value
		# Check to see if this connection count is higher than
		# the last highest that was found
		if($maxweekconnections<=$val){
			# Store the MAX value for the week
			$maxweekconnections=$val;
			# Store the date when the MAX value happened
			$maxweekdate=$start;
		}
	}
	# Add the step time to the start to keep track 
	# of what date we're looking at
	$start+=$step;
}
# Convert the epoch time to something more readable
$readablemaxweekdate=localtime($maxweekdate);
print("Max connections for the week happened on $readablemaxweekdate with
$maxweekconnections.\n);
---- End Snippet ----
The all I do is put an HRULE on the graph for the $maxweekconnections
variable, and a little bit of text at the bottom for when it happened
($readablemaxweekdate).  I know it cheating and possibly adds a bit of CPU
and disk thrashing that doesn't need to be there (since I RRDs::FETCH and
RRDs::GRAPH the same data range), so I'm open to alternate suggestions.

I hope it helps you out a bit.  If you need more information feel free to
email me and I could send you the whole source code for my Perl script.

Jason...


-----Original Message-----
From: Andrew Culver [mailto:aculver at uwo.ca] 
Sent: Monday, July 21, 2003 9:31 AM
To: rrd-users
Subject: [rrd-users] VRULE midnight and HRULE maximum of timespan


Hello,

I am graphing various statistics from our email servers' logs, and I would
like to display both a VRULE with the time set to midnight similar to:
http://www.rrdtool.com/gallery/neal-01.html

..and an HRULE with the maximum value from a certain timespan such as the
maximum for the current day or past week, similar to:
http://www.rrdtool.com/gallery/jason-01.html

For the VRULE I've tried:
VRULE:midnight#000000
VRULE:0h today#000000
VRULE:0:00 today#000000
and a few other thing.

For the HRULE I have no idea what to do.

I've searched the archives of this list and saw other people ask how to do
the same things that I'm trying to do, but I saw no answers.

If anyone could help, it would be much appreciated.

Thanks,
Andrew

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list