Page 1 of 1
API Call for number of services
Posted: Tue Nov 24, 2020 10:27 am
by dh0125e
Is there an API call that returns just the number of services similar to value you see in the UI when you go to View / Status Detail where it shows the total number of services that are being managed. The statusdetail command as I'm reading the documentation right now is trying to return all of the details about the services from the API which chokes and takes quite a while for a system as large as ours. I'm looking just to get the total record count but I can't find it anywhere in the webservice API.
I'm looking to create a health check to compare that value to the number of services which have been checked in the last 15 minutes. When these two values have a large delta it's an indicator of issues with the infrastructure that require investigation.
Re: API Call for number of services
Posted: Tue Nov 24, 2020 12:15 pm
by scottwilkerson
You can get this in the system/statusdetail API
in
nagioscore -> activeservicechecks -> val15
This is the number of checks performed in the last 15 minutes
Re: API Call for number of services
Posted: Tue Nov 24, 2020 2:52 pm
by dh0125e
That's the number performed, not the number of checks that SHOULD be performed. Comparing that value you've pointed out to the value I'm looking for would allow us to validate the environment is not having issues. I'm looking for the equiv of select count(*) from nagios_servicestatus on the XI database.
Re: API Call for number of services
Posted: Tue Nov 24, 2020 3:22 pm
by scottwilkerson
You can call the
objects/servicestatus or
objects/hoststatus and see the
recordcount field
If you do not want to return the whole API calls you can add the following to the URL
Re: API Call for number of services
Posted: Tue Nov 24, 2020 3:25 pm
by scottwilkerson
Worth noting that this will include all records unless you add other qualifiers to make sure you are only counting things that should be scheduled
there is still going be some grey area depending on frequency of each of the checks, timeperiods, etc
Re: API Call for number of services
Posted: Tue Nov 24, 2020 4:12 pm
by dh0125e
What does should_be_scheduled indicate? When I run a check on totals on our super heavily loaded load testing system I get the same answer from totals=1 and total=1&should_be_scheduled=1.
Thanks,
Re: API Call for number of services
Posted: Tue Nov 24, 2020 4:20 pm
by scottwilkerson
It means that active checks haven't been disabled