[mrtg] Questions re using MRTG for non-SNMP monitoring

Steve Shipway s.shipway at auckland.ac.nz
Mon Sep 3 02:00:19 CEST 2007


> % MRTG usually polls data from a source. Can I "push" data to MRTG
> instead?

Sort of.  You will need to write something to catch the pushed data, and
update the RRD file yourself, IE, bypass MRTG entirely.  So, I guess
this means you're not really pushing to MRTG, just to the RRD.  However,
if you are not using RRD, the answer is no.

> % Can I push delayed data to MRTG? Example: I learn just now that
> monitored variable X was equal to 5 about 15 minutes ago. I don't want
> to say X=5 w/ the current timestamp, but X=5 with a timestamp of 15m
> ago.

Yes, again provided you update the RRD yourself.  You can specify the
timestamp for the data when you log it.  But...

> % Can I push out-of-order delayed data to MRTG? 

No.  The RRD format does not allow this.  The reason is that RRD
calculated rollup-up summaries as it goes, so it can't go back and fill
in the gaps.

> % Does MRTG store "minimum" values? The mrtg-logfile doc suggests it
> doesn't.

Yes it does (if you mean the minimum equivalent of MaxBytes), or to be
more precise, the backend RRD format does.  You can set them in there.
I don't think MRTG itself does, though.  If you mean the data minimum
(the opposite of the Peak lines) then it doesn't by default, but you can
add another RRA to track this to the RRD files manually and it will then
be automatically updated.  However, none of the standard frontends will
display this value, so you'd need to write your own code to do so.

> % I'm using MRTG as a 1-variable 'gauge'. In situations like this, do
> people normally set the second variable (outgoing bytes or whatever)
> to be constantly 0?

Up to you.  Many set it to zero.  I set it to the same as the first
variable, or the max value.  You can set it to anything you like.

> % Since I'm not using the 2nd variable, can I somehow hack MRTG to
> store the minimum value (for the previous interval) there? [eg,
> setting the 2nd value to -1 times the 1st value and then reversing the
> graph for the 2nd variable somehow?]

This probably wouldn't work, since you're confusing the data values with
the RRA (summary) values.  Better to use the built-in RRA MINIMUM
functions.

> % By default, MRTG graphs the 1st var in green, 2nd var in blue, and
> doesn't graph the max values at all unless Colours[myvar] has a 3rd
> and 4th value, correct?

The Max values are graphed for granularities over Daily if available.
You can suppress them with the WithPeak directive.  If you don't give a
colour it should default.

> % My ISP won't let me compile C programs. Is there a pure Perl version
> of MRTG? [if not, I can compile on another machine and copy the ELF,
> but that's ugly]

If your ISP will install the Perl RRDTools library, then MRTG will use
this and not need any binary (the binary is the rateup which is used for
the log files).

> % Since MRTG consolidates data, do the log files stay at ~50K each?

They stay constant size.  How big they are depends on the number of data
sources, and the number and length of the RRAs defined.  

> % Is there a good page of tips/tricks for people using MRTG this way?

There is a lot of info on http://www.mrtg.org/.  You can also find some
ideas on http://www.steveshipway.org/forum/ if you want to.

> % My ultimate goal: create graphs like
> http://limbo.alleged.com/wxfan/stats.html for every METAR station in
> the world, but also add min/max lines (which should be fairly smooth)
> to avoid the jaggedness for 1 year graphs (last graph on
> http://limbo.alleged.com/wxfan/kfbl-temp-dewpoint.html)

This should certainly be possible using RRDTool.  You may need to avoid
using MRTG for data collection (since you're pushing the data at
different intervals) though.  You can still use things like routers2 for
displaying the data.  

For example, we run some VMWare monitoring, using a pull/push system and
some custom scripts that collect the data and insert it into the RRD
files.  Routers2 is displaying the frontend, configured by some dummy
MRTG .cfg files.  MRTG itself does not actually get involved at all.

There are 3 things you need to take care of in the monitoring:
1. Data collection (usually done by MRTG)
2. Data storage (use RRDTool, although it can be done by MRTG)
3. Data display (if using RRDTool use routers2,14all or mrtg-rrd; if not
then MRTG does it)
So, you see, you CAN have MRTG-MRTG-MRTG but it is not generally
recommended, and gives you no flexibility.  MRTG-RRD-routers2 is what we
use although MRTG-RRD-14all would work similarly.  For our VMWare
monitoring, we have customscript-RRD-routers2.

Steve



More information about the mrtg mailing list