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.
API Call for number of services
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Call for number of services
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
in
nagioscore -> activeservicechecks -> val15
This is the number of checks performed in the last 15 minutes
Re: API Call for number of services
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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Call for number of services
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
If you do not want to return the whole API calls you can add the following to the URL
Code: Select all
&totals=1-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Call for number of services
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
Code: Select all
&should_be_scheduled=1Re: API Call for number of services
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,
Thanks,
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Call for number of services
It means that active checks haven't been disabled