[mrtg] discarding 0 values ???

Steve Shipway s.shipway at auckland.ac.nz
Sun Jan 24 04:55:58 CET 2010


I can think of two ways.

First, the best way requires you to be using MRTG with RRDTool and some frontend (Routers2, mrtg-rrd, 14all, etc).
In this case, you can manually tune the RRD files to have a minimum value of (eg) 1, so zeros are recorded as Unknowns.  See the rrdtool documentation on how to use rrdtune to achieve this, but it would be similar to:

$ rrdtool tune targetname.rrd --minimum ds0:1 --minimum ds1:1

and you would need to do this for all the targetnames in question, but only once.

Secondly, you could use either a data collection plugin or a post-processing plugin to convent retrieved zero values to unknowns.  This would work for Native-mode MRTG as well as for RRD-mode, but would require a small amount of perl coding knowledge in order to write the plugin.
This would require you to first create a file called (eg) conversioncode.pl containing something like this:

sub nozeros {
  my $value = shift;
  return ($value?$value:undef);
}

then define the file to MRTG in the .cfg file:

ConversionCode: /path/conversioncode.pl

and finally use it in your Target definition:

Target[something]: oid&oid:community at host|nozeros

Hope this helps...

Steve

________________________________
From: mrtg-bounces at lists.oetiker.ch [mrtg-bounces at lists.oetiker.ch] On Behalf Of Ufuk Eskici [ufukeskici at gmail.com]

I want to use a function in MRG. I want to discard zero values.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20100124/e8e30047/attachment-0001.htm 


More information about the mrtg mailing list