passing $ARG1$ / $ARG2$ values to service when creating

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lukesullivan
Posts: 34
Joined: Tue Jan 24, 2017 11:12 am

passing $ARG1$ / $ARG2$ values to service when creating

Post by lukesullivan »

I'm creating services from a template using the rest api. An example of the payload I'm sending via http/post is:

payload = {'host_name' : devname,
'service_description': str(service['display_name']) + '--- interface counters',
'servicegroups' : 'huit-its-interface-counters',
'use' : 'huit-its-network-device-interface-counters',
'arg2' : str(ifIndex),
'force' : 1
}

The service template has a check_command of:

/usr/local/nagios/libexec_custom/check_ifcounters.py -hostname $HOSTADDRESS$ -previousperfdata "$SERVICEPERFDATA$" -snmpcomstring $ARG1$ -ifindex $ARG2$

the $ARG1$ value is supplied by the template, as it's the same for all the services being created, but the $ARG2$ value is different for each service.

is there a way in the http/post method to specify $ARG2$ for a specific service being created?

thanks,

-Luke
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: passing $ARG1$ / $ARG2$ values to service when creating

Post by tgriep »

In the API, there is not a way to just pass in the value for one of the Arguments, you will have to pass in the full command and all of the arguments in the API call.
The command and the arguments in the API call are grouped together so there is not a way to do that.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked