Notification contents

Is it possible to change the contents of the email notifications that nagios send to its users. If yes, where and how. Any help will be appreciated,
thanks :slight_smile:

By default the email notification template is in the misccommands.cfg file.

Luca

Command is defined in the miscommands.cfg file like this:

define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $DATETIME$\n” | /bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}

So just change it to say whatever you want it to say, like Hello, this is nagios talking and I want to warn you about a potential problem… whatever…

Thank you Sir,
I appreciate your help :slight_smile:

Sir,
I was also wondering, is it possible to specify a seperate message for each host. Well let me explain what are my plans.
For example, I have 2 servers A and B.
If server A goes down then nagios will send an alert and in the notification it will specify a particular message like " A is down, follow these steps for recovery of your host".
If server B goes down then nagios gives a notification having different recovery steps in its notification.
The idea is to create Steps for each host seperately, which are shown in the email notification of nagios, to advice the staff on what to do when a particular host goes down.

Thanks :slight_smile:

Sure!
misccommands.cfg contains the definition for notify-by-email and host-notify-by-email.
contacts.cfg contains the definitions for the contacts and how that contact is to be notified (example notify-by-email and host-notify-by-email).
Define a contactgroup called server A and one called serverb.
Put contacts names contactA in group A and contact B in groupB.
Define a notify-by-email-serverA in misccommands that contains what you want them to get, and likewise for serverB.

BTW, of course, contactA and contactB can be the same person, but they will simply have different notify-by-email-serverA and notify-by-email-serverB in the service_notification_commands and host_notification_commands section of there contact definition.

Sir,
Thank you for your reply. I am going try the above method and i will let you know how it goes :slight_smile:
Regards