API host record incomplete

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
markmerchant
Posts: 65
Joined: Tue Oct 17, 2017 8:38 am

API host record incomplete

Post by markmerchant »

Desc:
The host record returned from the API is incomplete. There are several required
fields missing. Most notably, contacts, check_period, etc. How do I discover those
using the API?

Thx.

Keywords:
nagios xi api get host object

Code: Select all

curl --insecure -XGET "http://<naghost>/nagiosxi/api/v1/objects/host?apikey=<longkey>&host_name=hostxxx&pretty=1"

{
    "hostlist": {
        "recordcount": "1",
        "host": {
            "@attributes": {
                "id": "907"
            },
            "instance_id": "1",
            "host_name": "hostxxx",
            "is_active": "1",
            "config_type": "1",
            "alias": "City, ST",
            "display_name": "hostxxx",
            "address": "hostxxx.xxx.com",
            "check_interval": "5",
            "retry_interval": "1",
            "max_check_attempts": "3",
            "first_notification_delay": "0",
            "notification_interval": "0",
            "passive_checks_enabled": "1",
            "active_checks_enabled": "1",
            "notifications_enabled": "1",
            "notes": "",
            "notes_url": "",
            "action_url": "",
            "icon_image": "",
            "icon_image_alt": "",
            "statusmap_image": ""
        }
    }
}
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: API host record incomplete

Post by npolovenko »

Hello, @markmerchant. Some of the fields are not yet available. Many API features are getting added to the XI in version 5.5. Also, have you tried JSON CGIs?

Code: Select all

Navigate to this link:
http://<naghost>/nagios/jsonquery.html
Then you'd select in CGI -> Object JSON CGI
Query -> host
Select the hostname
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
markmerchant
Posts: 65
Joined: Tue Oct 17, 2017 8:38 am

Re: API host record incomplete

Post by markmerchant »

Code: Select all

http://<naghost>/nagios/jsonquery.html
looks much more promising, I may be able to use that. Thx.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: API host record incomplete

Post by npolovenko »

@markmerchant, You're welcome.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked