[mrtg] 4 hour graph (was: question about http://teak.wiscnet.net/nrg/NoSuchSD.html)

lists at ripper.informatik.uni-ulm.de lists at ripper.informatik.uni-ulm.de
Fri Oct 29 15:04:00 MEST 1999


>> regarding http://teak.wiscnet.net/nrg/NoSuchSD.html, I like the four
>> hour graph on top.  Has anyone hacked mrtg to do this?

> Another possibility: mrtg can be used together with rrdtool (instead of
> rateup, cf. rrdtool/contrib/14all but look for actual version of
> 14all.cgi). To generate the 4 hour graph you just need to add some lines
> to 14all.cgi. If your interested I can tell you how to change the cgi
> (perl, just copy a few lines).

There seems to be some interest so I made a patch (appended). I won't put
this into the main 14all as I don't know a good way to make it configurable
while preserving mrtg compatibility (*). The main part of the patch is the
extension of the %start and %expire hashes (to create the graphs) and the
addition of a link for it ("print $q->h2..."). The 4 hour display really
contains 4 hours and 10 minutes as 250 minutes (50 values) fit better into
the default graph size (400 pixel width).

Rainer

(*) I cannot add options/settings to mrtg.cfg without changing mrtg. This
    (changing mrtg) is something I try to avoid when possible. 14all could
    be made much more flexible and customizable if mrtg as the data gatherer
    wouldn't restrict the config file format/options. It would be easy to
    change mrtg to be just a data gatherer which just looks for the
    Directory and Target settings and ignores anything else but I don't want
    to create and maintain a mrtg branch (further improvment of mrtg
    wouldn't go into it).
    If there is enough interest I could try to get 14all.cgi + data gatherer
    into the contrib section of rrdtool but that depends on Tobi's opinion
    on this.
    (and if somebody wants to take maintainership for 14all, go ahead! ;-)

Rainer.Bawidamann at informatik.uni-ulm.de


-------------------------
--- 14all.cgi	1999/10/26 14:57:53	0.9
+++ 14all.cgi	1999/10/29 12:35:31	0.9.1.1
@@ -11,6 +11,9 @@
 # RCS History
 #
 # $Log: 14all.cgi,v $
+# Revision 0.9.1.1  1999/10/29 12:35:31  rb1
+# * added 4hour graph
+#
 # Revision 0.9  1999/10/26 14:57:53  rb1
 # * changed options parsing
 # * the graphics show now the same time interval as mrtg
@@ -61,7 +64,7 @@
 #	* added: "AddHead[...]: ..."
 #	* added support for multiple config files (get cfgfile name from script name)
 
-my $rcsid = '$Id: 14all.cgi,v 0.9 1999/10/26 14:57:53 rb1 RelC2 $';
+my $rcsid = '$Id: 14all.cgi,v 0.9.1.1 1999/10/29 12:35:31 rb1 Exp $';
 my $version = join(' ', (split(/ /,$rcsid))[1,2]);
 $version =~ s',v''; #'
 
@@ -202,10 +205,10 @@
 		$pngfile = "/tmp/$CGI::log-$CGI::png$suffix";
 	}
 	# reload the graphics after this time:
-	my %expire = qw/daily +300s weekly +1800s monthly +2h yearly +1d/;
+	my %expire = qw/daily +300s weekly +1800s monthly +2h yearly +1d 4hour +300s/;
 	# the start times of the diagram; the end time is 'now'
 	# (-2000m is 'show the last 2000 minutes' [default size 400 columns, 5 min/value])
-	my %start = qw/daily -2000m weekly -12000m monthly -800h yearly -400d/;
+	my %start = qw/daily -2000m weekly -12000m monthly -800h yearly -400d 4hour -250m/;
 	
 	require 'RRDs.pm'; # load RRDs.pm only when needed
 	# build the rrd command line: set the starttime and the graphics format (PNG)
@@ -355,6 +358,9 @@
 	$url .= "&cfg=$CGI::cfg" if defined $CGI::cfg;
 	$url .= "&png";
 	# the header lines and tags for the graphics
+	print $q->h2("'4-hour' graph (5 Minute Average)"),"\n",
+		$q->img({src => "$url=4hour", alt => "4hour-graph"}),
+		"\n";
 	if ($sup !~ /d/) {
 		print $q->h2("'Daily' graph (5 Minute Average)"),"\n",
 			$q->img({src => "$url=daily", alt => "daily-graph"}),
-------------------------

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list