Page 1 of 1

Diffentent Notifications by type

Posted: Fri Feb 18, 2011 9:27 am
by CanDee
Hi.
Is it possible to set up seperate notifcation mail content for each notificationtype?

for example...

if i want to send a custum host notification i only want Author: $NOTIFICATIONAUTHOR$\nInfo: $NOTIFICATIONCOMMENT$ to be send.
if i acknowledge a Problem i send Author: $SERVICEACKAUTHOR$\nAcknowledgement Comment: $SERVICEACKCOMMENT$


is nagios able to seperate this?

i set the commands.php with this lines:

Code: Select all

# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\n++++++++++\n\nAuthor: $HOSTACKAUTHOR$\nAcknowledgement Comment: $HOSTACKCOMMENT$\n\nAuthor: $NOTIFICATIONAUTHOR$\nInfo: $NOTIFICATIONCOMMENT$\n\n++++++++++\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
	}

# 'notify-service-by-email' command definition
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\n++++++++++\n\nAuthor: $SERVICEACKAUTHOR$\nAcknowledgement Comment: $SERVICEACKCOMMENT$\n\nAuthor: $NOTIFICATIONAUTHOR$\nInfo: $NOTIFICATIONCOMMENT$\n\n++++++++++\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
	}

can i define a new notification like notify-service-by-email-custom for example?