Page 1 of 1
how to fetch NagiosXI Host and Service Status in user script
Posted: Thu Nov 03, 2016 3:58 am
by zaji_nms
Dear Expert
To check any Host Status / Service Status , we can check in the script via SNMPGET/SNMPWALK, however we want to use NagiosXI status in our script. Can you please provide any link/document giving in detail.
Regards
Re: how to fetch NagiosXI Host and Service Status in user sc
Posted: Thu Nov 03, 2016 9:21 am
by avandemore
Are you talking about the status of Nagios XI itself?
If so you can use the API available from XI > Help
For example this should show XI status:
[url]http://<Your%20XI%20System>/nagiosxi/api/v1/system/status?apikey=0on2obamni8i6f3ub8klccmgtank4r64js6a7dtrs5d2idtqjhdsr3cmc38dregf&pretty=1[/url]
Re: how to fetch NagiosXI Host and Service Status in user sc
Posted: Thu Nov 03, 2016 9:23 am
by rkennedy
To add to what @avandemore mentioned -
I believe what you're looking for can be achieved with the API. Take a look at the Help -> Objects Reference page, this outlines how to use the API to poll for information. The status_text variable is displayed as well here.
On my system, for hosts, I would use this -
Code: Select all
curl -XGET "http://192.168.3.115/nagiosxi/api/v1/objects/hoststatus?apikey=32klfcka&pretty=1"
Or, for services -
Code: Select all
curl -XGET "http://192.168.3.115/nagiosxi/api/v1/objects/servicestatus?apikey=32klfcka&pretty=1"