[Nagiosplug-devel] plugin help

Aditya Ivaturi aivaturi2 at unlnotes.unl.edu
Fri Sep 9 06:50:24 CEST 2005


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 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20050909/1d8c4c74/attachment.html>


More information about the Devel mailing list