Bulk modification for 'contact options', via db is possible?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Bulk modification for 'contact options', via db is possible?

Post by mon-team »

Hi everybody,
I have to modify a lot of services (more than 1000) in order to change the 'contact options' under the tab 'Alert settings' --> 'Manage contacts'.
The goal is to activate the option '+', so that the notification contacts inserted in the Service template will be added (and not overrided) by the contact present in the service definition.

From some tests i've made this config seems to be stored a database, but i've not been able to identify the right table/field.
Do someone know where this configuration is stored?

Regards,
Francesco
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Bulk modification for 'contact options', via db is possi

Post by lmiltchev »

I would not recommend modifying objects directly, via db queries. This is not a supported option. However, it should be very easy to perform these actions via the "Bulk Modifications" tool. It is part of the Nagios XI Enterprise edition, but even if you didn't have Enterprise, you could start a 60-day, free, fully-functional trial of Enterprise features, and get the job done.
example01.PNG
Go to the CCM->Tools->Bulk Modifications->Add Contact(s)->Select a contact->Select Services->Select all of the services you need to add this contact to, select the "+" radio button (for additive inheritance option), click on "Add Selected", "Close", "Save Changes", and apply configuration.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: Bulk modification for 'contact options', via db is possi

Post by mon-team »

Hi lmiltchev,
thanks for the interesting information, this is yet a step further!
But i'm trying to reduce the working time as much as possible, and selecting more than 1000 services reading them from an excel file is still a quite boring job :shock:
Also because probably i'll have to repeat this work still a few times! :x
I have a test server and a backup of the whole database and configuration files however, do you know the way to modify these settings at database? or where could i read something related to my issue...
Perhaps could i find a script?

Regards,
Francesco
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Bulk modification for 'contact options', via db is possi

Post by hsmith »

I've spent some time this morning looking at the structure of the Database, and it looks like there's no simple way to replace 'A' with 'B' using a query, if that makes sense. You may want to consider making changes to your flat files using a script, and then using the 'import' directory to import them. Let me know if any of that is unclear.
Former Nagios Employee.
me.
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: Bulk modification for 'contact options', via db is possi

Post by mon-team »

Ok,
thanks for your support.
I've tried via 'Bulk modification' command, but following the steps you wrote i can add contact to several services, but in the tab i've no possibility to select the '+' options, it's not present.
The 'Bulk modification tool' version is the 1.2.3.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Bulk modification for 'contact options', via db is possi

Post by gormank »

To add to what hsmith mentioned, the OP could create a service template w/ the contact info, then add the template definition to tiny service files with the same names as those to update, then import.
Now the updated contact info exists in a single location and can be updated for all services easily. Combine templates and hostgroups, and instead of lots of similar services, you have a smaller number to manage. It would take some effort to convert though...

Here's an example of a service containing no info other than that needed to define the service. Host info is in hostgroups, and monitoring/contact info is in a template.

Code: Select all

define service {
        service_description             Proc_Win_Antivirus
        use                             default_service
        hostgroup_name                  Windows_Physical,Windows_Virtual
        display_name                    McAfee Antivirus services
        check_command                   check_xi_service_nsclient!xxxx!SERVICESTATE!-l macmnsvc,masvc,McAfeeFramework,McShield,McTaskManager,mfemms,mfevtp -d SHOWALL!!!!!
        _xiwizard                       windowsserver
        register                        1
        }
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Bulk modification for 'contact options', via db is possi

Post by lmiltchev »

Another possible solution, which will require some scripting knowledge is described here:

https://assets.nagios.com/downloads/nag ... gement.pdf

As far as the "Bulk Modifications" tool component - the "additive" option is available in Version: 2.0.3 (present in Nagios XI 5.2.3). What is the version of XI that you are currently using?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked