The 1 Minute MRTG Patches
v1, 07/2001
SYNOPSIS
The 1 minute MRTG patches allow MRTG to work with 1 minute updates, instead
of the hardcoded 5 minutes. Not only the updating system (cron in
my case) has to run every minute, but a few things have to be modified here
and there so; so that the generated graphs and webpage follow the 1 minute
rythme.
It's allready heavy enough to generate images every 5 minutes. For 1
minute updates, RRDtool is a must. These patchs apply to MRTG using RRDtool
to store values. It hasn't been tested, and will probabily not work with
rateup. It's fairly easy to run MRTG with RRDtool, check out the: MRTG and
RRD tool document for a quick how-to, it's located on the MRTG website.
WHY ?
While setting up MRTG to monitor the usage on a high bandwidth research
network, it quickly came out that MRTG's default 5 minute update was just
to low for us; for a few reasons:
- 5 minutes averages hide usage spikes like: 800MBits usage for 2
minutes; It's very different to say: we used 800Mbits for 2 minutes, than:
we used 320Mbits over the last 5 minutes. Either way, with the actual MRTG
interval, it's represented in the same manner. Our traffic is mainly made
of spikes, nothing constant, especially over 5 minutes...
- We needed faster updating. I've heard myself say durring demos:
"just give me 5 minutes" :-( It's allways better to throw out: I'll get back
to you in 60 seconds; our demos usually have a tight time frame:
- T: Start traffic generator A;
- T+60sec: Start traffic generator B;
- T+120: Stop A. (and so on).
HOW IT'S DONE
Mainly two files from the MRTG distribution have been modified to enable
5 minute updates: the mrtg Perl script itself and the MRTG Perl module
(MRTG_lib.pm).
Modification summary:
- Refresh interval set to 1 instead of 5;
- RRD databases are created with new storage directives: 1 min
average are kept for 24 hours; 10 minute averages are kept for 7 days;
1 jour averages are kept for 32 days; and finaly daily averages are kept
2 years.
The 14all Perl CGI was also modified mainly for cosmetic reasons, to
reflected the new retention values and also to show a one hour view (you
can't see very well 1 minute stair cases on a daily view).
The following patches were made with the following versions of MRTG and
14all:
- MRTG (2.9.17);
- MRTG_lib (2.9.17);
- 14all-1.1.cgi (rcsid: 2.15).
HOW TO APPLY THE PATCHES
These are just simple diffs. To patch the mrtg Perl script for example:
cd /opt/adm/mrtg/bin ; patch -p0 < patch-mrtg_2.9.17_1minute_interval.patch
Patch the 3 files: mrtg, MRTG_lib, 14all-1.1.cgi in the same maner on
your local MRTG installation.
RRD databases MUST be re-created! If you used rateup, prior to patching,
the text datafile will be nicelly injected in the new RRDs. If you were
allready running the RRD tools prior to patching, delete your *.rrd files
before re-running MRTG.
Finaly, set the interval to 1 in your mrtg.cfg file.
All is well and should run as before, in 1 minute intervals this time.
FOR Windows users:
Don't forget to adapt the patched 14all.cgi script with your parameters of
your old script. (Like library location, configuration script location...).
[ tip from Mario, thanks Mario ;-) ]
TO DOWNLOAD
Get the file 1minMRTG-1.0.tar.gz,
they contain all you need. I've also included the pre-patched files, for
those great OS's lacking patch. A ZIP version is also available:
1minMRTG-1.0.zip
Seperately, you can directly get the files.
You need those three files too start playing. These are seperate diffs
for each of the files:
You can get the great MRTG from (the even greater) Tobi Oetiker's site:
http://people.ee.ethz.ch/~oetiker/webtools/mrtg
You can get 14all from here:
http://www.uni-ulm.de/~rbawidam/mrtg-rrd
SUPPORT
I will try to offer as much support as I can on these patches. I am aware
that their implemetation is not much documented and fast. I can at least
do my best to help by e-mail. Please let me know if this document lacks
tips or todo's. As of today, consider those patches supported.
You should note that I've dropped MRTG on some of my production environment
very recently (1/2002) to switch to Cricket (
http://cricket.sourceforge.net), who is easier to switch to 1 minute
updates and configuration for weird setups like mine. I'm still using the
patched MRTG in my backoffice, MRTG rules !
CREDITS
July 2001 Nicolas Sayer <Nick@loplop.net
>, under contract with INRIA / DirDRI / VTHD
Thanks again, Tobi, for this great one. I have to admit that I'm more
of an RRD fan than an MRTG one...