I am getting the alerts for the host being down in the below format:
Host ‘slc207107’ is DOWN:
I would like to append the hostname with the host group so that we can identify the server group is having an issue. something like this:
Host ‘slc207107-webapp server’ is DOWN: where webapp server is the host group for the machine.
TIA
Alerts needs to be hostname append with the hostgroup name
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Alerts needs to be hostname append with the hostgroup na
Hello TIA,
You'll need to go to Admin > Notifications Management and adjust your Email Message template to include the hostroup in the subject and/or body of the notification.
You can use system macros in the template but you'll need to add them to the XI notification handler. See the guide below for instructions on how to set this up. For example, add --hostgroup="$HOSTGROUPNAME$" to the command string.
Understanding Notification Variables
You'll need to go to Admin > Notifications Management and adjust your Email Message template to include the hostroup in the subject and/or body of the notification.
You can use system macros in the template but you'll need to add them to the XI notification handler. See the guide below for instructions on how to set this up. For example, add --hostgroup="$HOSTGROUPNAME$" to the command string.
Understanding Notification Variables
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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
Re: Alerts needs to be hostname append with the hostgroup na
I tried appending the notification message with "Hostgroup: %hostgroup%" but it did not work.
I don't even see %hostgroup% as one of the variable in the document provided above.
I don't even see %hostgroup% as one of the variable in the document provided above.
Re: Alerts needs to be hostname append with the hostgroup na
In order to be able to use "%hostgroup%" in the notification messages like this, you would need to set up the macro in your notification command.
Core Config Manager > Commands > Commands > xi_host_notification_handler > Edit
For example, if you are using the "default" XI notification handler command (xi_host_notification_handler), you could append the following code to the end of the command:
or
The "$HOSTGROUPNAME$" and "$HOSTGROUPNAMES$" macros are a bit different - read more about them here:
https://assets.nagios.com/downloads/nag ... olist.html
Example:
Once you modify your notification command, and apply configuration, you should be able to use something like this in the "Host Alert Subject" field (under the "Notification Messages" page):
You can also use "%hostgroup%" in the "Host Alert Message" field, for example:
Let us know if this helped.
Core Config Manager > Commands > Commands > xi_host_notification_handler > Edit
For example, if you are using the "default" XI notification handler command (xi_host_notification_handler), you could append the following code to the end of the command:
Code: Select all
--hostgroup="$HOSTGROUPNAME$"Code: Select all
--hostgroup="$HOSTGROUPNAMES$"https://assets.nagios.com/downloads/nag ... olist.html
Example:
Code: Select all
/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$" --hostgroup="$HOSTGROUPNAMES$"Code: Select all
%type% Host Alert - %host%-%hostgroup% is %hoststate%Code: Select all
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Host: %host%
Hostgroup: %hostgroup%
State: %hoststate%
Address: %hostaddress%
Info: %hostoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%Be sure to check out our Knowledgebase for helpful articles and solutions!
-
IT-OPS-SYS
- Posts: 184
- Joined: Sun Jan 07, 2018 12:56 pm
Re: Alerts needs to be hostname append with the hostgroup na
i was able to do for 1 single account but how can we deploy the same setting for the entire contact groups or a set of users.
Re: Alerts needs to be hostname append with the hostgroup na
You can deploy various notification preferences/templates to users in bulk via the "Notification Settings Management" option, which is available in Nagios XI Enterprise Edition.
Admin > Users > Notification Management
See pages 7-9 in the document below:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Admin > Users > Notification Management
See pages 7-9 in the document below:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!