Page 1 of 2

Notifications - hostalias returning description

Posted: Tue Dec 06, 2011 12:06 pm
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.

Re: Notifications - hostalias returning description

Posted: Tue Dec 06, 2011 12:48 pm
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.

Re: Notifications - hostalias returning description

Posted: Tue Dec 06, 2011 1:15 pm
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%

Re: Notifications - hostalias returning description

Posted: Tue Dec 06, 2011 1:40 pm
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.

Re: Notifications - hostalias returning description

Posted: Wed Dec 07, 2011 8:42 am
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.

Re: Notifications - hostalias returning description

Posted: Wed Dec 07, 2011 11:04 am
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)

Re: Notifications - hostalias returning description

Posted: Wed Dec 07, 2011 11:49 am
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$"

Re: Notifications - hostalias returning description

Posted: Wed Dec 07, 2011 5:04 pm
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.

Re: Notifications - hostalias returning description

Posted: Thu Dec 08, 2011 9:12 am
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
	}

Re: Notifications - hostalias returning description

Posted: Thu Dec 08, 2011 10:24 am
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.