Changing configuration directives for huge services list

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Changing configuration directives for huge services list

Post by TSCAdmin »

Hello again,

We are using Nagios XI 2009R1.3 and monitoring over 5000 services. We have used configuration wizards to add new hosts. The configurations looks like the following:

Code: Select all

define service {
        host_name                       hostxyz.example.com
        service_description             Disk Monitor
        use                             xiwizard_windowsserver_disk_service
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        notification_interval           60
        contacts                        nagiosadmin,servicenow
        _xiwizard                       dh_windows_server
        register                        1
        }
Now it is being decided to change check_interval from 5 to 60 minutes. Is there an easy to way to change this directive for all 5000 services?

--------------------

It seems the wizard doesn't honour the directives in the templates. The template xiwizard_windowsserver_disk_service has check_interval set to 60 but when I add disk monitor service to any host it will have the same configuration as above.

The snippet below is from php file which has code for dealing with disk checks

Code: Select all

case "disk":
	$objs[]=array(
		"type" => OBJECTTYPE_SERVICE,
		"host_name" => $hostname,
		"service_description" => "Disk Monitor",
		"use" => "xiwizard_linuxserver_disk_service",
		"_xiwizard" => $wizard_name,
	);

break;
Is that a bug (feature)? Any help is appreciated. Thanks
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Changing configuration directives for huge services list

Post by mguthrie »

If the check_interval is specified in all 5000 services, then that setting will override the template. I think you're correct in that the wizard specifies the 5mn check_interval for each service, and for your particular situation it's better to have this as a template setting. Normally I'd say this part of the wizard is a 'feature', but for your situation it's working against you.

If that's the case, then for a mass change like this you'll probably want to do an SQL query to change all of the selected services that you want. If you want I can see if we can come up with a statement that will work for you, or if you know any SQL guru's they can probably do this in about 2 minutes. Here's the DB info you'd need.

In MySQL -> Database: nagiosxi -> Table: tbl_service -> Field: check_interval

If you guys end up coming up with the query for this, go ahead and post it, we might try and make a script tool for mass changes like this.
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Changing configuration directives for huge services list

Post by TSCAdmin »

Brilliant input. I would love to give it a try but I have another question please.

I wrote a little query for this and tried changing the value for a single host, it seems to work but it's not reflected in the conf file on the disk. How do I sync them both?

Thanks
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Changing configuration directives for huge services list

Post by mguthrie »

Once you change it in the database, all you'd have to do is either use the Write Config Tool, or Apply Configuration, and it should sync up the files.
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Changing configuration directives for huge services list

Post by TSCAdmin »

Wow, that really worked. All I had to do is:

Login to the mysql prompt

Code: Select all

mysql> use nagiosql;

mysql> update tbl_service set check_interval=60 where service_description='Disk Monitor';

mysql> select config_name, service_description, check_interval from tbl_service where service_description='Disk Monitor';
and then use Write Config tool to sync the changes to configuration files on disk.

I appreciate your support mguthrie. Cheers :)
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Changing configuration directives for huge services list

Post by mguthrie »

Awesome, glad that worked for you! Thanks for posting what you did as well, I tested it on my machine for a different change and it also worked like a charm. I posted the example to our wiki since there have been other situations where people needed to make a change like this.

http://support.nagios.com/wiki/index.ph ... In_The_CCM
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Changing configuration directives for huge services list

Post by TSCAdmin »

Thank you ever so much :)
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Changing configuration directives for huge services list

Post by rdedon »

Please feel free to contact us again if you require any additional assistance, we will be glad to help! :-)
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
Locked