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
passing $ARG1$ / $ARG2$ values to service when creating
-
lukesullivan
- Posts: 34
- Joined: Tue Jan 24, 2017 11:12 am
Re: passing $ARG1$ / $ARG2$ values to service when creating
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.
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!