Getting error from MRTG when running external script
"Scott S. Heath" <[email protected]> Mon, 17 Mar 2008 21:39:40 -0500
| Newsgroups | gmane.network.mrtg.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============0891449905== Content-class: urn:content-classes:message Content-Type: multipart/related; type="multipart/alternative"; boundary="----_=_NextPart_001_01C888A1.507F090E" This is a multi-part message in MIME format. ------_=_NextPart_001_01C888A1.507F090E Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C888A1.507F090E" ------_=_NextPart_002_01C888A1.507F090E Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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. =20 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. =20 It works...Sort of. =20 Here is the Perl code: #!/usr/bin/perl $FileName =3D $ARGV[0]; open(queueFile, "$FileName"); my $queueFile =3D <queueFile>; $queueFile =3D~ s/copyqueuelength : //gi; =20 print $queueFile; print "0\n"; print "0\n"; print "CopyQueueLength"; =20 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 =20 Here is the MRTG config file: =20 Target[exchange]: `/etc/mrtg/scripts/parseExch07.pl /etc/mrtg/scripts/copyqueuelength.txt` 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> =20 =20 When I run mrtg with this config file I get: =20 readline() on closed filehandle NF at /usr/bin/mrtg line 1311. =20 Any Ideas? =20 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 length. =20 =20 =20 SCOTT HEATH | Network Engineer Elmwood Business Park #10 Commerce Court, Suite A | New Orleans, LA 70123 504-523-1466 | [email protected] <mailto:[email protected]> |www.udi.com <http://www.udi.com/>=20 ________________________________________________________________________ Making it easier =20 ------_=_NextPart_002_01C888A1.507F090E Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" = xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" = xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Cambria; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} p.MsoAcetate, li.MsoAcetate, div.MsoAcetate {mso-style-priority:99; mso-style-link:"Balloon Text Char"; margin:0in; margin-bottom:.0001pt; font-size:8.0pt; font-family:"Tahoma","sans-serif";} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} span.BalloonTextChar {mso-style-name:"Balloon Text Char"; mso-style-priority:99; mso-style-link:"Balloon Text"; font-family:"Tahoma","sans-serif";} .MsoChpDefault {mso-style-type:export-only;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"2050" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3DEN-US link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal>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.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>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.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>It works…Sort of.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>Here is the Perl code:<o:p></o:p></p> <p class=3DMsoNormal>#!/usr/bin/perl<o:p></o:p></p> <p class=3DMsoNormal>$FileName =3D $ARGV[0];<o:p></o:p></p> <p class=3DMsoNormal>open(queueFile, = "$FileName");<o:p></o:p></p> <p class=3DMsoNormal>my $queueFile =3D <queueFile>;<o:p></o:p></p> <p class=3DMsoNormal>$queueFile =3D~ s/copyqueuelength &n= bsp; : //gi;<o:p></o:p></p> <p class=3DMsoNormal> <o:p></o:p></p> <p class=3DMsoNormal>print $queueFile;<o:p></o:p></p> <p class=3DMsoNormal>print "0\n";<o:p></o:p></p> <p class=3DMsoNormal>print "0\n";<o:p></o:p></p> <p class=3DMsoNormal>print "CopyQueueLength";<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>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 .<o:p></o:p></p> <p = class=3DMsoNormal>CopyQueueLength &nbs= p; : 200<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>Here is the MRTG config file:<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>Target[exchange]: `/etc/mrtg/scripts/parseExch07.pl /etc/mrtg/scripts/copyqueuelength.txt`<o:p></o:p></p> <p class=3DMsoNormal>MaxBytes[exchange]: 100000<o:p></o:p></p> <p class=3DMsoNormal>YLegend[exchange]: Files<o:p></o:p></p> <p class=3DMsoNormal>Legend1[exchange]: Copy Queue Length<o:p></o:p></p> <p class=3DMsoNormal>Legend2[exchange]: Replay Queue = Length<o:p></o:p></p> <p class=3DMsoNormal>LegendI[exchange]: Copy Queue Length<o:p></o:p></p> <p class=3DMsoNormal>LegendO[exchange]: Replay Queue = Length<o:p></o:p></p> <p class=3DMsoNormal>ShortLegend[exchange]: Files<o:p></o:p></p> <p class=3DMsoNormal>Title[exchange]: Copy Queue Length<o:p></o:p></p> <p class=3DMsoNormal>Options[exchange]: growright, nopercent, integer, = unknaszero<o:p></o:p></p> <p class=3DMsoNormal>Colours[exchange]: GREEN#00eb0c,BLUE#0000ff,GRAY#AAAAAA,VIOLET#ff00ff<o:p></o:p></p> <p class=3DMsoNormal>WithPeak[exchange]: ymw<o:p></o:p></p> <p class=3DMsoNormal>PageTop[exchange]: <H1>Copy queue = Length</H1><o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>When I run mrtg with this config file I = get:<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>readline() on closed filehandle NF at /usr/bin/mrtg = line 1311.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>Any Ideas?<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>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 length.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><img width=3D112 height=3D29 id=3D"Picture_x0020_5" src=3D"cid:[email protected]" alt=3D"UDI LOGO for subscriber gateway.jpg"><o:p></o:p></p> <p class=3DMsoNormal><span = style=3D'font-size:4.0pt'><o:p> </o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:12.0pt;color:#948A54;text-transform: uppercase;letter-spacing:.2pt'>SCOTT HEATH</span><span = style=3D'color:#948A54'> </span><span style=3D'font-size:9.0pt;color:#948A54'>|</span><span style=3D'font-size:9.0pt;color:#17365D'> </span><span = style=3D'font-size:7.5pt; font-family:"Cambria","serif";color:#948A54;text-transform:uppercase; letter-spacing:1.0pt'>Network Engineer</span><span = style=3D'font-size:7.5pt; font-family:"Cambria","serif";color:#A6A6A6;text-transform:uppercase; letter-spacing:1.0pt'><o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:9.0pt;color:#17365D'>Elmwood Business Park</span><span = style=3D'font-size:9.0pt;color:#17365D'><o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D'font-size:9.0pt;color:#17365D'>#10 = Commerce Court, Suite A | New Orleans, LA 70123<span = style=3D'text-transform: uppercase;letter-spacing:1.0pt'><o:p></o:p></span></span></p> <p class=3DMsoNormal><span = style=3D'font-size:8.0pt;color:#17365D'>504-523-1466 | <a href=3D"mailto:[email protected]"><span = style=3D'color:blue'>[email protected]</span></a> |</span><span style=3D'font-size:9.0pt;color:#17365D'><a href=3D"http://www.udi.com/"><span = style=3D'color:#17365D'>www.udi.com</span></a></span><span style=3D'font-size:8.0pt;color:#17365D'><o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:8.0pt;color:#17365D'>_________________________________= _______________________________________<o:p></o:p></span></p> <p class=3DMsoNormal><span = style=3D'font-size:12.0pt;color:#17365D;text-transform: uppercase;letter-spacing:.2pt'>Making <i>it</i> easier</span><span style=3D'font-size:7.5pt;font-family:"Cambria","serif";color:#17365D;text= -transform: uppercase;letter-spacing:1.0pt'><o:p></o:p></span></p> <p class=3DMsoNormal><o:p> </o:p></p> </div> </body> </html> ------_=_NextPart_002_01C888A1.507F090E-- ------_=_NextPart_001_01C888A1.507F090E Content-Type: image/jpeg; name="image001.jpg" Content-Transfer-Encoding: base64 Content-ID: <[email protected]> Content-Description: image001.jpg Content-Location: image001.jpg /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf IiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7 Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAAdAHADASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqr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vx8OnwWPxbtYLZRHDBbhEQDoBFXcSqZIZE3spNyAGB5HIrOvPVNdhxRjR eG76C3MCNGYjaOgQt9yVmQsB/snbn65q1daHcyz6ht8swPFIbZSeRJIuGJ9On/jxqaW5MWmWU8q+ aC2GQnAJOefwqW6l26zBDg5k2srZ+4BnI/Guf2zL5TPutEvb21gXb5TRQyoVdkYuSUIBIXAB2nkY Iqd9P1BZ78WaLBHcoRl3DfOxA3DjIGMnBPXGKuxArqk7biQwYY9MBf8AGo2T7LofmbmfhZGBON3T I+hp+1fYXKU7bS7/AE37IkUUdxFaTSeWFYJ+7ZeOD6EkY9MVPqmn3V1eSPFbQypPaGAtI2PLOSc4 xz17elOkzLo8Dhiu7c4A5wMMQPw6VYnZzqELhyFjCjb/AHt5IP8AIUvau9x8pSTRrxNXjvzMkgj2 wbWHLQhcHJ9d3zYqFtDvxa2KRGCNrLMqjs8m7j6fLkZ/2jWlKix2upMgwfm5H+4KrXVwDpdmQmPO bYvP3CQcNx6Ue1aDlP/Z ------_=_NextPart_001_01C888A1.507F090E-- --===============0891449905== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ mrtg-developers mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers --===============0891449905==--