Where is configuration for disabled services stored?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
moisesjbc
Posts: 5
Joined: Mon Jul 11, 2016 2:52 am

Where is configuration for disabled services stored?

Post by moisesjbc »

Hello

I would like to retrieve configuration data from disabled services (hostgroups, servicegroups, check command, etc). Where is it stored and how could I access it?

Thank you!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Where is configuration for disabled services stored?

Post by rkennedy »

In Core, generally disabled hosts / services simply aren't rendered as running. If they're set to register 0, then they will be registered as templates and not actively checked. The real option to 'disable' them in my mind, would be to simply move the configuration files out.

Are your disabled using the register 0 flag currently?

If so, something like this would help to see - grep -R 'register' /usr/local/nagios/etc/ | grep '0'
Former Nagios Employee
moisesjbc
Posts: 5
Joined: Mon Jul 11, 2016 2:52 am

Re: Where is configuration for disabled services stored?

Post by moisesjbc »

Moderator Edit: This thread has been moved from the Core section to the XI section

Sorry, maybe I explained it badly

I want to get from bash the configuration of every service configured, no matter it is enabled or disabled, for documentation porpuses. For enabled services I just parse the files in /usr/local/nagios/etc/services. The problem is with the disabled ones, because once disabled from Core Config Manager (*), their configuration are removed from /usr/local/nagios/etc/services but it must be saved elsewhere because they still appear in web interface.

I disabled "Current Load" service and tried to look for it in the database. I found an instance in nagios database, but I don't know where to search the rest of the configuration (hostgroups associated to that service, servicegroups, etc)

mysql> SELECT * FROM nagios.nagios_objects WHERE object_id = 146;
+-----------+-------------+---------------+-----------+--------------+-----------+
| object_id | instance_id | objecttype_id | name1 | name2 | is_active |
+-----------+-------------+---------------+-----------+--------------+-----------+
| 146 | 1 | 2 | localhost | Current Load | 0 |
+-----------+-------------+---------------+-----------+--------------+-----------+

(*) I forgot to mention that I am using NagiosXI with a free license. Sorry if I posted this on the wrong forum.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Where is configuration for disabled services stored?

Post by avandemore »

As you found out, disabled objects aren't stored in flat file in Nagios XI. They are in the DB, however providing the type of DB research you are seeking is beyond what is generally covered by support.

In order to make it easier to reverse engineer this there are several things you can do. First you can turn MySQL settings on to log every query. You could also use something like MySQL Workbench to visualize the data and it's relations.

However you may have an easier time of it using the REST API.

Using GET objects/hostgroupmembers and it's data you can parse GET objects/hoststatus and get the info you desire.
Previous Nagios employee
moisesjbc
Posts: 5
Joined: Mon Jul 11, 2016 2:52 am

Re: Where is configuration for disabled services stored?

Post by moisesjbc »

I will try that.

Thank you so much!
moisesjbc
Posts: 5
Joined: Mon Jul 11, 2016 2:52 am

Re: Where is configuration for disabled services stored?

Post by moisesjbc »

Sending a GET request to "service" endpoint only returns activated services (is_active=1). Is this the expected behaviour?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Where is configuration for disabled services stored?

Post by avandemore »

I created FR 10528 for this.

In the meantime, you can try the JSON query as well:

http://<YOUR HOST>/nagios/jsonquery.html

But the real answer to your question is that this will probably never be implemented. Inactive objects are evaluated at start time and skipped, so there simply is no way to glean that information without largely changing the structure of the application. I mean you could write some type of read-only scraper which polled the info but that would be a lot of tedious work.
Previous Nagios employee
moisesjbc
Posts: 5
Joined: Mon Jul 11, 2016 2:52 am

Re: Where is configuration for disabled services stored?

Post by moisesjbc »

Well, I think it is time to have fun with MySQL :-P

Thank you so much for the help
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Where is configuration for disabled services stored?

Post by avandemore »

Sounds good, good luck.
Previous Nagios employee
Locked