Page 1 of 1

Define service config_name from REST API

Posted: Mon Jan 01, 2018 10:23 pm
by smcgregor
We're running XI 5.4.9 and trying to set the Config Name field shown in the image below via the REST API
nagus.png
We have a working service creation via API using the following, however the hostname is used as the config_name every time

Code: Select all

/nagiosxi/api/v1/config/service?apikey=####
Using a POST payload of

Code: Select all

'host_name' := 'server.tld'
'service_description' := 'Check thing.service'
'check_command' := 'check_systemctl!thing.service!!!!!!!'
'max_check_attempts' := 3
'check_interval' := 15
'retry_interval' := 5
'check_period' := '24x7'
'contact_groups' := 'oncall_grp'
'notification_interval' := 5
'notification_period' := '24x7'
'notes' := 'Service config created via Puppet'
'force' := 1
'applyconfig' := 1
From some reading through the XI internals we've tried setting config_name as well as _config_name but don't seem to be having much luck.
Is there a parameter we can set to specify the Config Name for a service?

Re: Define service config_name from REST API

Posted: Wed Jan 03, 2018 10:44 am
by npolovenko
Hello, @smcgregor. Unfortunately, you can't assign the config_name via rest API. If you'd like I could put a feature request to add this functionality in the future versions of XI. This feature request may or may not get approved by our dev team.
Also, I don't think this is supported either: 'notes' := 'Service config created via Puppet'.

Re: Define service config_name from REST API

Posted: Wed Jan 03, 2018 4:42 pm
by smcgregor
I would appreciate it. At the moment we're using the description as our unique constraint in Puppet, but the config_name would make a lot more sense if we could use it.

The notes parameter seems very much supported as per the nagioscore documentation for service definitions
notes.png

Re: Define service config_name from REST API

Posted: Wed Jan 03, 2018 5:07 pm
by npolovenko
@smcgregor, Agreed. I was looking at the API reference and didn't see mentioning of 'notes' so I assumed they can't be passed via API. But they can indeed :)
I submitted a feature request on your behalf. You may check back with our technicians in a couple weeks - a month, to see if it was approved and if so we'll provide you with a feature tracking number.

Re: Define service config_name from REST API

Posted: Mon Mar 05, 2018 3:07 pm
by tsquillario
Did "config_name" ever get added as a feature request? I'm trying to automate service adds via the REST API. It sets the config_name to the host_name.

Re: Define service config_name from REST API

Posted: Mon Mar 05, 2018 4:25 pm
by smcgregor
npolovenko wrote: I submitted a feature request on your behalf.
I believe one was made, as to where it was made or how to check up on it no idea.

Re: Define service config_name from REST API

Posted: Tue Mar 06, 2018 3:05 pm
by npolovenko
@smcgregor and @tsquillario, I apologize for the confusion. Generally, we submit feature requests to the special FR pool where they need to get approved. With that said, the feature was indeed approved and should be added in the XI 5.4.13 - XI 5.5. releases.

Re: Define service config_name from REST API

Posted: Tue Mar 06, 2018 4:21 pm
by smcgregor
Excellent!

Thanks for clearing that up.

Re: Define service config_name from REST API

Posted: Tue Mar 06, 2018 4:49 pm
by npolovenko
Not a problem! I will go ahead and lock this thread as resolved.