rest api service check creation add template param

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
doneil326
Posts: 82
Joined: Fri Aug 14, 2015 3:26 pm

rest api service check creation add template param

Post by doneil326 »

i would like to know if it is possible to use the restapi to create a service and attach it to a template so that i don't have to pass all parameters. something like the below but with a template so that the numerous service checks i am creating have inherited settings, it seems like this should work but it sets the options to 0 or disabled that are ''. Also, how do i get the service name to match the service_description instead of the host_name?

"host_name=#{host_name}&service_description=dev-oracle-query-dw-#{param_row['SUBJECT_AREA']}-#{param_row['SESSION_NAME']}&"\
"check_command=check_ll_oraclequery_dw_batch_single_lldwd_app\!#{param_row['SUBJECT_AREA']}\!#{param_row['SESSION_NAME']}&check_interval=''&retry_interval=''&max_check_attempts=''&check_period=''&contacts=''&notification_interval=''&notification_period=''&use=ll_oraclequery_service_prod_15_min&applyconfig=1"
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: rest api service check creation add template param

Post by Box293 »

Currently this is not possible.

The API wants you to define the variables even though the template includes them.

We have a feature request #7028 pending for this and I will also link this forum thread to the feature request.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
doneil326
Posts: 82
Joined: Fri Aug 14, 2015 3:26 pm

Re: rest api service check creation add template param

Post by doneil326 »

Is there a way to change the service name when it is created so it doesn't match the hostname?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: rest api service check creation add template param

Post by Box293 »

Unfortunately not at this point in time.

I created a feature request for this, TASK ID 7101.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
doneil326
Posts: 82
Joined: Fri Aug 14, 2015 3:26 pm

Re: rest api service check creation add template param

Post by doneil326 »

Thank you for answering my questions. Please close this loop.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: rest api service check creation add template param

Post by tmcdonald »

Unlocking at the request of @Box293 who said he had some additional input.
Former Nagios employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: rest api service check creation add template param

Post by Box293 »

Box293 wrote:Currently this is not possible.

The API wants you to define the variables even though the template includes them.

We have a feature request #7028 pending for this and I will also link this forum thread to the feature request.
@BanditBBS messaged me as he has some info I did not know about.
BanditBBS wrote:It is possible to use the use= to use a template and use the force=1 so it doesn't require all fields!
For example:

Code: Select all

curl -XPOST "http://xitest/nagiosxi/api/v1/config/service?apikey=7gobcg3s&pretty=1" -d "host_name=test_host&service_description=PINGxxxx&use=template_ping_service&force=1&applyconfig=1"
However there was not a way to define the service name.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked