Change notification email subject?


#1

This might be an easy one for some of you all. :slight_smile: I’m trying to change the notification email subject line to read something like “Server1 is DOWN” or something along those lines. Is the command-plugins.cfg the place to do this? It’s the closest thing I’ve found. I commented out one line and added another, but after restarting the nagios service, I still end up with the same message. Any ideas???

(the original line that I commented out)
#command[notify-by-email]=/bin/printf “$OUTPUT$” | /bin/mail -s ‘$SERVICESTATE$ alert for $HOSTALIAS$/$SERVICEDESC$’ $CONTACTEMAIL$

(the line i added)
command[notify-by-email]=/bin/printf “$OUTPUT$” | /bin/mail -s ‘$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$’ $CONTACTEMAIL$

Thanks!!! :slight_smile:
Edited ]


#2

Perhaps you don’t have your contacts.cfg correct. Check it.
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email

You would then have to modify both for host and service, but what you have so far looks good.


#3

thanks jakkedup! i’ll check it next week when i get back to work and see what i can find. :wink:


#4

I tried your command in the command line, and it works just fine.
Note: my printf is not in same place as yours i.e. /usr/bin/printf

/usr/bin/printf “OUTPUT” | /bin/mail -s ‘HOSTALIAS/SERVICEDESC is SERVICESTATE’ myemail@addy.com
When testing in the command line, you have to take out the dollar signs, since those won’t be defined yet. So as I suspected, there is nothing wrong with your command, and it has to be elsewhere.


#5

i had been editing the wrong file. i’m not really sure what the command-plugins.cfg does, but the misccommands.cfg file is the one that needed to be changed. i changed the subject line there and now it works like a charm. :slight_smile: