[mrtg] Problem with Negative Numbers

Steve Swords steve at unwiredbb.com
Wed Apr 18 18:39:03 CEST 2007


I multiply the target by -1 to graph RSSI on our Trango gear. Keeps the same
number and makes it positive for graphing....
 
Steve Swords
unWired Broadband, Inc.
 <http://www.unwiredbb.com/> http://www.unwiredbb.com
steve at unwiredbb.com
364 W. Fallbrook Ste. 102
Fresno, Ca 93711
(559) 261-4444 ext 502
(559) 261-4445 (Fax) 
 

  _____  

From: mrtg-bounces at lists.oetiker.ch [mailto:mrtg-bounces at lists.oetiker.ch]
On Behalf Of Craig Metzer
Sent: Wednesday, April 18, 2007 8:53 AM
To: mrtg at lists.oetiker.ch
Subject: [mrtg] Problem with Negative Numbers


Im 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).  Ive 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

 


  _____  

Dont quit your  <http://g.msn.com/8HMAENUS/2743??PS=47575> job  Take
Classes Online and Earn your Degree in 1 year. Start Today! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20070418/12006f71/attachment.html 


More information about the mrtg mailing list