How to detect if 'Apply Config' has failed?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

How to detect if 'Apply Config' has failed?

Post by MrWoodward »

Currently, my team is leveraging the NagiosXI REST API to get a lot of our work done programmatically. Lately, we've been using it to add Hosts and Services in bulk. After adding the Hosts/Services, we call the "apply config" API and it theoretically applies the configuration.

Currently, we can check the status thru the GUI and even check the 'View Command Output' to see why it failed.

Unfortunately, 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 or not and why?

Thanks.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: How to detect if 'Apply Config' has failed?

Post by cdienger »

prior to applying changes, check the process_id with:

http://w.x.y.z/nagiosxi/api/v1/system/s ... y&pretty=1

The process_id will update when the configuration is successfully applied.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

Re: How to detect if 'Apply Config' has failed?

Post by MrWoodward »

Ok, I'll test this out and get back to you.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: How to detect if 'Apply Config' has failed?

Post by cdienger »

Sounds like a plan! Let us know how it works out for you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

Re: How to detect if 'Apply Config' has failed?

Post by MrWoodward »

From my testing, when the config is successfully applied, a new process is started and thus a new process ID is listed. When it fails, the process does not restart nor does the process ID change.

So how can I tell when it has failed? No other flags are listed as "failed" or anything of that nature. Also, presumably, I'll have to poll this API call until I see a change or it passes a timeout, but how long do I need to poll for?

Also, how to I obtain the "error log" of why the apply failed?

Thanks.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How to detect if 'Apply Config' has failed?

Post by ssax »

I've reached out to the developers to see if they have any ideas, if you don't hear from us by mid-day tomorrow respond to the thread so it pops up on our dashboard.

Thank you
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

Re: How to detect if 'Apply Config' has failed?

Post by MrWoodward »

*nudge*

Any updates on this?

Thanks.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: How to detect if 'Apply Config' has failed?

Post by dwhitfield »

The devs are certainly aware of the issue. I don't know if there will be a 5.4.5, but either there or in 5.5.0 would be the first place you might see it. There is no release date set yet for 5.5. I would say mark your calendar for Sept 1, and if there isn't anything about this in the 5.5.0 changelog or 5.5.0 isn't out, then we can give you an update.
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

Re: How to detect if 'Apply Config' has failed?

Post by MrWoodward »

Well, good news, bad news, okay news.

It's good that the devs know it and are planning a fix; bad news that it is so far out; okay news because I've figured out a work-around.

Our code will run on the Nagios instance itself, so it should be able to monitor /usr/local/nagiosxi/nom/checkpoints/nagioscore and /usr/local/nagiosxi/nom/checkpoints/nagioscore/error subdirectories and if a new file shows up in one or the other, then it should be easy to determine whether it was successful or failed and why (since the logs are text files in the same folder.)

Thanks for the help. You can close this ticket.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: How to detect if 'Apply Config' has failed?

Post by dwhitfield »

No problem. As far as I understand it, the chief concern among the devs was making sure the right apply config status was showed. Like, if someone applied the config from UI or the command line, they didn't want to display *that* failure.

I don't anticipate 5.5.0 will be *that* far out, but it partially depends on if there is a 5.4.5. 5.2 went up to .9 while 5.3 only went up to .4. Listing the variables would be a pretty boring read. I suppose I should have said once you see the 5.5.0 changelog you should post back in here, but hard to set a calendar entry for an unknown date, so I picked what I suspect is a safe date.

All of that said, locking it up.
Locked