[mrtg] conversioncode broken? / fixed?
Steve Shipway
s.shipway at auckland.ac.nz
Wed Apr 14 01:15:40 CEST 2010
> 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