API Apply config command sent but was not completed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

API Apply config command sent but was not completed

Post 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.
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Apply config command sent but was not completed

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: API Apply config command sent but was not completed

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Apply config command sent but was not completed

Post 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."
    }
]
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: API Apply config command sent but was not completed

Post by nagwindmon »

{
"error": "Unknown API endpoint."
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Apply config command sent but was not completed

Post by scottwilkerson »

What version of XI are you running? I believe this was released with 5.5.0
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: API Apply config command sent but was not completed

Post by nagwindmon »

Ours ver is 5.4.4
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Apply config command sent but was not completed

Post by scottwilkerson »

Once upgraded to 5.5.x you should be able to utilize these commands
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked