Newbie: creating custom notification messages

Zembower, Kevin kzembowe at jhuccp.org
Tue Sep 4 18:49:20 CEST 2007


I'm trying to monitor the room temperature in my server room using SNMP
and the sensor built into Dell PowerEdge servers. I've got the
check_snmp plugin working on my Debian etch system:

cn2:/etc/nagios2# /usr/lib/nagios/plugins/check_snmp -H 10.253.192.204
-o .1.3.6.1.4.1.674.10892.1.700.20.1.6.1.3 -w 267 -c 322
SNMP OK - 240 | iso.3.6.1.4.1.674.10892.1.700.20.1.6.1.3=240  
cn2:/etc/nagios2#

The Dell sensor returns temperature in tenths of a degree Celsius, so I
have a warning at 80F (26.7C) and critical at 90F (32.2C). This seems to
be working correctly in my Nagios setup.

To avoid doing any math, I'd like to just send hard-coded warning and
critical email messages. I've defined the messages in
/etc/nagios2/commands.cfg:

# 'temp-warn-notify-by-email' command definition
# Use this notification if the temperature exceeds 80F (26.7C) in the
server room
define command{
        command_name    temp-warn-notify-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios
*****\n\nWarning: Temperature in CCP server room exceeds 80F. Probable
air conditioning failure.\n\nNotification Type:
$NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState:
$SERVICESTATE$ for $SERVICEDURATION$\nAddress:
$HOSTADDRESS$\n\nInfo:\n\n$SERVICEOUTPUT$\n\nDate/Time:
$LONGDATETIME$\n\nACK by: $SERVICEACKAUTHOR$\nComment:
$SERVICEACKCOMMENT$\n" | /usr/bin/mail -s "** Temperature in CCP server
room exceeds 80F **" $CONTACTEMAIL$
        }

# 'temp-crit-notify-by-email' command definition
# Use this notification if the temperature exceeds 90F (32.2C) in the
server room
define command{
        command_name    temp-crit-notify-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios
*****\n\nCRITICAL: Temperature in CCP server room exceeds 90F. Probable
air conditioning failure.\n\nNotification Type:
$NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState:
$SERVICESTATE$ for $SERVICEDURATION$\nAddress:
$HOSTADDRESS$\n\nInfo:\n\n$SERVICEOUTPUT$\n\nDate/Time:
$LONGDATETIME$\n\nACK by: $SERVICEACKAUTHOR$\nComment:
$SERVICEACKCOMMENT$\n" | /usr/bin/mail -s "** Temperature in CCP server
room exceeds 90F **" $CONTACTEMAIL$
        }

At this point, I don't know where to tell Nagios to use these two
messages rather than the more generic ones for temperature alerts. Also,
I don't know how to tell it to use one message for warning and the other
for critical errors. Is this possible? Finally, do I also need to write
two recovery messages to match the warning and critical ones (if I want
them to be easily understood by non-technical recipients), or just one
for both conditions?

I also welcome any advice or guidance anyone offers regarding my overall
approach and specific coding of the messages above. I appreciate all the
folks who offered suggestions on my earlier question of how to do
calculations in Nagios. I decided that it would be easier to just
hard-code the two messages, and I'll work on a more generic approach
next.

Thanks, again, for your suggestions and advice.

-Kevin
Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland  21202
410-659-6139 

-------------------------------------------------------------------------
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