Page 1 of 1

API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 9:52 am
by nagwindmon
hi Team,
I believe someone has already posted about this but I cant find it... any way apply config has been failing for over a few days...
so how to get our end users notify that update did not take place?
I have found this url on Nagios support site but unable to run it successfully

Verify Config Syntax
URL
http://myNagiosServer/nagioslogserver/i ... token=XXXX
Output:
{"result":"success","output":["Configuration OK"]}

Please advise.

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 2:41 pm
by scottwilkerson
that show correct output, but this command will just verify the syntax, it doesn't apply the config

To apply the config you would need to add &applyconfig=1

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 2:51 pm
by nagwindmon
sorry if I was not clear in my question:
we get no error message when it fails to apply via the REST API.
Is there an API call that we can use to check on the applied config and if it failed (config error) or not and why?

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 3:00 pm
by scottwilkerson
it will return a command_id

That command_id can be polled with something like this where you can see the result_code

Code: Select all

curl -XGET "http://192.168.5.182/nagiosxi/api/v1/system/command?apikey=XXXXXXX&pretty=1"
[
    {
        "command_id": "7330",
        "submitter_id": "18",
        "command": "1100",
        "submission_time": "2018-07-11 14:21:40.379224",
        "event_time": "2018-07-11 14:21:40.379224",
        "processing_time": "2018-07-11 14:21:41.349035",
        "status_code": "2",
        "result_code": "0",
        "result": ""
    },
    {
        "command_id": "7331",
        "submitter_id": "18",
        "command": "17",
        "submission_time": "2018-07-11 14:55:42.59142",
        "event_time": "2018-07-11 14:55:42.59142",
        "processing_time": "2018-07-11 14:55:45.402662",
        "status_code": "2",
        "result_code": "0",
        "result": "Starting nagios: done."
    }
]

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 3:06 pm
by nagwindmon
{
"error": "Unknown API endpoint."
}

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 3:12 pm
by scottwilkerson
What version of XI are you running? I believe this was released with 5.5.0

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 3:14 pm
by nagwindmon
Ours ver is 5.4.4

Re: API Apply config command sent but was not completed

Posted: Wed Jul 11, 2018 3:27 pm
by scottwilkerson
Once upgraded to 5.5.x you should be able to utilize these commands