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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alex van
den Bogaerdt
Sent: Monday, March 17, 2008 10:56 PM
To: [email protected]
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
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers


_______________________________________________
mrtg-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers

Reply via email to