Page 1 of 1

List Hosts/Services using Individual Contacts for alerts?

Posted: Tue Jul 14, 2020 9:39 am
by TBT
We tend to use Contact Groups to send alert notifications, however, I've discovered a few Hosts/Services where other Administrators have been using Other Individual Contacts. I'm looking for a suggestion on how to list all Hosts/Services that are using Individual Contacts for notifications?

Re: List Hosts/Services using Individual Contacts for alerts

Posted: Tue Jul 14, 2020 3:44 pm
by scottwilkerson
I believe the below 2 queries should get you the info you need from the nagiosql database

Code: Select all

mysql -pnagiosxi nagiosql
Hosts

Code: Select all

SELECT host_name
FROM tbl_contact, tbl_host, tbl_lnkHostToContact
WHERE tbl_host.id =  tbl_lnkHostToContact.idMaster
GROUP BY host_name
Services

Code: Select all

SELECT tbl_host.host_name, service_description
FROM tbl_contact, tbl_host, tbl_service, tbl_lnkServiceToContact, tbl_lnkServiceToHost
WHERE tbl_service.id =  tbl_lnkServiceToHost.idMaster
AND tbl_host.id =  tbl_lnkServiceToHost.idSlave
AND tbl_service.id =  tbl_lnkServiceToContact.idMaster
GROUP BY tbl_host.host_name, service_description