[mrtg] Problem with Negative Numbers
Castle, Shane
scastle at co.boulder.co.us
Wed Apr 18 18:21:07 CEST 2007
No, MRTG does not cope with negative numbers at all. I have used a
workaround, which is to add an appropriate value to the number to make
it positive; e.g., if the numbers returned by SNMP are in the range 0 to
-99 dBm, add 100. This will produce graphs that look like they should
except when no data are returned at all, but the numbers do not
correspond with "reality". The true way to cope with this is to use
RRDTool.
--
Shane Castle
303-441-3953
-----Original Message-----
From: mrtg-bounces at lists.oetiker.ch
[mailto:mrtg-bounces at lists.oetiker.ch] On Behalf Of Craig Metzer
Sent: Wednesday, April 18, 2007 09:53
To: mrtg at lists.oetiker.ch
Subject: [mrtg] Problem with Negative Numbers
I'm trying to poll a satellite modem for Rx Signal Level. The modem
returns a negative integer ten times the level (ex. -575 indicates the
level is -57.5 dBm). I've configured a conversion function so I can log
the value returned by snmpget and compare it to the value in the log
file. It appears that MRTG is not recognizing the number as negative.
It appears it is not recognizing the binary 1 MSD as a negative sign.
===========
Config file:
ConversionCode: functs.pl
Target[my-pub-sat-01-rsl]:
.1.3.6.1.4.1.6247.28.1.3.3.4.0&.1.3.6.1.4.1.6247.28.1.3.3.4.0:myROcs at my-
pub-sat-01.domain.gov|neg_int
==========
Functs.pl:
sub neg_int {
my $n = shift;
open FH, ">> rx_lvl.log";
# my $o = (2^31 - $n) / 10;
my $o = $n / 10;
print FH localtime(time) . " -> IN: $n\tOUT: $o\n";
close FH;
return $o;
}
===========
Logs:
$head my-pub-sat-01-rsl.log
1176910486 2147483590 2147483590
1176910486 0 0 0 0
1176910186 0 0 0 0
1176909900 0 0 0 0
1176909600 0 0 0 0
1176909300 0 0 0 0
1176909000 0 0 0 0
$ cat rx_lvl.log
Wed Apr 18 16:29:46 2007 -> IN: -578 OUT: -57.8
Wed Apr 18 16:29:46 2007 -> IN: -578 OUT: -57.8
Wed Apr 18 16:34:46 2007 -> IN: -578 OUT: -57.8
Wed Apr 18 16:34:46 2007 -> IN: -578 OUT: -57.8
________________________________
Don't quit your job - Take Classes Online and Earn your Degree in 1
year. Start Today!
<http://portal.mxlogic.com/redir/?FTK-qekS6kXCQXTvd7ar3dSjo0czOJ8sLzMn6N
0q1wj6cj7ccAygm63C1PUVYTvHTh73zhOO-qem3tPqIpAiV2Hsbvg57OFeDl-syLNWNcSyyy
YYrhh7e6zB55YQsTdIK6PiSH6p4QKCy0bhGgfZkQg69j9Cy06uhSszfCy06dGAfzgTfM-u0U
SyrhdFTpopvjuvhdOvBRHiPp>
More information about the mrtg
mailing list