Sending Notes and notes url in emails
Re: Sending Notes and notes url in emails
yes, but i won't have a time to get to it until tomorrow morning as our endusers are in in and causing problems 
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Sending Notes and notes url in emails
okjenstar13 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
Re: Sending Notes and notes url in emails
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Sending Notes and notes url in emails
You should not be setting an eventhandler of notify-host-by-email, this is not a notification handler
Is the contact jenny a regular Nagios XI user?
Code: Select all
event_handler notify-host-by-email
event_handler_enabled 1Re: Sending Notes and notes url in emails
yes on the jenny user, that is me
what are those event handlers for then? I guess I am confused
what are those event handlers for then? I guess I am confused
Re: Sending Notes and notes url in emails
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Sending Notes and notes url in emails
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
ok so what did i do wrong with the xi_host_notification_handler and the xi_service_notification_handler
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Sending Notes and notes url in emails
Are xi_host_notification_handler and xi_service_notification_handler the notification handlers for the jenny contact?jenstar13 wrote: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
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?
can a user have more than one template in their set up, or will the multiples cancel them out?