Dear all,
i'm using the Nagios XI API on a Nagios XI 5.5.1.
I'm focusing on services creation and update: i've noticed that using the "config/service" endpoint i cannot specify an optional Service Template.
I've workarounded this limitation using the raw import ("config/import").
However now i've a problem: if i want to change the service's Service Template i can't do it: the "config/import" doesn't allow me to update this field, and if i use the raw import Nagios creates a second services (with the service template updated).
What would you suggest?
Why the ""config/service" endpoint doesn't allow to specify such a fundamental object like the service template?
Do you know if, in the future releases, this will be allowed?
Regards
Francesco
API on service update
Re: API on service update
You can use the PUT commands to update parameters using the API. For example,
The name use doesn't make a lot of sense from a pure API standpoint. But the reason that parameter is named that way is because use is the field in the configuration files to define templates, for hosts and services.
You can also specify use when creating your services and hosts with POST.
Code: Select all
curl -XPUT "http://<MyXIAddress>/nagiosxi/api/v1/config/service/localhost/PING?apikey=<MyAPIKey>&pretty=1&use=<NewServiceTemplate>&display_name=PINGTEST&applyconfig=1""You can also specify use when creating your services and hosts with POST.
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: API on service update
Thanks for the reply,
you are right.. i read again the 'Help' section about API, and it's written exactly this...even if in a very small font
All normal service directives are able to be used like normal core config definition files.
I'm now able to create services with a service template!
you are right.. i read again the 'Help' section about API, and it's written exactly this...even if in a very small font
All normal service directives are able to be used like normal core config definition files.
I'm now able to create services with a service template!
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API on service update
Great!mon-team wrote:Thanks for the reply,
you are right.. i read again the 'Help' section about API, and it's written exactly this...even if in a very small font![]()
All normal service directives are able to be used like normal core config definition files.
I'm now able to create services with a service template!
Locking thread