[Nagiosplug-devel] plugin help
Aditya Ivaturi
aivaturi2 at unlnotes.unl.edu
Thu Sep 8 14:08:17 CEST 2005
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/20050908/47f694f5/attachment.html>
More information about the Devel
mailing list