
= Health Rest Service

Service that allows health rest calls on all available health check components.

Currently implemented on Minion by default.

Examples:

* `/rest/health`
* `/rest/health/probe`
* `/rest/health?tag=local`
* `/rest/health/probe?tag=local`
* `/rest/health/probe?tag=local&tag=dao`

On Minion, URI paths are prefixed with `/minion`, e.g. `/minion/rest/health`

On Core, URI paths are prefixed with `/opennms`, e.g. `/opennms/rest/health`

== GETs (reading data)

[caption=]
.Health rest service GET functions
[options="autowidth"]
|===
| Resource  | Description

| /health
| Health check results for components.
Include health check result details for each element.

| /health/probe
| Health check probe for components.
Indicates only if the health is good or not.
|===

The following table shows all supported query string parameters and their default values:

[options="autowidth"]
|===
| Name  | Description   | Default Value

| t
| Timeout, in milliseconds.
| 5000

| maxAgeMs
| Max age to live, in milliseconds.
| 90000

| tag
| Use to filter health check components.
A tag could be: +
 * `local`
 * `rest`
 * `broker`
 * `telemetry`
 * `dao`
 * `minion`
 * `elastic`
 * `bundle`
| _Blank_
|===

Requests without parameters will return all available health check components.

.Response
[source,json]
----
{
    "healthy": true,
    "responses": [
        {
            "description": "Verifying installed bundles",
            "status": "Success"
        },
        {
            "description": "Verifying Listener NXOS-Listener (org.opennms.netmgt.telemetry.listeners.UdpListener)",
            "status": "Success"
        },
        {
            "description": "Verifying Listener JTI-Listener (org.opennms.netmgt.telemetry.listeners.UdpListener)",
            "status": "Success"
        },
        ...
    ]
}

----

== HTTP Error Codes

[caption=]
.Health rest service HTTP error codes
[options="autowidth"]
|===
| Error | Description

| 404
| Rest health feature is not installed, or is installed and stopped.

| 200
| Rest health feature is installed and running.
This reponse is independent of the health status. +
`healthy:true` indicates that all components found are healthy. +
`healthy:false` indicates that at least one component did not return a healthy status.
|===
