Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add health checks documentation #673

Merged
merged 11 commits into from
May 28, 2024
4 changes: 4 additions & 0 deletions site/content/configuration/configuration-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ This section displays the configurable options for NGINX Agent that can be set w
| *NMS_TLS_ENABLE* | *--tls-enable* |
| *NMS_TLS_KEY* | *--tls-key* |
| *NMS_TLS_SKIP_VERIFY* | *--tls-skip-verify* |
| *NMS_API_HOST* | *--api-host* |
| *NMS_API_PORT* | *--api-port* |
| *NMS_API_KEY* | *--api-key* |
| *NMS_API_CERT* | *--api-cert* |

{{</bootstrap-table>}}

Expand Down
62 changes: 62 additions & 0 deletions site/content/configuration/health-checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "Health checks"
draft: false
weight: 400
toc: true
tags: [ "docs" ]
categories: ["configuration"]
doctypes: ["task"]
---

## Overview

The REST API includes a health endpoint to verify the status of NGINX Agent.

## Configure the REST API

To enable the REST API, add the following configuration to the NGINX Agent configuration file, `/etc/nginx-agent/nginx-agent.conf`:

```nginx
api:
host: 127.0.0.1
port: 8038
```

## Using health checks

After you enable the REST API, calling the `/health` endpoint returns the following JSON response:

```json
{
"status": "OK",
"checks": [
{
"name": "registration",
"status": "OK"
},
{
"name": "commandConnection",
"status": "OK"
},
{
"name": "metricsConnection",
"status": "OK"
}
]
}
```

The top-level `status` field is the overall health status of NGINX Agent. The health status can return three different states:

1. `PENDING`: NGINX Agent is still determining its health status.
2. `OK`: NGINX Agent is in a healthy state.
3. `ERROR`: NGINX Agent is in an unhealthy state.

The health checkpoint performs three checks to determine the overall health of the NGINX Agent:

1. `registration`: Checks if NGINX Agent has successfully registered with the management plane server.
2. `commandConnection`: Checks if NGINX Agent is still able to receive and send commands.
3. `metricsConnection`: Checks if NGINX Agent is still able to send metric reports.

If any of the checks are in an `ERROR` status, then the overall status of NGINX Agent will change to `ERROR` as well.

Loading