Page 1 of 1

Hosts and services as they correlate to contact groups

Posted: Fri Sep 28, 2018 7:51 am
by wjoyner
Is there a way to get a complete list in nagios of what contact group is assigned to a host?
From what I can see the problem overview would show the host/service and who gets alerted based on contact group.
If you look up the specific contact group, it only shows the group members, not the host/service association.

Re: Hosts and services as they correlate to contact groups

Posted: Fri Sep 28, 2018 12:41 pm
by tgriep
The following mysql query will show the running hosts and the contact_groups that are assigned to them.
Run it as root and it will output a table that you can use to get that information.

Code: Select all

/usr/bin/mysql -u root -pnagiosxi  -e 'SELECT  nagios.nagios_hosts.host_object_id,nagios.nagios_host_contactgroups.host_id,nagios.nagios_host_contactgroups.contactgroup_object_id,nagios.nagios_contactgroups.contactgroup_object_id,nagios.nagios_hosts.alias,nagios_hosts.display_name,nagios_contactgroups.alias FROM ((nagios.nagios_hosts INNER JOIN nagios.nagios_host_contactgroups ON nagios.nagios_hosts.host_id = nagios.nagios_host_contactgroups.host_id) INNER JOIN nagios.nagios_contactgroups ON nagios.nagios_host_contactgroups.contactgroup_object_id =  nagios.nagios_contactgroups.contactgroup_object_id);'