Developers API
getHostStatus
Query the current uptime & health monitoring status of one of more hosts. Also used to retrieve a list of host IDs and names.
Omit the 'hostids' parameter to fetch a list of all hosts.
Note that the 'healtherrors' flag only reports rule breaches, it does not report the situation where a host is failing to supply health monitoring data. You may check the 'lasthealthcheck' value to determine whether data collection is functioning correctly.
Request Parameters
| Parameter | Data Type | Description | Required | Default |
|---|---|---|---|---|
| hostids | string | A comma separated list of host IDs whose status will be queried. If omitted, the status of all your hosts will be queried | Optional |
Response Data
| Response Variable | Data Type | Description |
|---|---|---|
| errorcode | integer | Returns an errorcode of 0 if call is successful. |
| status | This is an array - its' contents follow: | |
| hostid | integer | The ID of the host in question |
| name | string | The name given to the host |
| uptimemonitored | boolean | Whether uptime monitoring is enabled |
| healthmonitored | boolean | Whether server health monitoring is enabled |
| uptimeerrors | boolean | Whether uptime monitoring errors are currently recorded |
| healtherrors | boolean | Whether health monitoring errors are currently recorded |
| lastuptimecheck | integer | Unix timestamp of the most recent uptime monitoring data sample available or null if none is available or -1 if this data is temporarily unavailable |
| lasthealthcheck | integer | Unix timestamp of the most recent health monitoring data sample available or null if none is available or -1 if this data is temporarily unavailable |
| lastuptimeerror | integer | Unix timestamp of the most recent uptime monitoring error or null if no errors have been recorded or -1 if this data is temporarily unavailable |