Page 1 of 1
Add Host Notes to notifications emails
Posted: Fri Apr 05, 2019 2:41 pm
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..
Re: Add Host Notes to notifications emails
Posted: Fri Apr 05, 2019 3:06 pm
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?
Re: Add Host Notes to notifications emails
Posted: Wed Apr 17, 2019 10:25 am
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
Re: Add Host Notes to notifications emails
Posted: Wed Apr 17, 2019 11:24 am
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
Re: Add Host Notes to notifications emails
Posted: Wed Apr 17, 2019 11:45 am
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$"
Re: Add Host Notes to notifications emails
Posted: Wed Apr 17, 2019 11:46 am
by WVUhealth
screen shot
Re: Add Host Notes to notifications emails
Posted: Wed Apr 17, 2019 12:57 pm
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