xi API to Create a service using blank/null values for some

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
dh0125e
Posts: 40
Joined: Tue Aug 04, 2020 9:30 am

xi API to Create a service using blank/null values for some

Post by dh0125e »

I am trying to use the xi API to create services that rely upon service templates to provide values for items like max check attempts, notification timesframe and other mandatory values in the API for the service definition.

I've tried not listing the items in the REST call and it's rejected for missing items. I've tried providing the None value as part of the python object definition for the paylog which python is properly interpreting to null, but Nagios refuses to apply the service and puts invalid values in the fields. I've tried just doing '' so they are sent over as blank strings. None of the above work.

How can I get Nagios to allow me to submit empty values for the following and use the values that are inherited from the service template via the use parameter which IS properly relating the new service to an existing service template? This is entirely possible via the UI and is working correctly.

'check_interval': None,
'retry_interval': None,
'max_check_attempts': None,
'check_period': None,
'contacts': None,
'notification_interval': None,
'notification_period': None,
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: xi API to Create a service using blank/null values for s

Post by jdunitz »

If you add force=1 to the parameters to bypass the verification, it should do what you want.

https://assets.nagios.com/downloads/nag ... gement.pdf

(search for "force=1" in the document, and you'll find it)


--Jeffrey
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!
dh0125e
Posts: 40
Joined: Tue Aug 04, 2020 9:30 am

Re: xi API to Create a service using blank/null values for s

Post by dh0125e »

THANK YOU! I did not see a force parameter available on the online version of the help in the xi UI. I will update my python shortly and give this a whirl.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: xi API to Create a service using blank/null values for s

Post by benjaminsmith »

THANK YOU! I did not see a force parameter available on the online version of the help in the xi UI. I will update my python shortly and give this a whirl.
Sounds good.

Let us know if you need anything else.
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!