api read host configuration

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

api read host configuration

Post by mon-team »

Hello,
some days ago i wrote a topic, because i was experiencing some issue trying to retrieve the complete configuration for a service. In particular i noticed that using the 'Config' endpoint i could read the Service Template used by the service, but not the inherited parameters.
Using the 'Object' endpoint,instead, i'm able to recover inherited parameters from the Service Template (even if i cannot retrieve the name of the Service Template). Using both of them is possible to retrieve the full service configuration.

I expected the same behavior reading the host configuration, but it's not so. Almost all my hosts use one or more Host Template. Using the Object endpoint i can retrieve only some parameters defined in the HT... check_command, event_handler are not retrieved.

Is this an issue on my Nagios XI platform or a bug?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: api read host configuration

Post by benjaminsmith »

Hi @mon-team,

Those endpoints in the API are retrieving data from separate areas. The Config endpoint is pulling data from the configuration database (nagiosql). This endpoint does not incorporate inheritance.

Try using the hoststatus option in the Objects endpoint. This endpoint is reading Nagios Core statas data and will contain the check command and event handler.

Example

Code: Select all

curl -XGET "http://192.168.23.100/nagiosxi/api/v1/objects/hoststatus?apikey=<insert-here>&host_name=localhost&pretty=1"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked