Newbie: How to calculate within Nagios?

Andrew Cruse andrew at profitability.net
Wed Aug 29 21:09:53 CEST 2007


Zembower, Kevin wrote:
> I've just gotten my first Nagios system set up and running, so if this
> is a common question, please forgive me and point out what I
> overlooked. 
> 
> I want to use Nagios and the check_snmp plug-in to monitor the ambient
> temperature in my server room, and send alerts when the air
> conditioner fails. My Dell PowerEdge servers have an ambient
> temperature probe that reports in tenths of a degree Celsius.

> The output indicates that the temperature is 24 degrees Celsius or
> (9/5)*24+32=75.2 degrees Fahrenheit. I'd like to use the Fahrenheit
> value in my emails, 

> My question is, should I just hard-code the values in the email
> message ("Warning: the server room temperature exceeds 80 F.") or
> could I calculate within Nagios and say "Warning: the server room
> temperature is XX F." If I can calculate within Nagios, please point
> out an example in the documentation or other source.


Nagios (to my knowledge) has no way of manipulating the numbers it receives
from plugins.  Actually, Nagios really only passes those along as
informational -- it only concerns itself with the exit status of the plugin
(OK, WARNING, CRITICAL, etc.).  Obviously the easiest option for you would
be to hard-code the email message, although even that would require a bit of
scripting so it doesn't say that on ALL your email messages.

Otherwise, it doesn't seem like it would be too terribly difficult to write
a little wrapper (Perl seems like the obvious choice to me, but any old
language would work) that takes any commandline options you'd like to pass
to it through Nagios, passes those along to the actual check_snmp plugin,
then reads the output from check_snmp, performs whatever mathematical
operations you'd like on the output, and then passes the manipulated data
back along to Nagios.  Have a look at the negate or urlize "plugin wrappers"
for examples of how that kind of thing might be done.

The key thing to understand here is that Nagios itself makes no decisions
about the status of a host or service, other than defining the status as
HARD or SOFT.  The plugins do all the work of determining status and simply
report that information to Nagios, so any changes you want to make regarding
the way a status is determined or what values are passed along need to be
done at the plugin level.  

Andrew


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list