[Nagiosplug-devel] plugin help
Lawrence, Lynne
Lynne.G.Lawrence at uscg.mil
Fri Sep 9 06:46:09 CEST 2005
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: <http://nagios-plugins.org/archive/devel/attachments/20050909/b951773d/attachment.html>
More information about the Devel
mailing list