Page 2 of 3

Re: Sending Notes and notes url in emails

Posted: Mon May 13, 2019 9:58 am
by jenstar13
yes, but i won't have a time to get to it until tomorrow morning as our endusers are in in and causing problems :-)

Re: Sending Notes and notes url in emails

Posted: Mon May 13, 2019 10:05 am
by scottwilkerson
jenstar13 wrote:yes, but i won't have a time to get to it until tomorrow morning as our endusers are in in and causing problems :-)
ok

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:04 am
by jenstar13
ok ,I went to our dev Nagios and created a fake host
define host {
host_name lvsdevbigjen01.xxx.net
use xiwizard_ncpa_host
address 10.45.208.224
check_command check-host-alive!!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
event_handler notify-host-by-email
event_handler_enabled 1
contacts jenny
notification_interval 2
notification_period xi_timeperiod_24x7
notification_options d,u,r,
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
_xiwizard ncpa
register 1

The default template had %notes%
Host Alert Subject: %type% Host Alert - %host% is %hoststate%
Host Alert Message:
***** Nagios XI Alert *****

%alertsummary%

Notification Type: %type%
Host: %host%
State: %hoststate%
Address: %hostaddress%
Info: %hostoutput%
Date/Time: %datetime%

Respond: %responseurl%
Nagios URL: %xiserverurl%
Notes: %notes%

This is what it sends



-----Original Message-----
From: nagios <[email protected]>
Sent: Tuesday, May 14, 2019 8:50 AM
To: Sein, Jennifer <[email protected]>
Subject: ** PROBLEM Host Alert: lvsdevbigjen01.xxxx.net is DOWN **

***** Nagios Monitor XI Alert *****

Notification Type: PROBLEM
Host: lvsdevbigjen01.xxx.net
State: DOWN
Address: 10.45.208.224
Info: CRITICAL - 10.45.208.224: Time to live exceeded in transit @ 10.49.222.2. rta nan, lost 100%

Date/Time: Tue May 14 08:50:04 EDT 2019

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:16 am
by scottwilkerson
You should not be setting an eventhandler of notify-host-by-email, this is not a notification handler

Code: Select all

event_handler notify-host-by-email
event_handler_enabled 1
Is the contact jenny a regular Nagios XI user?

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:35 am
by jenstar13
yes on the jenny user, that is me
what are those event handlers for then? I guess I am confused

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:40 am
by jenstar13
Ok, i've been playing with stuff in our dev nagios install, and i got a note

if you look above, i added -notes="$HOSTNOTES$" to xi_host_notification_handler and that failed

So I took a guess and added n\nNotes: $HOSTNOTES$ to notify-host-by-email as shown below, and i got a note

notify-host-by-email /usr/bin/printf "%b" "***** Nagios DEV Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\n\nNotes: $HOSTNOTES$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

***** Nagios DEV Monitor XI Alert *****

Notification Type: PROBLEM
Host: lvsdevbigjen01.xxx.net
State: DOWN
Address: 10.45.208.224
Info: CRITICAL - 10.45.208.224: Time to live exceeded in transit @ 10.49.222.2. rta nan, lost 100%

Date/Time: Tue May 14 09:34:50 EDT 2019


Notes: testing

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:45 am
by scottwilkerson
Event handlers are used to run a command when the host/service changes state, which technically can be a notification, this will NOT use the notification handlers you setup in XI and the templates you specified in XI with the %notes% macros

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:51 am
by jenstar13
ok so what did i do wrong with the xi_host_notification_handler and the xi_service_notification_handler

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 8:57 am
by scottwilkerson
jenstar13 wrote:ok so what did i do wrong with the xi_host_notification_handler and the xi_service_notification_handler
Are xi_host_notification_handler and xi_service_notification_handler the notification handlers for the jenny contact?

Re: Sending Notes and notes url in emails

Posted: Tue May 14, 2019 9:22 am
by jenstar13
Ok, i think I am getting it now, so all that work i did to the xi notifications are no good unless i specify the user , to use the xi notification templates

can a user have more than one template in their set up, or will the multiples cancel them out?