Notifications - hostalias returning description

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
globalive.nagios

Notifications - hostalias returning description

Post by globalive.nagios »

The notifications are working fine, but when they go out they don't have a hostname (this is for service notifications).

It instead shows what is listed for the host's description. I tried changing one of the affected user's notification settings from %hostalias% to %host%, but doesn't seem to have fixed it.

Is there a location where I can edit the global notification template?

I did a search for this, but didn't come up with much.

Thanks.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Notifications - hostalias returning description

Post by lmiltchev »

When you go to: Configure->More Options->My Account Settings->Notification Options->Notification Messages, you can change "hostalias" to "host" under the "Service Alert Subject" and "Service Alert Message" as well. I am not sure if you did this for the services... Maybe you did it in the "Host Alert Subject".

In regards to the "global notification template", currently we don't offer this functionality but it is on our TODO list.
Be sure to check out our Knowledgebase for helpful articles and solutions!
globalive.nagios

Re: Notifications - hostalias returning description

Post by globalive.nagios »

Yes, that is exactly what I have done, so why have the settings not taken effect? Should I be restarting Nagios?

For reference, this is what the user's service notification settings are: (note that where it has %host% it used to have %hostalias%)

%type% Service Alert - %host%/%service% is %servicestate%

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

Notification Type: %type%

Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
Date/Time: %datetime%

Nagios URL: %xiserverurl%
globalive.nagios

Re: Notifications - hostalias returning description

Post by globalive.nagios »

No, I updated both the subject and message %hostalias% to %host%, and the problem persists. Anything else I can look at?

Edit: Whups, double post.
globalive.nagios

Re: Notifications - hostalias returning description

Post by globalive.nagios »

I restarted Nagios, just to see if it would make a difference. No luck. I will try rebooting the server and report back.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Notifications - hostalias returning description

Post by mguthrie »

Can you post the full notification command for "xi_service_notification_handler", it will be found in the Core Config Manager->Commands page? I should also probably verify, do you have this set as the notification command for this contact? (it would be set for any XI users by default)
globalive.nagios

Re: Notifications - hostalias returning description

Post by globalive.nagios »

Sure:

Code: Select all

/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=service --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --service="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --datetime="$LONGDATETIME$"
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Notifications - hostalias returning description

Post by mguthrie »

That looks ok. Can you post your contact config for the user who is having this issue. You can get the text config from the Core Config Manager->Contacts, and the click the "Download" button. You can remove actual emails from this for privacy.
globalive.nagios

Re: Notifications - hostalias returning description

Post by globalive.nagios »

Code: Select all

define contact {
	contact_name                  		name
	alias                         		User Name
	host_notifications_enabled    		1
	service_notifications_enabled 		1
	host_notification_period      		trotter_notification_times
	service_notification_period   		trotter_notification_times
	host_notification_options     		d,u,r,f,s
	service_notification_options  		w,u,c,r,f,s
	host_notification_commands    		notify-host-by-email
	service_notification_commands 		notify-service-by-email
	email                         		[email protected]
	host_notifications_enabled    		1
	service_notifications_enabled 		1
	use                           		xi_contact_generic,template-general-contacts
	}
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Notifications - hostalias returning description

Post by mguthrie »

Ok, I see what the issue is:
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
Should be:
host_notification_commands xi_host_notification_handler
service_notification_commands xi_service_notification_handler

Although the "notify-host-by-email" command works for notifications, it doesn't allow custom variables to be configured per-user as the "xi_" commands do. If you change the notification commands for your contacts to the "xi_" notification commands, you should be able to get the custom variables to work.
Locked