<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Aditya,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>NRPE: Unable to read output usually means that something was written to stderr and nothing to stdout when using check_nrpe. You should check that you can run your script as the nagios user on the target system, then try using check_nrpe from the nagios server as the nagios user. Only after these both work can you try from the Nagios daemon itself.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I've seen situations where the #! interpreter was not executable by the nagios user on the target system would cause this problem.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ton<DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>On 9 Sep 2005, at 14:49, Aditya Ivaturi wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><FONT size="2" face="sans-serif">Well the if condition is not the problem I think, because when I execute it on command line I get exactly the result I was expecting. For e.g. this is one of the outputs:</FONT> <BR> <BR><FONT size="2"><TT>OK: 12 Users Online | UsersOnline=12;0;0;</TT></FONT> <BR> <BR><FONT size="2" face="sans-serif">Where in fact there were only 12 users users using that system at that point. As far as permissions are concerned, I checked them and they all seem to be fine - owned by nagios and 755.</FONT> <BR> <BR><FONT size="2" face="sans-serif">--Turi</FONT> <BR> <BR><FONT size="2"><TT><A href="mailto:Lynne.G.Lawrence@uscg.mil">Lynne.G.Lawrence@uscg.mil</A> wrote on 09/09/2005 08:35:36 AM:<BR> <BR> > Perhaps your initial if statement is failing?  I suggest that you <BR> > add an else{} clause to the initial if{} regex match; put out some <BR> > message and exit $ERRORS{UNKNOWN} for no match.  Other than that, <BR> > maybe check the file permissions to ensure that it is executable by <BR> > the nagios user.</TT></FONT> <BR><FONT size="2"><TT>>  </TT></FONT> <BR><FONT size="2"><TT>> Hope this helps,</TT></FONT> <BR><FONT size="2"><TT>>  </TT></FONT> <BR><FONT size="2"><TT>> Lynne Lawrence</TT></FONT> <BR><FONT size="2"><TT>> QSS/USCG</TT></FONT> <BR><FONT size="2"><TT>> <BR> > From: <A href="mailto:nagiosplug-devel-admin@lists.sourceforge.net">nagiosplug-devel-admin@lists.sourceforge.net</A> [mailto:<BR> > <A href="mailto:nagiosplug-devel-admin@lists.sourceforge.net">nagiosplug-devel-admin@lists.sourceforge.net</A>] On Behalf Of Aditya Ivaturi<BR> > Sent: Thursday, September 08, 2005 5:08 PM<BR> > To: <A href="mailto:nagiosplug-devel@lists.sourceforge.net">nagiosplug-devel@lists.sourceforge.net</A><BR> > Subject: [Nagiosplug-devel] plugin help<BR> </TT></FONT> <BR><FONT size="2"><TT>> <BR> > This is the first time I am trying to write a plugin for Nagios. So <BR> > please bear with me. We have an online testing system and I am <BR> > writing a plugin to check how many users are actually taking a test.<BR> > It is a module that is in built in the system and exported via http.<BR> > So all I do is call that page and dump the number out. Nothing <BR> > complicated. The code-block (perl) which dumps out is as follows: <BR> > <BR> > <BR> > if ($content =~ m/<TD>Student Cache<\/TD><TD>(\d*)<\/TD>/) { <BR> >     if ($1>$critical) { <BR> >         if ($verbose) { <BR> >             print "CRITICAL: $1 Users Online > $critical Critical <BR> > Status \t Critical ErrorLev 2 | UsersOnline=$1;0;0;\n"; <BR> >         } <BR> >         else { <BR> >             print "CRITICAL: $1 Users Online | UsersOnline=$1;0;0;\n"; <BR> >         } <BR> >         exit $ERRORS{'CRITICAL'}; <BR> >     } <BR> >     elsif ($1>$warning) { <BR> >         if ($verbose) { <BR> >             print "WARNING: $1 # Users Online > $warning Warning <BR> > Status \t Critical ErrorLev 1 | UsersOnline=$1;0;0;\n"; <BR> >         } <BR> >         else { <BR> >             print "WARNING: $1 Users Online | UsersOnline=$1;0;0;\n";}; <BR> >         exit $ERRORS{'WARNING'}; <BR> >     } <BR> >     else { <BR> >         if ($verbose) { <BR> >             print "OK: $1 Users Online - Status normal \t Normal <BR> > ErrorLev 0 | UsersOnline=$1;0;0;\n"; <BR> >         } <BR> >         else { <BR> >             print "OK: $1 Users Online | UsersOnline=$1;0;0;\n"; <BR> >         } <BR> >         exit $ERRORS{'OK'}; <BR> >     } <BR> > } <BR> > <BR> > <BR> > For e.g the output will look like: <BR> > <BR> > OK: 12 Users Online | UsersOnline=12;0;0; <BR> > <BR> > where -w is 150 and -c is 200. But nagios complains by saying "NRPE:<BR> > Unable to read output". Is the format of the output wrong or am I <BR> > missing any steps? <BR> > <BR> > --Turi <BR> > <BR> > <BR> </TT></FONT><BR><BR><P align="center">This message has been scanned for viruses by <A href="http://www.MailController.altohiway.com/">MailController</A>.</P></BLOCKQUOTE></DIV><BR></DIV></DIV><BR><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><A href="http://www.altinity.com">http://www.altinity.com</A></DIV><DIV>T: +44 (0)870 787 9243</DIV><DIV>F: +44 (0)845 280 1725</DIV><DIV>Skype: tonvoon</DIV><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN><DIV>The contents of this email and any files transmitted with it are</DIV><DIV>confidential and intended solely for the use of the individuals to whom it</DIV><DIV>is addressed. If you are not the intended recipient or have received this</DIV><DIV>e-mail in error please notify the sender and destroy this e-mail</DIV><DIV>immediately. Any unauthorised copying, disclosure or distribution of the</DIV><DIV>material in this e-mail is strictly prohibited.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR></BODY></HTML>