Page 1 of 1

ADD NEW TEXT

Posted: Mon Apr 03, 2017 10:03 am
by phillay151
Hi,

I need to change the email notification message how do I do that?

like this is the notification message I get

Notification Type: RECOVERY

Service: check_http www.google.ca
Host: hostname
Address: 192.168.1.2
State: OK

Date/Time: Fri Mar 24 16:27:36 EDT 2017

Additional Info:

HTTP OK: Status line output matched 1 200 - 60531 bytes in 4.859 second response time


is there anyway i can change the whole thing? like i want a message just for this host only.

please let me know

Re: ADD NEW TEXT

Posted: Mon Apr 03, 2017 11:25 am
by cdienger
The default email templates are defined in /usr/local/nagios/etc/objects/commands.cfg with the command_lines for "notify-host-by-email" and "notify-service-by-email."

Re: ADD NEW TEXT

Posted: Mon Apr 03, 2017 11:31 am
by phillay151
is there a way to put this in place ?


Here is the subject and body of the emails:

Subject:

Anomaly - Monitoring of the website (wwbsite.com) -% type of anomaly%

Type of anomaly:% type of anomaly%

Body :

--------------------------------------------------------------------------------------------------------------------------------

Hello,

This is to notify you that we have detected an anomaly on the website : website.com

Type of anomaly:% type of anomaly%

Please check the website as soon as possible.

Have a good day.

--------------------------------------------------------------------------------------------------------------------------------

Re: ADD NEW TEXT

Posted: Mon Apr 03, 2017 2:12 pm
by cdienger
You can try something like:

command_line /usr/bin/printf "%b" "Hello,\n\nThis is to notify you that we have detected an anomaly on the website : $ADDRESS$\n\nType of anonmaly: $NOTIFICATIONTYPE$\n\nPlease check the website as soon as possible.\n\nHave a good day.| /bin/mail -s "Anomaly - Monitoring of the website($ADDRESS) - $NOTIFICATIONTYPE$" $CONTACTEMAIL$

List of default macros can be found at:

https://assets.nagios.com/downloads/nag ... olist.html
https://assets.nagios.com/downloads/nag ... olist.html

Re: ADD NEW TEXT

Posted: Tue Apr 04, 2017 7:43 am
by phillay151
sorry i'm new at this i do not understand this :( lol

Re: ADD NEW TEXT

Posted: Tue Apr 04, 2017 1:06 pm
by cdienger
/usr/local/nagios/etc/objects/commands.cfg contains a definition for "notify-service-by-email" which specifies the format of the email with command_line. You can modify this line/format as you see fit. After making the changes you need to restart the serivce with "service nagios restart"

Re: ADD NEW TEXT

Posted: Tue Apr 04, 2017 2:23 pm
by phillay151
is that for one host only ?!?!

Re: ADD NEW TEXT

Posted: Tue Apr 04, 2017 3:11 pm
by cdienger
No, this would apply to all services or hosts that call it.

You may find it beneficial to bookmark https://library.nagios.com/library/prod ... e/manuals/ which has links to further documentation that can help you with configuration Nagios.