[API] Create Service Template

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Maxwellb99
Posts: 97
Joined: Tue Jan 26, 2016 5:29 pm

[API] Create Service Template

Post by Maxwellb99 »

Hi,

Is there a way to create a service template via the API? I tried to throw the register 0 flag on there but that just sets it to inactive.

Thanks,
Maxwell Ramirez
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: [API] Create Service Template

Post by jomann »

Service templates are special in the CCM so we currently don't support them. It's a feature request that will be in newer versions of XI. However, for the time being you can use config/import to import a full service template definition like:

Code: Select all

curl -XPOST "http://xiserver/nagiosxi/api/v1/config/import?apikey=apikey&pretty=1" -d '
define service {
    name                            test-service
    use                             generic-service
    max_check_attempts              4
    check_interval                  5
    retry_interval                  1
    register                        0
}'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Maxwellb99
Posts: 97
Joined: Tue Jan 26, 2016 5:29 pm

Re: [API] Create Service Template

Post by Maxwellb99 »

Tracking. Thank you.

Is create contact coming down the pipe? I'm having to do a similar import object to create contacts.

Thanks,
Maxwell Ramirez
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: [API] Create Service Template

Post by jomann »

Yup, the contact creation via the API is also on the roadmap. It should be available in 5.6.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked