[Nagiosplug-devel] plugin help

Ton Voon ton.voon at altinity.com
Mon Sep 12 01:06:24 CEST 2005


Aditya,

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.

I've seen situations where the #! interpreter was not executable by  
the nagios user on the target system would cause this problem.

Ton


On 9 Sep 2005, at 14:49, Aditya Ivaturi wrote:

>
> 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:
>
> OK: 12 Users Online | UsersOnline=12;0;0;
>
> 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.
>
> --Turi
>
> Lynne.G.Lawrence at uscg.mil wrote on 09/09/2005 08:35:36 AM:
>
> > Perhaps your initial if statement is failing?  I suggest that you
> > add an else{} clause to the initial if{} regex match; put out some
> > message and exit $ERRORS{UNKNOWN} for no match.  Other than that,
> > maybe check the file permissions to ensure that it is executable by
> > the nagios user.
> >
> > Hope this helps,
> >
> > Lynne Lawrence
> > QSS/USCG
> >
> > From: nagiosplug-devel-admin at lists.sourceforge.net [mailto:
> > nagiosplug-devel-admin at lists.sourceforge.net] On Behalf Of Aditya  
> Ivaturi
> > Sent: Thursday, September 08, 2005 5:08 PM
> > To: nagiosplug-devel at lists.sourceforge.net
> > Subject: [Nagiosplug-devel] plugin help
>
> >
> > This is the first time I am trying to write a plugin for Nagios. So
> > please bear with me. We have an online testing system and I am
> > writing a plugin to check how many users are actually taking a test.
> > It is a module that is in built in the system and exported via http.
> > So all I do is call that page and dump the number out. Nothing
> > complicated. The code-block (perl) which dumps out is as follows:
> >
> >
> > if ($content =~ m/<TD>Student Cache<\/TD><TD>(\d*)<\/TD>/) {
> >     if ($1>$critical) {
> >         if ($verbose) {
> >             print "CRITICAL: $1 Users Online > $critical Critical
> > Status \t Critical ErrorLev 2 | UsersOnline=$1;0;0;\n";
> >         }
> >         else {
> >             print "CRITICAL: $1 Users Online | UsersOnline=$1;0;0; 
> \n";
> >         }
> >         exit $ERRORS{'CRITICAL'};
> >     }
> >     elsif ($1>$warning) {
> >         if ($verbose) {
> >             print "WARNING: $1 # Users Online > $warning Warning
> > Status \t Critical ErrorLev 1 | UsersOnline=$1;0;0;\n";
> >         }
> >         else {
> >             print "WARNING: $1 Users Online | UsersOnline=$1;0;0; 
> \n";};
> >         exit $ERRORS{'WARNING'};
> >     }
> >     else {
> >         if ($verbose) {
> >             print "OK: $1 Users Online - Status normal \t Normal
> > ErrorLev 0 | UsersOnline=$1;0;0;\n";
> >         }
> >         else {
> >             print "OK: $1 Users Online | UsersOnline=$1;0;0;\n";
> >         }
> >         exit $ERRORS{'OK'};
> >     }
> > }
> >
> >
> > For e.g the output will look like:
> >
> > OK: 12 Users Online | UsersOnline=12;0;0;
> >
> > where -w is 150 and -c is 200. But nagios complains by saying "NRPE:
> > Unable to read output". Is the format of the output wrong or am I
> > missing any steps?
> >
> > --Turi
> >
> >
>
>
> This message has been scanned for viruses by MailController.





http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon

The contents of this email and any files transmitted with it are
confidential and intended solely for the use of the individuals to  
whom it
is addressed. If you are not the intended recipient or have received  
this
e-mail in error please notify the sender and destroy this e-mail
immediately. Any unauthorised copying, disclosure or distribution of the
material in this e-mail is strictly prohibited.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20050912/1ae60cf6/attachment.html>


More information about the Devel mailing list