[mrtg] Problem with ConversionCode

Bernhard Aichinger Bernhard.Aichinger at lrz-muenchen.de
Tue Jul 3 21:26:56 CEST 2007


Hi,


I run into a problem with the conversion functionality.  Searching the 
archive did not came up with much results ...  The intended functionality 
should convert an octed string (64 bit) into an integer.  The provided 
infrastructure in mrtg (2.15.2) calls the conversion function within an 
eval as follows (line 2261):

   my $exp = "&MRTGConversion::$target->{ Conversion }( '$res[ $ri ]' )";
   $res[ $ri ] = eval $exp;

Unfortunately, the content of $res[$ri] (wich is converted using pack) 
itself contains ticks "'".  This leads to an uncorrect expression which 
triggers an error in the eval statement.

My current workaround is to construct an expression with an unpacked 
$res[$ri] value.

Is there a special reason why mrtg calls the conversion hook with the 
packed result?  Or is there something else I did not catch?  The 
documentation does not mention to use unpack to get the date, I therefore 
suspect special cases where $res[$ri] is converted using pack.  Is my 
assumption correct?


Many thanks in advance,
Bernd



More information about the mrtg mailing list