It looks like the OID is returning a string value.  MRTG expects a Counter,
so this is not going to work without postprocessing using the ConversionCode
directive and Target suffixes.

 

You need to define a Conversion function, like this.

 

First, create a file conversion.pl in the same directory as the mrtg script
containing this:

 

sub string2int {

  my $value = shift;

  if ( $value =~ /(-?\d+\.?\d*)/ ) { return $1; } else { return undef; }

}

 

In your MRTG cfg file, have this to declare the functions:

 

ConversionCode: conversion.pl

 

Then, in your Target line, use something like this to use string2int to
postprocess the output:

 

Target[ezwf]: rssi.0&rssi.0:community@devicename:::::2|string2int

 

This will extract the '-77' from the string "-77 dBm".

 

However, if you are using native MRTG, you 'll have problems with decimals
and negative numbers as they are not supported.  To get around this, you
could use a simple regexp in the string2int function, such as /(\d+)/ which
will ignore and decimals and negatives.

 

You could use

 

Factor[ezwf]: -1

 

.to display the (positive) stored values as negative, though I'm not certain
if native-mode MRTG supports negative Factor[] definitions either.  Have
another recommendation to use the RRDTool backend J - maybe you can convince
your management.

 

Steve

 

Steve Shipway

 <mailto:[email protected]> [email protected]

(GNU Terry Pratchett)

 

From: Rick Silacci [mailto:[email protected]] 
Sent: Thursday, 7 May 2015 5:09 a.m.
To: Steve Shipway
Subject: RE: Measuring RSSI

 

Actually I walked the correct OID 1.3.6.1.4.1.161.19.3.2.2.8.0 and it came
back with "-77  dBm"  When I poll it through mrtg I get error message:
Warning: Expected a number but got -'77 dBm'

 

 

I need to suppress the 'dbm' part.  Is that possible?

 

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg

Reply via email to