Query to retrieve services tied to a host

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
brdr
Posts: 312
Joined: Mon Jun 02, 2014 12:49 pm

Query to retrieve services tied to a host

Post by brdr »

Morn,

We have XI 2014R2.7.

We are restructuring the way we do services checks. We are just about completed and i would like to run a query against the database that returns the number of services tied to each host. We have approx 1,500 hosts (windows,linux). We have a specific number of service checks for each type of hosts and need to confirm that each has this number of checks. To do this via the XI Gui we take for eva'.

Could you help?

Thx
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Query to retrieve services tied to a host

Post by ssax »

I've whipped up a quick script for you, download the attached file, unzip it, and place it on your XI server.

Now go into Admin > Manage Components > Backend API URL > Settings
- Select the nagiosadmin user and click apply settings.
- Under the services URL, copy the entire URL and replace the URL in the file.
api_url_services.png
- Now run the script:

Code: Select all

chmod +x hosts_with_service_count.php
./hosts_with_service_count.php
hosts_with_service_count.zip
You do not have the required permissions to view the files attached to this post.
brdr
Posts: 312
Joined: Mon Jun 02, 2014 12:49 pm

Re: Query to retrieve services tied to a host

Post by brdr »

Awesome. thanks Mr. SSAX. Please close.
Locked