Modifying the default e-mail

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jronin
Posts: 18
Joined: Tue Oct 09, 2012 12:05 pm

Modifying the default e-mail

Post by jronin »

I looked through the admin console, and made changes to commands.cfg for the notify host/service by e-mail command, but it doesn't seem to affect the e-mails that are sent out. What do I need to modify to change the default notification e-mail?
455157
Posts: 51
Joined: Mon Sep 10, 2012 7:35 pm

Re: Modifying the default e-mail

Post by 455157 »

Do you mean the actual alert message content?

This can be changed per user by clicking your username on the upper right of the interface ("Logged in as: username"), then clicking the notification message menu on the left.
jronin
Posts: 18
Joined: Tue Oct 09, 2012 12:05 pm

Re: Modifying the default e-mail

Post by jronin »

Yes I do mean the message content. I want to change it globally and not per user though.
455157
Posts: 51
Joined: Mon Sep 10, 2012 7:35 pm

Re: Modifying the default e-mail

Post by 455157 »

I don't think this is part of the standard XI, but in the Enterprise version you can mkae notification templates in the Admin -> Users -> Notification Management menu.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Modifying the default e-mail

Post by scottwilkerson »

455157 is correct, this is a new feature in the 2012 Enterprise version, and you can lock them down as well if you don't want users to be able to change them.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jronin
Posts: 18
Joined: Tue Oct 09, 2012 12:05 pm

Re: Modifying the default e-mail

Post by jronin »

On a related note is there any way to modify the notify-host-by-email commad to truncate/remove the domain when sending e-mails? I would rather have host1 is UP instead of host1.domain.com is UP.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Modifying the default e-mail

Post by scottwilkerson »

I haven't tested this but you may be able to change the command from this

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
to something like this

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: `echo '$HOSTNAME$' |cut -d'.' -f1`\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jronin
Posts: 18
Joined: Tue Oct 09, 2012 12:05 pm

Re: Modifying the default e-mail

Post by jronin »

That worked for the body of the e-mail, but doesn't work for the subject. I'm still receiving workstation1.domain.test.com is Down. Having the full domain name in there makes it hard to identify key issues on a blackberry. Any suggestions?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Modifying the default e-mail

Post by scottwilkerson »

Ok, to do the subject too

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: `echo '$HOSTNAME$' |cut -d'.' -f1`\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: `echo '$HOSTNAME$' |cut -d'.' -f1` is $HOSTSTATE$ **" $CONTACTEMAIL$
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jronin
Posts: 18
Joined: Tue Oct 09, 2012 12:05 pm

Re: Modifying the default e-mail

Post by jronin »

Thanks! That works great.
Locked