[mrtg-developers] Getting error from MRTG when running externalscript

Scott S. Heath SHeath at udi.com
Tue Mar 18 12:16:25 CET 2008


Actually I wrestled with that for a while. There is a new line char in
the file and I found it easier to leave in then chomp it.





-----Original Message-----
From: mrtg-developers-bounces at lists.oetiker.ch
[mailto:mrtg-developers-bounces at lists.oetiker.ch] On Behalf Of Alex van
den Bogaerdt
Sent: Monday, March 17, 2008 10:56 PM
To: mrtg-developers at lists.oetiker.ch
Subject: Re: [mrtg-developers] Getting error from MRTG when running
externalscript

On Mon, Mar 17, 2008 at 09:39:40PM -0500, Scott S. Heath wrote:

> Here is the Perl code:
> 
> #!/usr/bin/perl
> $FileName = $ARGV[0];
> open(queueFile, "$FileName");
> my $queueFile = <queueFile>;
> $queueFile =~ s/copyqueuelength                  : //gi;
> 
> print $queueFile;
> print "0\n";
> print "0\n";
> print "CopyQueueLength";


If queueFile equals 200, this script will output:

"2000
0
CopyQueueLength"

whereas you probably want:

"200
0
0
CopyQueueLength
"

Notice: you have three lines with two linefeeds, I wrote four lines with
four linefeeds.

Don't know if that is the problem or not, I just noticed.

_______________________________________________
mrtg-developers mailing list
mrtg-developers at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers




More information about the mrtg-developers mailing list