Add Host Notes to notifications emails

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
WVUhealth
Posts: 78
Joined: Tue Apr 24, 2012 1:50 pm

Add Host Notes to notifications emails

Post by WVUhealth »

Hello.
I looked at the very good XI Understanding Notification Variable how to guide.
I was wanting to see if there was an easy way to send in the alert email the information we put in to our
Host notes.
We like to put in our Circuit IDs, ISP phone numbers , and things like that. It would be great to have that info
already added to an alert without having to go back in and make custom variables as described in the how to guide.

Any direction or help would be great..
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Add Host Notes to notifications emails

Post by npolovenko »

Hello, @WVUhealth. You might be able to use the $HOSTNOTES$ macro by adding it to your notification command. I can test this out in the lab if you let me know what notification command you're using: notify_host_by_email or xi_host_notification_handler?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
WVUhealth
Posts: 78
Joined: Tue Apr 24, 2012 1:50 pm

Re: Add Host Notes to notifications emails

Post by WVUhealth »

Thanks . I did not see that var $HOSTNOTES$ . I will give it a try
As for the notify_host_by_email or xi_host_notification_handler question. it looks like my contact show its xi_host_notification_handler.
If that is not correct please let me know how to verify.

under define contact {
service_notification_commands xi_service_notification_handler
host_notification_commands xi_host_notification_handler
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Add Host Notes to notifications emails

Post by npolovenko »

@WVUhealth, Ok, here's what you need to do then.
https://assets.nagios.com/downloads/nag ... iables.pdf

1. Open the xi_host_notification_handler command from the commands menu in Core Configurations Manager:
/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$" --notes="$HOSTNOTES$"
And add --notes="$HOSTNOTES$" at the end, just like in my command.

2. Open the notification message editor, page 6 of the pdf tutorial I sent you. And add something like this at the end:
My Host Notes: %notes%
"My Host Notes" can be changed to whatever message you want to see in the email.
Untitled.png
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
WVUhealth
Posts: 78
Joined: Tue Apr 24, 2012 1:50 pm

Re: Add Host Notes to notifications emails

Post by WVUhealth »

Updated the command , and my notification. Got nothing.
I know my notification were updated as it showed in my email
Host Notes:

Just wanted to confirm HOSTNOTES is an already built in variable as I have not seen documentation on that .
If it is not. Can we make it so i dont have to create custom macro per host ?!
running Nagios XI 5.5.11

xi_host_notification_handler /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$" --notes="$HOSTNOTES$"
WVUhealth
Posts: 78
Joined: Tue Apr 24, 2012 1:50 pm

Re: Add Host Notes to notifications emails

Post by WVUhealth »

screen shot
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Add Host Notes to notifications emails

Post by npolovenko »

@WVUhealth, Yes, $HOSTNOTES$ macro is built in into Core.
https://assets.nagios.com/downloads/nag ... #hostnotes

Did you put your host notes in this field?
Untitled.png
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked