Status - Service List

Endpoint for Servicecheck status information

Request URL: /rest/status/service

  • GET - lists information about services
  • PUT, POST, DELETE - unimplemented

The URL parameters includes the service object filtering parameters. These are also available:

  • downtime_start_time & downtime_comment - filter based on downtime that matches these conditions.
  • filter - either handled or unhandled. Filters services by this condition.
  • host_filter - either handled or unhandled. Filters host by this condition.
  • state - filters by services in this state. Expects the numeric ID for state. Can be repeated.
  • state_type - filters by service state type. Expects either 0 (soft) or 1 (hard). Defaults to both.
  • host_state - Numeric state value. Can be repeated. If includehosts=0 (default), then the host state of each service must be in this state (AND condition). If includehosts=1, then either services are in the chosen state, or any host are in this chosen state (OR condition)
  • host_state_type - filters by host state type. Expects either 0 (soft) or 1 (hard). Defaults to both.
  • includeperfdata - if set, will add data re: the performance metrics for services that have performance information.
  • convertuom - if set, will convert performance data into base units. Eg, if value=1500 and uom=MB, with this flag set, will return value=1500000000 uom=bytes.
  • includehandleddetails - if set, will include acknowledgement information.
  • includehosts - Default 0. If set, this will change the ordering by state to the order below. Also, it will change the filter=unhandled/handled to include hosts specifically. NOTE: When includehosts is set, each host could have services = [], which means this is a host only object. Note, this parameter can change the definition of host_state
  • type - only applicable when includehosts=1. Set to either "host" or "service". If not set, will assume both. If set more than once, the first value is used
  • rows - returns this number of rows. Set to all to get all results. Defaults to all.
  • page - returns this page number if rows is set to a number. Defaults to 1st page.
  • include_allrows - if set and page is set, this will return summary.allrows which will be the total number of rows based on the filtering parameters. Default no.
  • recheck=1 - the response will filter only the objects that can be rechecked (default: 0)
  • order - can order the results. Can be repeated. Valid values (you can suffix with _desc to order descending):
    • state - orders by service state.
      • If includehosts=0, host states have priority (DOWN, UNREACHABLE, UP, CRITICAL, WARNING, UKNOWN, OK)
      • If includehosts=1, then states are intermingled by priority (so DOWN, CRITICAL, WARNING, UNREACHABLE, UNKNOWN, UP, OK)
    • service - orders by service name
    • host - orders by host name
    • host_state - orders by host state
    • last_check - orders by last check time
    • last_state_change - orders by last state change time
    • state_duration - orders by most recent state changes first

Example output:

Note: the host portion could have two additional keys regarding Monitoring Collector and/or Cluster health. See Host Summary for more details.

{
   "list" : [
      {
         "alias" : "Opsview Master Server",
         "comments" : "1",
         "current_check_attempt" : "0",
         "downtime" : "0",
         "icon" : "opsview",
         "last_check" : "1970-01-01 00:00:00",
         "max_check_attempts" : "0",
         "name" : "opsview",
         "num_interfaces" : "0",
         "num_services" : "6",
         "output" : "Dummy output",
         "services" : [
            {
               "current_check_attempt" : "1",
               "downtime" : "0",
               "last_check" : "2011-01-16 22:51:29",
               "markdown" : "0",
               "max_check_attempts" : "3",
               "name" : "Collector-node: opcollector",
               "output" : "collector-node check with fake results",
               "perfdata_available" : "1",
               "service_object_id" : "219",
               "state" : "ok",
               "state_type" : "hard",
               "state_duration" : "9296782",
               "unhandled" : "0"
            },
            {
               "current_check_attempt" : "1",
               "downtime" : "0",
               "last_check" : "2011-01-16 22:52:34",
               "markdown" : "0",
               "max_check_attempts" : "3",
               "name" : "Collector-node: opcollectorclusterA",
               "output" : "collector-node opcollectorclusterA check with fake results",
               "perfdata_available" : "1",
               "service_object_id" : "220",
               "state" : "critical",
               "state_type" : "soft",
               "state_duration" : "9296717",
               "unhandled" : "1"
            }
         ],
         "state" : "up",
         "state_type" : "hard",
         "state_duration" : "1304515071",
         "summary" : {
            "critical" : "1",
            "handled" : "1",
            "computed_state" : "critical",
            "ok" : "1",
            "total" : "2",
            "unhandled" : "1"
         },
         "unhandled" : "0"
      }
   ],
   "summary" : {
      "handled" : "2",
      "host" : {
         "handled" : "1",
         "total" : "1",
         "unhandled" : "0",
         "up" : "1"
      },
      "service" : {
         "critical" : "1",
         "handled" : "1",
         "ok" : "1",
         "total" : "2",
         "unhandled" : "1"
      },
      "total" : "3",
      "unhandled" : "1"
   }
}

Note: The following attributes will only be returned if true for a host or service. If the attribute does not exist, you can assume that the values are 0:

  • acknowledged = 1
  • flapping = 1

Note: The format of the last_check field has changed to being epoch seconds. To have the old behaviour, use the URL parameter of format_datetime=1.