Page 1 of 1
API to enable services
Posted: Fri Sep 27, 2019 7:18 am
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
Re: API to enable services
Posted: Fri Sep 27, 2019 11:28 am
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.
Re: API to enable services
Posted: Fri Sep 27, 2019 11:33 am
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.
Re: API to enable services
Posted: Mon Sep 30, 2019 2:30 am
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

).
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
Re: API to enable services
Posted: Mon Sep 30, 2019 11:08 am
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/
Re: API to enable services
Posted: Tue Oct 01, 2019 4:26 am
by mon-team
Thanks,
i'll try immediately the minor release when it'll become available, thanks!
Re: API to enable services
Posted: Tue Oct 01, 2019 10:12 am
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.