[mrtg-developers] Getting error from MRTG when running external script

Scott S. Heath SHeath at udi.com
Tue Mar 18 03:39:40 CET 2008

Hey all, I'm new to the list and cutting my teeth on Perl (I'm a
Windows/Exchange guy by trade) but seem to be the only person where I
work who has setup MRTG successfully and has it monitoring all the
routers and switches at each client I deal with on a daily basis.


We just installed Exchange 2007 into a multi-site organization, got
everything working exchange wise perfectly and now I've turned my sites
to monitoring it. Since I have MRTG already installed and it's got that
wonderful external scripts option I figured I could write something
simple to parse a file and pass the results to MRTG.


It works...Sort of.


Here is the Perl code:


$FileName = $ARGV[0];

open(queueFile, "$FileName");

my $queueFile = <queueFile>;

$queueFile =~ s/copyqueuelength                  : //gi;


print $queueFile;

print "0\n";

print "0\n";

print "CopyQueueLength";


The script expects a file with 1 line in it. This file is generated and
over written once every 15 minutes with the # changing (hopefully
dropping and/or staying at 0) and downloaded from my Exchange 2007
server to me MRTG VM .

CopyQueueLength                  : 200


Here is the MRTG config file:


Target[exchange]: `/etc/mrtg/scripts/parseExch07.pl

MaxBytes[exchange]: 100000

YLegend[exchange]: Files

Legend1[exchange]: Copy Queue Length

Legend2[exchange]: Replay Queue Length

LegendI[exchange]: Copy Queue Length

LegendO[exchange]: Replay Queue Length

ShortLegend[exchange]: Files

Title[exchange]: Copy Queue Length

Options[exchange]: growright, nopercent, integer, unknaszero

Colours[exchange]: GREEN#00eb0c,BLUE#0000ff,GRAY#AAAAAA,VIOLET#ff00ff

WithPeak[exchange]: ymw

PageTop[exchange]: <H1>Copy queue Length</H1>



When I run mrtg with this config file I get:


readline() on closed filehandle NF at /usr/bin/mrtg line 1311.


Any Ideas?


Thanks in advance. Once I get this working I'll be sure to share it as
so far I haven't found an app that will monitor Exchange 2007 SCR queue




SCOTT HEATH  | Network Engineer

Elmwood Business Park

#10 Commerce Court, Suite A  | New Orleans, LA  70123

504-523-1466  |   sheath at udi.com <mailto:sheath at udi.com>  |www.udi.com


Making it easier


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg-developers/attachments/20080317/1e9cb360/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 1554 bytes
Desc: image001.jpg
Url : http://lists.oetiker.ch/pipermail/mrtg-developers/attachments/20080317/1e9cb360/attachment-0001.jpe 

More information about the mrtg-developers mailing list