# Check that the platforms are healthy

> The health endpoints of XTM One, OpenCTI and OpenAEV, what each answer means, and how to use them in Docker Compose, Kubernetes or a load balancer.

- URL: https://filigran.io/docs/lts/7.260309-lts/deploy/operate/health-probes/
- Products (the whole suite): XTM One 1.261119.1, OpenCTI 7.260309.0-lts.8, OpenAEV 3.261118.0, OpenCRQ 0.261123.0, XTM Composer 3.261121.0
- OpenCTI line: 7.260309 LTS · 7.260309.0-lts.8
- For: platform engineers
- Type: How-to guide

Each platform of the XTM stack has an HTTP endpoint that says whether it can serve requests. This page lists them, says what each answer means and how to call them, so that Docker Compose, Kubernetes or a load balancer restarts a platform or stops sending it traffic at the right time.

**Diagram: An orchestrator calls the health endpoint of each platform, and OpenCTI and OpenAEV answer 200 only when the services they check answer**

- Callers: Orchestrator (Docker Compose, Kubernetes or a load balancer)
- Platforms: OpenCTI (Port 8080, key APP__HEALTH_ACCESS_KEY), OpenAEV (Port 8080, key OPENAEV_HEALTHCHECK_KEY)
- At the center: XTM One (Port 4000, no key, 200 when up)
- Checked dependencies: Elasticsearch and Redis (Checked by OpenCTI), RabbitMQ and S3 storage (Checked by both), PostgreSQL (Checked by OpenAEV)

Connections:

- Orchestrator → OpenCTI: /health with key
- Orchestrator → OpenAEV: /api/health with key
- Orchestrator → XTM One: /api/health
- OpenCTI → Elasticsearch and Redis: checks
- OpenCTI → RabbitMQ and S3 storage: checks
- OpenAEV → RabbitMQ and S3 storage: checks
- OpenAEV → PostgreSQL: checks

## The endpoints {#the-endpoints}

| Platform | Endpoint | Key | Answers `200` when |
| --- | --- | --- | --- |
| XTM One | `/api/health`, on its port (`4000` in the container, `XTM_ONE_PORT` on the host) | None | The application is up |
| OpenCTI | `/health?health_access_key=<key>`, on its port (`8080` in the container, `OPENCTI_PORT` on the host) | `APP__HEALTH_ACCESS_KEY`, from `OPENCTI_HEALTHCHECK_ACCESS_KEY` in `.env` | Elasticsearch, S3 storage, RabbitMQ and Redis all answer |
| OpenAEV | `/api/health?health_access_key=<key>`, on its port (`8080` in the container, `8081` on the host) | `OPENAEV_HEALTHCHECK_KEY` in `.env` | PostgreSQL, RabbitMQ and S3 storage answer |

The healthchecks of `docker-compose.yml` call these same endpoints, and `docker compose ps` shows their result. The workers, connectors, collectors and injectors of a platform, and XTM Composer, wait for it to be healthy before they start.

## Check the platforms by hand {#check-the-platforms-by-hand}

From the `xtm-docker` folder:

```bash
set -a; . ./.env; set +a
curl -fsS "http://localhost:$XTM_ONE_PORT/api/health" && echo
curl -fsS "http://localhost:$OPENCTI_PORT/health?health_access_key=$OPENCTI_HEALTHCHECK_ACCESS_KEY" && echo
curl -fsS "http://localhost:8081/api/health?health_access_key=$OPENAEV_HEALTHCHECK_KEY" && echo
```

The host port of OpenAEV is written in `docker-compose.yml` (`8081:8080`), not taken from `OPENAEV_PORT`: `OPENAEV_PORT` only builds its public URL. If you change one, change the other.

**Check that it worked**

OpenCTI and OpenAEV answer `{"status":"success"}`. A platform you did not start fails to connect.

## What the answers mean {#what-the-answers-mean}

**OpenCTI**

| Answer | Meaning |
| --- | --- |
| `200` `{"status":"success"}` | The platform and its four dependencies are up |
| `503` with an `error` | A dependency is down, or the platform has not finished starting |
| `401` `{"status":"unauthorized"}` | The key is wrong, or the platform has no key: an empty key and the default `ChangeMe` refuse every call |

Set the key to `public` to answer without a key. Use it only on a network you trust.

*(OpenCTI before 7.261030)*

Each call checks the four dependencies, with a timeout of 15 seconds each.

**OpenAEV**

| Answer | Meaning |
| --- | --- |
| `200` `{"status":"success"}` | PostgreSQL, RabbitMQ and S3 storage are up |
| `503` | One of them is down, or has not been checked for three intervals |
| `401` | The key is missing or wrong |

OpenAEV checks its dependencies in the background, every `openaev.healthcheck.connectivity-probe-interval` (default `PT10S`, ten seconds), and the endpoint returns the last result. Elasticsearch is checked too, but its failure does not turn the answer into `503`: OpenAEV can still serve requests without it. Add `&details=true` to also get the storage used in PostgreSQL, Elasticsearch and S3.

> **Warning: Change the default key**
>
> The default key of OpenAEV is `ChangeMe`, and OpenAEV accepts it. In xtm-docker, the platform falls back to it when `OPENAEV_HEALTHCHECK_KEY` is not set in `.env`. Set your own value.

**XTM One**

XTM One answers on `/api/health` without a key. The healthcheck of xtm-docker marks it unhealthy when the endpoint does not answer or answers with an HTTP error.

## Use the probes in Kubernetes {#use-the-probes-in-kubernetes}

For OpenAEV, use `/api/health?health_access_key=<your key>` on port 8080, and for XTM One, `/api/health` on port 4000.

## What's next {#what-s-next}

- [Observability metrics](https://filigran.io/docs/lts/7.260309-lts/deploy/operate/metrics/), to follow the dependencies over time.
- [Scale: workers, platforms and clusters](https://filigran.io/docs/lts/7.260309-lts/deploy/operate/scale/), to run several OpenCTI nodes behind a load balancer.
- [Troubleshoot the XTM stack](https://filigran.io/docs/lts/7.260309-lts/deploy/operate/troubleshoot/), when a platform stays unhealthy.
- [HTTP endpoints](https://filigran.io/docs/lts/7.260309-lts/reference/opencti/http-endpoints/): every endpoint OpenCTI serves besides GraphQL, health and metrics included.
