[mrtg] Re: Perl external command ?!!

Alan Schwarzenberger alan.schwarzenberger at avt.co.uk
Tue Dec 3 13:23:59 MET 2002


I expect that snmpget is not on the path when the script is called from mrtg.

-----Original Message-----
From: BALLO Ismaël [mailto:iballo at afribone.net.ml]
Sent: 03 December 2002 12:12
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] Perl external command ?!!



Hi,

I use a perl external command which works well when calling from the command
line :
Target[bmpcmali_error]: `/usr/bin/perl bm_rssi_error.pl bmpcmali`
but which returns errors when called from cfg file (by crontab) :

2002-12-03 12:00:02 -- WARNING: Could not get any data from external command
'/usr/bin/perl bm_rssi_error.pl bmcpssante'
Maybe the external command did not even start. (Illegal seek)

I don't understand why.
Permissions are correct. All being executable by root.

Is it maybe the argument ?

Here is the perl script bm_rssi_error.pl :

#!usr/bin/perl
use Math::Round qw(round);
my $rssi;my $ret;my $tr;my $error_rate;
$rssi=`snmpget $ARGV[0] public .1.3.6.1.4.1.710.3.3.8.3.1.0`;
$rssi=~/"(\d*)"|(\d*)$/;if ($1 ne "") {$rssi=$1;} else { $rssi=$2; }
$ret=`snmpget $ARGV[0] public .1.3.6.1.4.1.710.3.3.8.2.3.3.0`;
$ret =~/(\d*)$/;$ret=$1;
$tr=`snmpget $ARGV[0] public .1.3.6.1.4.1.710.3.3.8.2.3.1.0`;
$tr =~/(\d*)$/; $tr=$1;
$error_rate=round($ret/($ret+$tr)*100);
print $rssi."\n";
print $error_rate."\n";

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list