API to enable services

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 to enable services

Post by mon-team »

Dear all,
is it possible to enable via API a service, yet configured, but actually in disabled state?
I didn't find anything..

Regards
Francesco
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: API to enable services

Post by benjaminsmith »

Hi Francesco,

It looks like that is not possible from the API ( likely due to dependencies when deactivating hosts or services). If you want to put the host and service in a disabled state, you can simply turn off active or passive checks.

For example, to turn off active checks for a service:

Code: Select all

curl -XPUT "http://<ip address>/nagiosxi/api/v1/config/service/localhost/PING?apikey=<key here>&pretty=1&active_checks_enabled=0&applyconfig=1"
Let me know if that would meet your requirements.
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!
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: API to enable services

Post by benjaminsmith »

Hi Francesco,

Just learned that we do have a feature request submitted for activating and deactivating hosts/services from the API. While this has been submitted, the decision to implement the enhancement is up to the development team.
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!
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: API to enable services

Post by mon-team »

Hi Benjamin,
thanks for your reply. Yes, you are right, i could put in 'off' the active and passive field.. but this is more a workaround.
Instead my need is to enable hosts and services which are disabled.

This is quite important if you are trying to automate Nagios XI.
I'll wait the feature to be developed ( I hope :D ).

By the way, actually there is not a specific API to know if a service is enabled or disabled. I think the two API should be developed togheter in order to be really useful.
In particular, at the moment if you ask the configuration for an active service you get back a response. The problem is that if you ask for a service that is disable or which does not exist the response is very similar (i found a workaround for services but not for hosts). So basically it's impossible to understand if a service or host is simply disabled or does not exist.
This feature also in very important if your goal is automation.
I hope my feedback could help.

Francesco
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: API to enable services

Post by benjaminsmith »

Hi Francesco,

Appreciate the feedback and I've updated the FR request with your input. While I don't know the final specifications of the feature, the good news is that this has been approved for the next minor release of Nagios XI.

You can follow the product roadmap on this page.

https://www.nagios.com/roadmaps/
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!
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: API to enable services

Post by mon-team »

Thanks,
i'll try immediately the minor release when it'll become available, thanks!
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: API to enable services

Post by benjaminsmith »

Hello,

Your welcome. I'll go ahead and close this thread. If you have any new questions, please feel free to open another.
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