[mrtg] conversioncode broken? / fixed?

Kevin P. Foote kpfoote at iup.edu
Wed Apr 14 14:19:53 CEST 2010


Excellent .. thanks a bunch guys. 

And I leaned something new about mrtg :-) 

------
thanks
  kevin.foote

On Wed, 14 Apr 2010, Steve Shipway wrote:

-> > My super simple conversion script is not working as It did in an older
-> > setup. The script itself is super simple..
-> > 
-> >   # my convert routine
-> >   sub Kb2B {
-> >          my $value = shift;
-> >          return ($value * 1024);
-> >   }
-> > 
-> ...
-> > Here is the error I get in mrtg.log
-> >      -- Can't modify non-lvalue subroutine call at (eval 14) line 1.
-> 
-> This is almost certainly because the $value is non-numeric (an unknown).  Your script does not handle that case and ($value*1024) would have this problem.
-> 
-> However, there is a much more efficient way to achieve a simple multiplication by 1024!
-> 
-> Instead of
-> Target[xxxx]: oid&oid:comm at host|Kb2B
-> why not simply use
-> Target[xxxx]: oid&oid:comm at host * 1024
-> (note the spaces around the *)
-> This will multiply both retrieved values by 1024, taking proper account of unknowns.
-> 
-> Steve
-> 



More information about the mrtg mailing list