API just to retrun "recordcount" value

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

API just to retrun "recordcount" value

Post by nagwindmon »

Team, a quick question, what parameters do I need to pass or how to formatted following API call to just get current host recordcount but without all host attributes?

curl -XGET "http://nagiosserver/nagiosxi/api/v1/obj ... x&pretty=1"
"hostlist": {
"recordcount": "12788",
"host": [
{
"@attributes": {
....
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: API just to retrun "recordcount" value

Post by npolovenko »

Hello, @nagwindmon. You can just grep the word "recordcount".
[root@centos7x64 conf]# curl -s -XGET "http://192.168.3.3/nagiosxi/api/v1/obje ... c&pretty=1" | grep "recordcount"
"recordcount": "4",
Would this work?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: API just to retrun "recordcount" value

Post by nagwindmon »

yep, that would do it, thanks!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: API just to retrun "recordcount" value

Post by npolovenko »

@nagwindmon, No problem. I will be closing this thread but feel free to open a new one if anything else comes up.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked