Removing contacts from Notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
akepley
Posts: 138
Joined: Wed Sep 11, 2013 1:09 pm

Removing contacts from Notifications

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Removing contacts from Notifications

Post 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.
Former Nagios employee
akepley
Posts: 138
Joined: Wed Sep 11, 2013 1:09 pm

Re: Removing contacts from Notifications

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Removing contacts from Notifications

Post by abrist »

Well, you can:
1. Remove them by hand
2. Upgrade to Enterprise
3. Write a query.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
akepley
Posts: 138
Joined: Wed Sep 11, 2013 1:09 pm

Re: Removing contacts from Notifications

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Removing contacts from Notifications

Post by abrist »

I would suggest looking at the tables: nagiosql.tbl_host and nagiosql.tbl_service, specifically the "contacts" column.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
akepley
Posts: 138
Joined: Wed Sep 11, 2013 1:09 pm

Re: Removing contacts from Notifications

Post 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?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Removing contacts from Notifications

Post 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 . . . .
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
akepley
Posts: 138
Joined: Wed Sep 11, 2013 1:09 pm

Re: Removing contacts from Notifications

Post by akepley »

I'll have a look

Your response was not terrifying in the least ;)
akepley
Posts: 138
Joined: Wed Sep 11, 2013 1:09 pm

Re: Removing contacts from Notifications

Post 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.
Locked