passing $ARG1$ / $ARG2$ values to service when creating
Posted: Tue Dec 18, 2018 4:48 pm
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
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