Endpoint to test a Service Check on a Host
It is possible to run a test service check to check if the arguments supplied to a plugin will work during the configuration of a host.
URL: /rest/config/host/testservicecheck
Method: GET or POST
Input URL parameters:
- scid - this is the service check id number. Required
- args - the arguments to test. Required. Note that some characters will throw an error:
$(
or any of;|&\n<>[]{}\
- also an audit log entry will be created to log the error. - monitored_by - the id of the monitoring server to run the test service check from. If not specified, will use the primary monitoring cluster.
- hostid - the id of the host, if applicable. Some passwords will be retrieved from the database if required.
- snmp_version - SNMP information
- snmp_port
- snmp_community
- snmpv3_username
- snmpv3_authpassword
- snmpv3_authprotocol
- snmpv3_privprotocol
- snmpv3_privpassword
Output:
A successful execution will return:
{
"command" : "check_snmp_sysinfo -H '127.0.0.1' -t 5 -v '3' -U 'user3' -P XXauthpasswordXX -a \"md5\" -e 'des' -x XXprivpasswordXX",
"monitored_by" : "master",
"return_code" : "0",
"stderr" : "",
"stdout" : "Status is OK - SYSTEM: debian7 CONTACT: Joe Bloggs LOCATION: Reading, UK, IN SNMP AGENT: .1.3.6.1.4.1.8072.3.2.10 Linux debian7 3.2.0-4-686-pae #1 SMP Debian 3.2.57-3 i686\n"
}
Note that passwords will be cleansed of the actual value.
An audit log entry will be made on successful execution.
An error will return a status code of 400 with an error message.