Hello Team,
I am reading data from status.dat file by converting it to JSON file and render that data in separate UI. Now I need Host IP but I am not getting that in status.dat file, so can you help me in that?
Need Host IP in status.dat file
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need Host IP in status.dat file
This isn't in the status.dat
I would recommend using the JSON query API
select OBJECT JSON API
select hostlist
select True for "Show Details"
This will give you a URL like this
Then the address field for each host has what you are looking for
I would recommend using the JSON query API
Code: Select all
/nagios/jsonquery.html
select hostlist
select True for "Show Details"
This will give you a URL like this
Code: Select all
http://YOUR_NAGIOS_HOST/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true
Re: Need Host IP in status.dat file
Thanks, it works.
But I need to call that URL from my PHP script. When I am calling it gives an unauthorized error. So pls help me in that
But I need to call that URL from my PHP script. When I am calling it gives an unauthorized error. So pls help me in that
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need Host IP in status.dat file
You would need to add your credentials to the call in your PHP script.anjali wrote:Thanks, it works.
But I need to call that URL from my PHP script. When I am calling it gives an unauthorized error. So pls help me in that
On some systems you may be able to do this by changing the URL to
Code: Select all
http://USERNAME:PASSWORD@YOUR_NAGIOS_HOST/nagios/cgi-bin/objectjson.cgi?query=hostlist&details=true
Re: Need Host IP in status.dat file
Thanks, it works.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need Host IP in status.dat file
Great!anjali wrote:Thanks, it works.
Locking thread