Page 1 of 2

Removing contacts from Notifications

Posted: Wed Aug 13, 2014 3:24 pm
by akepley
We have decided to use Escalations to send notifications and have the normal notifications stop after the first notification. The only issue is that the original Services/Hosts all have contacts from when they were originally created. This equals about 200 hosts and 2,000 services underneath. Is there an easy way to remove the contacts from those hosts/services without reconfiguring each one individually? This is a standard license Nagios XI 2014R2

Re: Removing contacts from Notifications

Posted: Wed Aug 13, 2014 3:28 pm
by tmcdonald
There's a feature in the Enterprise Edition called Bulk Modifications that will do just that. You can start a free 60-day trial, fully featured if you are interested.

The tool is located under the CCM, in the Tools sidebar section. You'll see the option to remove a contact.

Re: Removing contacts from Notifications

Posted: Wed Aug 13, 2014 3:30 pm
by akepley
Under my License Information it says:

Enterprise Features: Trial Expired. Learn more about upgrading to Enterprise Edition.

This trial must have been used before I started working with the system.

Re: Removing contacts from Notifications

Posted: Wed Aug 13, 2014 5:01 pm
by abrist
Well, you can:
1. Remove them by hand
2. Upgrade to Enterprise
3. Write a query.

Re: Removing contacts from Notifications

Posted: Thu Aug 14, 2014 5:40 am
by akepley
I'm interested in more info on the query. Do I just query the mysql database directly? I haven't entered the Nagios database before and am curious about what tables I would need to look for.

Re: Removing contacts from Notifications

Posted: Thu Aug 14, 2014 5:25 pm
by abrist
I would suggest looking at the tables: nagiosql.tbl_host and nagiosql.tbl_service, specifically the "contacts" column.

Re: Removing contacts from Notifications

Posted: Mon Aug 18, 2014 3:42 pm
by akepley
It looks like the contacts fields in these tables are either 0 or 1 which to me means Yes or No. I need to be able to remove some contacts specifically but not all contacts on hosts and services notifications. Are there ways to query that will remove individual contacts from services and hosts?

Re: Removing contacts from Notifications

Posted: Tue Aug 19, 2014 3:31 pm
by abrist
You need to pull the object ids for the service or host object and the id for the contact(s) in question, and then remove the relations between the two ids in the relational tables: tbl_lnk<masterId_type>To<slaveId type> (for example: lnk_ServiceToContact )
WARNING: Backup first! An incorrect update/set/delete can have dire consequences . . . .

Re: Removing contacts from Notifications

Posted: Tue Aug 19, 2014 4:16 pm
by akepley
I'll have a look

Your response was not terrifying in the least ;)

Re: Removing contacts from Notifications

Posted: Wed Aug 20, 2014 9:56 am
by akepley
After looking over, I think the following would work:

Contact group Test (id 3) needs to be removed from host notifications on all hosts.

delete from tbl_lnkHostToContactgroup where idSlave='3'

I would guess I could then Apply Configuration and it's done?

BTW, I've backed up.