Endpoint for Host summary information
Request URL: /rest/status/host
- GET - lists summarised information about hosts.
- PUT, POST, DELETE - unimplemented.
URL parameters:
- hostgroupid - includes this host group in list. Can be repeated. Note, this will return all hosts in this hosgroupid and below in the hierarchy (so a hostgroupid of 1 effectively returns all hosts).
- host - filter hosts by this host name. Can be repeated.
- servicecheck - filter services by this service check name. Can be repeated.
- 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) or1
(hard). Defaults to both. - host_state - filters by hosts in this state. Expects the numeric ID for state. Can be repeated.
- host_state_type - filters by host state type. Expects either
0
(soft) or1
(hard). Defaults to both. - includeextradetails - if set, will include extra detail.
- include_cluster_health - if set will include additional details about the monitoring cluster
- rows - returns this number of rows. Set to
all
to get all results. Defaults toall
. - page - returns this page number if rows is set to a number. Defaults to 1st page.
- include_reload_time - If set to 1, then the summary data will include the last reload time of Opsview in epoch seconds.
- only_with_children - if set, then only hosts with at least 1 child are returned.
- monitoredby - if set, filter hosts if it is monitored by the monitoring server by this id.
- has_perfdata - if set, will only return service that have performance data. Default not set.
Example output for /rest/status/host?host=opcollector&host=opsview
:
{
"list" : [
{
"alias" : "Collector", // host alias, or host description
"cstatus" : "1", // When 'include_cluster_health=1'. Only set if value > 0
// not set = host has no cluster health problem (no icon)
// 1 = host's monitored_by is degraded, (gray warning)
// 2 = host's monitored_by is offline (gray failure)
// 3 = host is a collector and is degraded, (yellow warning)
// 4 = host is a collector and is offline (red failure)
"current_check_attempt" : "0", // current check attempt for host
"downtime" : "0", // 0=no downtime, 1=downtime in future, 2=downtime currently
"icon" : "opsview", // short name for the host icon
"last_check" : "0", // time of the last check for the host
"max_check_attempts" : "0", // max check attempts for host
"monitored_by_name" : "Master", // When ?include_monitored_by=1. Name of monitoring cluster
"monitored_by" : "1", // When ?include_monitored_by=1. ID number of monitoring cluster
"name" : "opcollector", // host name
"num_interfaces" : "0", // number of interfaces as defined in host edit snmp tab
"num_services" : "6", // total number of services on this host. Note, a user may not be able to see all services due to permissions
"output" : "Dummy output", // Text from plugin output
"state" : "up", // Current state of host. Possible values: up, down, unreachable
"state_duration" : 12345, // Time in seconds since the last state change
"state_type" : "soft", // State type. Possible values: soft, hard
"summary" : { // Summarised information of all services on this host. Note, states with no services in this state will not appear
"critical" : {
"unhandled" : "1"
},
"handled" : "1",
"ok" : {
"handled" : "1"
},
"total" : "2",
"unhandled" : "1"
},
"unhandled" : "0"
},
{
"alias" : "Opsview Master Server",
"comments" : "1",
"current_check_attempt" : "0",
"downtime" : "0",
"icon" : "opsview",
"last_check" : "0",
"max_check_attempts" : "0",
"monitored_by_name" : "Master", // When ?include_monitored_by=1. Name of monitoring cluster
"monitored_by" : "1", // When ?include_monitored_by=1. ID number of monitoring cluster
"name" : "opsview",
"num_interfaces" : "0",
"num_services" : "6",
"output" : "Dummy output",
"state" : "up",
"state_duration" : 12345,
"state_type" : "soft",
"summary" : {
"critical" : {
"unhandled" : "1"
},
"handled" : "1",
"ok" : {
"handled" : "1"
},
"total" : "2",
"unhandled" : "1"
},
"unhandled" : "0"
}
],
"summary" : {
"handled" : "4",
"host" : {
"handled" : "2",
"total" : "2",
"unhandled" : "0",
"up" : "2"
},
"service" : {
"critical" : "2",
"handled" : "2",
"ok" : "2",
"total" : "4",
"unhandled" : "2"
},
"total" : "6",
"unhandled" : "2",
"last_reload_time" : "1234567890", // Last time of reload
}
}
Where:
- highest_failure - the failure state of the host, or if UP, then the highest failure state of services within, else OK
- highest_unhandled - the unhandled failure state of the host, or the highest unhandled failure state of services, else OK
The status of the monitored_by
server can be determined from cstatus
:
- If 1, then status is DEGRADED
- If 2, then status is OFFLINE
Note: The following attributes will only be returned if true. If the attribute does not exist, you can assume that the values are 0:
- acknowledged = 1
- flapping = 1