how to fetch NagiosXI Host and Service Status in user script

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

how to fetch NagiosXI Host and Service Status in user script

Post 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
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: how to fetch NagiosXI Host and Service Status in user sc

Post 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]
Previous Nagios employee
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to fetch NagiosXI Host and Service Status in user sc

Post 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"
Former Nagios Employee
Locked