HTTP post request to create new service with arguments

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
deltares_infracore
Posts: 5
Joined: Thu Feb 11, 2021 6:12 am

HTTP post request to create new service with arguments

Post by deltares_infracore »

Hello,

Currently I am trying to create checks via HTTP POST and I was wondering if it is possible to pass arguments for the check since I don't see any variables for this in the help section. From the help section:
Optional Parameters Value Type
config_name config name (in CCM)
host_name host name
service_description service name
check_command command_name
max_check_attempts #
check_interval #
retry_interval #
check_period timeperiod_name
notification_interval #
notification_period timeperiod_name
contacts or contact_groups contacts or contact_groups
Is there a variable that let's me post arguments for my new check? My payload for the HTTP post will look something like this:

{'check_period': '24x7', 'config_name': 'My new check', 'notification_interval': '5', 'notification_period': '24x7', 'retry_interval': '1', 'check_command': 'My check', 'check_arg1': 'My arguments to the check', 'host_name': 'host.test.com', 'check_interval': '600', 'service_description': 'My new check', 'max_check_attempts': '1'}

Thanks in advance!
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Post by dchurch »

The POST request updates the configuration database, adding a new service.

The arguments to the check command are contained in the "check_command" URL parameter, separated by "!". The parameter is in the form of

Code: Select all

{COMMAND}[!{ARG}]...
For example, sending

Code: Select all

check_command=check_ping!3000,80%!5000,100%
Would set up a service check where:

Code: Select all

command = check_ping
arg1 = 3000,80%
arg2 = 5000,100%
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
deltares_infracore
Posts: 5
Joined: Thu Feb 11, 2021 6:12 am

Re: HTTP post request to create new service with arguments

Post by deltares_infracore »

Thank you!
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: HTTP post request to create new service with arguments

Post by dchurch »

Glad to hear you resolved it!

Let us know if you have any related questions or if we're okay to lock this up and mark it as resolved.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Locked