Nagios email notifications with comments
wordpress meta
title: 'Nagios Email Notifications with Comments'
date: '2015-03-26T05:46:22-05:00'
status: publish
permalink: /nagios-email-notifications-with-comments
author: admin
excerpt: ''
type: post
id: 864
category:
- Nagios
tag: []
post_format: []
title: 'Nagios Email Notifications with Comments'
date: '2015-03-26T05:46:22-05:00'
status: publish
permalink: /nagios-email-notifications-with-comments
author: admin
excerpt: ''
type: post
id: 864
category:
- Nagios
tag: []
post_format: []
If you prefer more detail in the email notification of Nagios here is how to add those comments. For example someone acknowledging a service and you want to see the comment they added during acknowledgement.
# pwd
/usr/local/nagios/etc/objects
# more commands.cfg
[..]
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\nACK Comment: $SERVICEACKCOMMENT$\n\nComment: $NOTIFICATIONCOMMENT$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Note: I added $SERVICEACKCOMMENT$ and $NOTIFICATIONCOMMENT$ but I think in newer versions of Nagios $SERVICEACKCOMMENT$ is deprecated and you only need $NOTIFICATIONCOMMENT$.
Link: http://nagios.sourceforge.net/docs/3_0/macrolist.html