×
Status - Host Summary
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. 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
— eitherhandled
orunhandled
. Filters services by this condition.host_filter
— eitherhandled
orunhandled
. 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 either0
(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 either0
(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 clusterrows
— returns this number of rows. Set toall
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 to1
, 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 is not set.
Example output for /rest/status/host?host=opcollector&host=opsview
:
{
"list" : [
{
"alias" : "Collector", // Host alias (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", // Maximum 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.
["Opsview On-premises"]
["API", "Technical Reference"]