Page 1 of 1

Include hostgroup in the Email Alert

Posted: Thu Nov 17, 2016 9:59 am
by haile711
Hey Guys,

Is there a way to include the hostgroup in the email group? Reason being we have 1000+ hosts and they are belong to different applications and the naming convention for the host does not tell me which application is having an issue. But we did define these hosts to hostgroup(application group), so it is possible to include the hostgroup in the email alert so we know which application it is coming from?

This is the default notify command we use

Code: Select all

/usr/bin/printf "%b" "***** Nagios XI Monitoring*****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nHostgroup: $HOSTGROUPALIAS$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/local/bin/sendEmail -s $USER7$ -t $CONTACTEMAIL$ -cc "$USER10$" -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ MCOM_RTP Host Alert: $HOSTNAME$ **" -m "***** Nagios XI Monitoring *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"
Thanks..

Re: Include hostgroup in the Email Alert

Posted: Thu Nov 17, 2016 10:47 am
by rkennedy
It looks like you're already passing $HOSTGROUPALIAS$, is this not sufficing?

The only macros I'm seeing are the following for hostgroups (https://assets.nagios.com/downloads/nag ... olist.html) -

Code: Select all

$HOSTGROUPALIAS$ 								
$HOSTGROUPMEMBERS$ 								
$HOSTGROUPNOTES$ 								
$HOSTGROUPNOTESURL$ 								
$HOSTGROUPACTIONURL$ 					
If none of those will work, then you can file a feature request for it here - https://github.com/NagiosEnterprises/nagioscore/issues - if you don't have a GitHub account, let me know and I'll file it on your behalf.

Re: Include hostgroup in the Email Alert

Posted: Thu Nov 17, 2016 11:08 am
by haile711
Kennedy,

even though it's already part of the notify command but when i received the email, it's not in there
***** Nagios XI Monitoring *****

Notification Type: PROBLEM

Service: Dashboard_Data_Layer
Host: Dynatrace:Dashboard
Address: 10.72.42.20
State: CRITICAL

Date/Time: Thu Nov 17 11:01:39 EST 2016

Additional Info:

CRITICAL: No data found for bcom_apollo_kws_s, bcom_msp_tax_a, bcom_apollo_sns_p, bcom_apollo_sns_s on 10.72.42.20
Sure can you submit it for me? since I do not have a github account

Thanks

Re: Include hostgroup in the Email Alert

Posted: Thu Nov 17, 2016 11:31 am
by avandemore
Github accounts are free, you can sign there if you like. We can submit a FR for this on your behalf but it's unlikely to gain any traction.

Hostgroups aren't designed to be used in that manner as that functionality is provided elsewhere.

https://assets.nagios.com/downloads/nag ... #hostgroup
https://assets.nagios.com/downloads/nag ... ntactgroup

The intended method for you get this functionality is to create a contact group including all the contacts you want in the host group. Then create a template referencing the contact group. Any host you want can use the template or be overridden at the host level.

https://assets.nagios.com/downloads/nag ... tance.html