Page 1 of 1
Bulk modification for 'contact options', via db is possible?
Posted: Thu Feb 11, 2016 10:42 am
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
Re: Bulk modification for 'contact options', via db is possi
Posted: Thu Feb 11, 2016 11:11 am
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.
Re: Bulk modification for 'contact options', via db is possi
Posted: Fri Feb 12, 2016 3:18 am
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
Also because probably i'll have to repeat this work still a few times!
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
Re: Bulk modification for 'contact options', via db is possi
Posted: Fri Feb 12, 2016 10:57 am
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.
Re: Bulk modification for 'contact options', via db is possi
Posted: Mon Feb 15, 2016 3:34 am
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.
Re: Bulk modification for 'contact options', via db is possi
Posted: Mon Feb 15, 2016 12:14 pm
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
}
Re: Bulk modification for 'contact options', via db is possi
Posted: Mon Feb 15, 2016 12:40 pm
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?