> ## Documentation Index
> Fetch the complete documentation index at: https://docs.conduktor.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring setup for Conduktor Gateway and Console

> Set up health monitoring for Conduktor Gateway and Console. Configure liveness and readiness endpoints, Prometheus metrics.

## Gateway health and monitoring

### Liveness endpoint

`/health/live`

Returns a status HTTP 200 when Gateway is up.

```shell title="cURL example" theme={null}
curl -s http://localhost:8888/health/live
```

Could be used to set up probes on Kubernetes.

#### Kubernetes startup probe

```yaml title="Port configuration" theme={null}

ports:
  - containerPort: 8888
    protocol: TCP
    name: httpprobe
```

```yaml title="Probe configuration" theme={null}
startupProbe:
    httpGet:
        path: /health/live
        port: httpprobe
    enabled: true
    initialDelaySeconds: 10
    periodSeconds: 10
    timeoutSeconds: 1
    failureThreshold: 5
    successThreshold: 1
```

#### Kubernetes liveness probe

```yaml title="Port configuration" theme={null}
ports:
  - containerPort: 8888
    protocol: TCP
    name: httpprobe
```

```yaml title="Probe configuration" theme={null}
livenessProbe:
  httpGet:
    path: /health/live
    port: httpprobe
  enabled: true
  initialDelaySeconds: 0
  periodSeconds: 5
  timeoutSeconds: 1
  failureThreshold: 3
  successThreshold: 1
```

### Readiness endpoint

`/health/ready`

Returns readiness of Gateway. Modules status:

* `NOTREADY` (initial state)
* `READY`

This endpoint returns a 200 status code if Gateway is in a `READY` state. Otherwise, it returns a 503 status code if Gateway is not ready to accept traffic yet.

```shell title="cURL example" theme={null}
curl -s  http://localhost:8888/health/ready
# READY
```

Could be used to set up probes on [docker-compose](#docker-compose-probe-setup) or [Kubernetes](#kubernetes-readiness-probe).

#### Docker-compose probe setup

<Info>
  The `healthcheck` configuration below is optional, as it's already backed into the Conduktor image and not required unless you're experiencing issues.
</Info>

```yaml theme={null}
healthcheck:
  test:
    [
      'CMD-SHELL',
      'curl --fail http://localhost:${CDK_LISTENING_PORT:-8888}/health/ready',
    ]
  interval: 5s
  retries: 25
```

#### Kubernetes readiness probe

```yaml title="Port configuration" theme={null}

ports:
  - containerPort: 8888
    protocol: TCP
    name: httpprobe
```

```yaml title="Probe configuration" theme={null}
readinessProbe:
    httpGet:
        path: /health/ready
        port: httpprobe
    enabled: true
    initialDelaySeconds: 0
    periodSeconds: 5
    timeoutSeconds: 1
    failureThreshold: 3
    successThreshold: 1
```

### Gateway versions

`/versions`

Returns the Gateway version.

```shell title="cURL example" theme={null}
curl -s  http://localhost:8888/versions | jq .
# {
#  "gateway": "3.12.0-SNAPSHOT"
# }
```

### Health (deprecated)

To check the health of Gateway, you can use the endpoint `/health` on the Gateway API (by default, on port `8888`):

```sh title='cURL Example' theme={null}
curl -s  http://localhost:8888/health | jq .
```

```json title='Output Example' theme={null}
{
  "status": "UP",
  "checks": [
    {
      "id": "buildInfo",
      "status": "UP",
      "data": {
        "version": "3.1.0",
        "time": "2024-06-03T20:32:32+0000",
        "commit": "41967691f4c54b5d76a3f1fa8aee3701903b89d9"
      }
    },
    {
      "id": "live",
      "status": "UP"
    }
  ],
  "outcome": "UP"
}
```

### Access Prometheus metrics from Gateway

The Prometheus endpoint is `<gateway_host>:<gateway_port>/metrics`. For example:

```bash theme={null}
localhost:8888/metrics
```

Please be aware that if `GATEWAY_SECURED_METRICS` is enabled (which is the default setting), you will need to use the credentials specified in `GATEWAY_ADMIN_API_USERS` to access it.

For example, using the default credentials, you can access the metrics with the following command:

```bash title='Retrieve Gateway Metrics' theme={null}
curl conduktor-gateway:8888/metrics --user "admin:conduktor"
```

### Available metrics for Prometheus

[Find out more about Gateway metrics](/guide/reference/gateway-metrics).

### Audit log events

| **Event type**                               | **Description**                                              |
| -------------------------------------------- | ------------------------------------------------------------ |
| **Admin.KafkaConnect.Create**                | A Kafka Connect instance is created.                         |
| **Admin.KafkaConnect.Update**                | A Kafka Connect instance is updated                          |
| **Admin.KafkaConnect.Delete**                | A Kafka Connect instance is deleted.                         |
| **Admin.KsqlDB.Create**                      | A ksqlDB instance is created.                                |
| **Admin.KsqlDB.Update**                      | A ksqlDB instance is updated.                                |
| **Admin.KsqlDB.Delete**                      | A ksqlDB instance is deleted.                                |
| **Admin.KafkaCluster.Create**                | A Kafka cluster is created.                                  |
| **Admin.KafkaCluster.Update**                | A Kafka cluster is updated.                                  |
| **Admin.KafkaCluster.Delete**                | A Kafka cluster is deleted.                                  |
| **Admin.SchemaRegistry.ChangeCompatibility** | The global compatibility of the schema registry is updated.  |
| **Admin.Integration.Update**                 | The alert integration (Slack, MS Teams, Webhook) is updated. |
| **Admin.AdminApiKey.Create**                 | A new admin API key is created.                              |
| **Admin.AdminApiKey.Delete**                 | An admin API key is deleted.                                 |
| **Admin.DataMaskingPolicy.Create**           | A data masking policy is created.                            |
| **Admin.DataMaskingPolicy.Update**           | A data masking policy is updated.                            |
| **Admin.DataMaskingPolicy.Delete**           | A data masking policy is deleted.                            |
| **Admin.Certificate.Create**                 | A certificate is created.                                    |
| **Admin.Certificate.Delete**                 | A certificate is deleted.                                    |
| **Iam.User.Create**                          | IAM user is created.                                         |
| **Iam.User.Update**                          | IAM user is updated.                                         |
| **Iam.User.Delete**                          | IAM user is deleted.                                         |
| **Iam.User.Login**                           | IAM user logs in.                                            |
| **Iam.User.Logout**                          | IAM user logs out.                                           |
| **Iam.Group.Create**                         | IAM group is created.                                        |
| **Iam.Group.Update**                         | IAM group is updated.                                        |
| **Iam.Group.Delete**                         | IAM group is deleted.                                        |

## Console endpoints

### Liveness endpoint

`/api/health/live`

Returns a status HTTP 200 when Console is up.

```shell title="cURL example" theme={null}
curl -s  http://localhost:8080/api/health/live
```

Could be used to set up probes on Kubernetes.

#### Kubernetes startup probe

```yaml title="Port configuration" theme={null}

ports:
  - containerPort: 8080
    protocol: TCP
    name: httpprobe
```

```yaml title="Probe configuration" theme={null}
startupProbe:
    httpGet:
        path: /api/health/live
        port: httpprobe
    enabled: false
    initialDelaySeconds: 10
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 10
    successThreshold: 1
```

#### Kubernetes liveness probe

```yaml title="Port configuration" theme={null}
ports:
  - containerPort: 8080
    protocol: TCP
    name: httpprobe
```

```yaml title="Probe configuration" theme={null}
livenessProbe:
  httpGet:
    path: /api/health/live
    port: httpprobe
  enabled: true
  initialDelaySeconds: 30
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 3
  successThreshold: 1
```

### Readiness/startup endpoint

`/api/health/ready`

Returns readiness of the Console.
Modules status :

* `NOTREADY` (initial state)
* `READY`

This endpoint returns a 200 status code if Console is in a `READY` state. Otherwise, it returns a 503 status code if Console fails to start.

```shell title="cURL example" theme={null}
curl -s  http://localhost:8080/api/health/ready
# READY
```

Could be used to set up probes on docker-compose or Kubernetes.

#### Docker-compose probe setup

<Info>
  The `healthcheck` configuration below is optional, as it's already backed into the Conduktor image and not required unless you're experiencing issues.
</Info>

```yaml theme={null}
healthcheck:
  test:
    [
      'CMD-SHELL',
      'curl --fail http://localhost:${CDK_LISTENING_PORT:-8080}/api/health/ready',
    ]
  interval: 10s
  start_period: 120s # Leave time for the psql init scripts to run
  timeout: 5s
  retries: 3
```

#### Kubernetes readiness probe

```yaml title="Port configuration" theme={null}
ports:
  - containerPort: 8080
    protocol: TCP
    name: httpprobe
```

```yaml title="Probe configuration" theme={null}
readinessProbe:
  httpGet:
    path: /api/health/ready
    port: httpprobe
  enabled: true
  initialDelaySeconds: 30
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 3
  successThreshold: 1
```

### Console versions

`/api/versions`

This endpoint exposes module versions used to build the Console along with the overall Console version.

```shell title="cURL example" theme={null}
curl -s  http://localhost:8080/api/versions | jq .
# {
#  "platform": "1.27.0",
#  "platformCommit": "ed849cbd545bb4711985ce0d0c93ca8588a6b31f",
#  "console": "f97704187a7122f78ddc9110c09abdd1a9f9d470",
#  "console_web": "05dea2124c01dfd9479bc0eb22d9f7d8aed6911b"
# }
```

### Access Prometheus metrics from Console

The Prometheus metrics endpoints are:

* `/api/monitoring/metrics` - Console and Kafka metrics
* `/monitoring/metrics` - Kafka metrics

Since Console v1.42.0, you can protect these endpoints with basic auth by configuring the `CDK_MONITORING_BASICAUTH_EMAIL` and `CDK_MONITORING_BASICAUTH_PASSWORD` environment variables.

When basic auth is configured, you need to provide credentials to access the metrics:

```bash title='Retrieve Console metrics with basic auth' theme={null}
curl http://conduktor-console:8080/api/monitoring/metrics --user "metrics@example.com:secure-password"
```

<Note>
  Basic auth is optional in v1.42.0 to avoid breaking existing deployments. In a future release, basic auth will become mandatory for metrics scraping.
</Note>

[Find out more about Console metrics](/guide/reference/console-metrics#console-metrics).

## Cortex monitoring endpoints

### Cortex endpoint

`/ready` on port `9009`

Returns a status 200 with response `ready` if Cortex is running

```shell title="cURL example" theme={null}
curl -s "http://localhost:9009/ready"
```

### Alertmanager endpoint

`/ready` on port `9010`

Returns a status 200 with response `ready` if Alertmanager is running

```shell title="cURL example" theme={null}
curl -s "http://localhost:9010/ready"
```

### Prometheus endpoint

`/-/healthy` on port `9090`

Returns a status 200 with response `Prometheus Server is Healthy.` if Prometheus is running

```shell title="cURL example" theme={null}
curl -s "http://localhost:9090/-/healthy"
```
