Config - Service Checks

Rest API Config endpoint for service checks

Object type: servicecheck

Request URL: /rest/config/servicecheck

Example GET:

{
   "object" : {
      "alert_from_failure" : "5",
      "args" : "",
      "attribute" : null,
      "calculate_rate" : "no",
      "cascaded_from" : {
         "name" : "Interface Poller",
         "ref" : "/rest/config/servicecheck/107"
      },
      "check_attempts" : "5",
      "check_freshness" : "1",
      "check_interval" : "25",
      "check_period" : {
         "name" : "workhours",
         "ref" : "/rest/config/timeperiod/2"
      },
      "checktype" : {
         "name" : "SNMP trap",
         "ref" : "/rest/config/checktype/4"
      },
      "critical_comparison" : null,
      "critical_value" : null,
      "dependencies" : [
         {
            "name" : "Check Swap",
            "ref" : "/rest/config/servicecheck/46"
         },
         {
            "name" : "DHCP",
            "ref" : "/rest/config/servicecheck/3"
         }
      ],
      "description" : "",
      "event_handler" : "",
      "flap_detection_enabled" : "1",
      "freshness_type" : "set_stale",
      "hosts" : [
         {
            "name" : "cisco4",
            "ref" : "/rest/config/host/11"
         },
         {
            "name" : "opsview",
            "ref" : "/rest/config/host/1"
         }
      ],
      "hosttemplates" : [
         {
            "name" : "Network - Base",
            "ref" : "/rest/config/hosttemplate/2"
         }
      ],
      "id" : "79",
      "invertresults" : "0",
      "keywords" : [
         {
            "name" : "cisco",
            "ref" : "/rest/config/keyword/2"
         },
         {
            "name" : "cisco_gp2",
            "ref" : "/rest/config/keyword/4"
         }
      ],
      "label" : null,
      "markdown_filter" : "0",
      "name" : "Coldstart",
      "notification_interval" : null,
      "notification_options" : "w,c,r,u",
      "notification_period" : null,
      "oid" : null,
      "plugin" : null,
      "retry_check_interval" : null,
      "sensitive_arguments" : "1",
      "servicegroup" : {
         "name" : "Operations",
         "ref" : "/rest/config/servicegroup/1"
      },
      "snmptraprules" : [
         {
            "alertlevel" : "1",
            "code" : "\"${TRAPNAME}\" =~ /SNMPv2-MIB::coldstart/i",
            "message" : "Device coldstarted",
            "name" : "Check coldstart",
            "process" : "1",
            "ref" : "/rest/config/snmptraprule/1",
            "uncommitted" : "1"
         },
         {
            "alertlevel" : "0",
            "code" : "1",
            "message" : "OK",
            "name" : "Otherwise Ok",
            "process" : "1",
            "ref" : "/rest/config/snmptraprule/2",
            "uncommitted" : "1"
         }
      ],
      "stale_state" : "2",
      "stale_text" : "Set to critical!!",
      "stale_threshold_seconds" : "3750",
      "stalking" : null,
      "uncommitted" : "1",
      "volatile" : "0",
      "warning_comparison" : null,
      "warning_value" : null
   }
}

If you set a parameter of order with the value dependency, the service checks will be listed based on their level, which means that if there are service check dependencies, the most dependent items will be listed first.

Note: The reference to plugin, checktype and snmptraprule is not available.

Note: Errors will be thrown if validation fails for check_interval, retry_check_interval, check_attempts or stale_threshold_seconds

Notes: checktype must be specified at service check creation time. This field cannot be subsequently changed. Cloning will not allow a change in checktype

NOtes: For checktype = 1 (active) or 5 (SNMP polling), the fields for check_interval, retry_check_interval and check_attempts will be returned in the REST API, otherwise they will not. Similarly, these fields will be processed on input, otherwise they are ignored