[mrtg] Conversion code error

Yang Xiao yxiao2004 at gmail.com
Wed Jun 24 03:03:51 CEST 2009


Hi All,
I have asked for help with this one before, but nothing seems to have worked
I get this weird conversion code failed error and I can't figure out what is
wrong

env LANG=C /usr/bin/mrtg /etc/mrtg/Filer-Temperatures.cfg
ERROR: File /etc/mrtg/TempConv.pl conversion code evaluation failed
syntax error at (eval 17) line 1, at EOF


.... this is what I have ..

mrtg-2.14.5-2
rrdtool-1.3.7-1.el5.rf
perl-rrdtool-1.3.7-1.el5.rf

Conversion code:

#!/usr/bin/perl
# Conversion Code
sub String2Temp {
        my $str = shift;
        $str =~ /\((\d+)F\)(.*)ambient.*/i;
        my $temp = $1;
        return $temp;
}

mrtg.conf

### Global Defaults
LoadMIBs: /usr/share/snmp/mibs/NETWORK-APPLIANCE-MIB.txt
LogFormat: rrdtool
WorkDir: /var/www/mrtg
ConversionCode: /etc/mrtg/TempConv.pl
Options[_]: bits,growright
Refresh: 300
Interval: 5

#  Vitrual 1
Target[filer1a-shelf1]:
.1.3.6.1.4.1.789.1.21.1.2.1.25.1&.1.3.6.1.4.1.789.1.21.1.2.1.25.1:public at filer
|String2Temp
MaxBytes[filer1a-shelf1]: 120
Title[filer1a-shelf1]: Filer1a Shelf 1 Temperature
...

I also tested to pipe the actual output to a modified version of the
conversion code like this

[root at myhost mrtg]# perl test.pl </tmp/filer.txt
73


test.pl
#!/usr/bin/perl

$myvar = String2Temp(<>);
print "$myvar\n";

sub String2Temp {
        my $str = shift;
        $str =~ /\((\d+)F\)(.*)ambient.*/i;
        my $temp = $1;
        return $temp;
}

[root at myhost mrtg]# cat /tmp/filer.txt
SNMPv2-SMI::enterprises.789.1.21.1.2.1.25.1 = STRING: "23C (73F) ambient,
32C (89F), 32C (89F)"


any help or pointers will be greatly appreciated!

Yang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20090623/497bd0b6/attachment.html 


More information about the mrtg mailing list