<a id="enable-monitoring"></a>

# Enable monitoring

This guide walks through enabling Grafana dashboards for your JAAS deployment.

The JIMM application ships three Grafana dashboards — **JAAS Metrics**, **JAAS Logs**, and **JAAS Traces** — which are provisioned automatically once JIMM is integrated with a Grafana instance. Metrics are collected by Prometheus, logs are collected by Loki, and traces are collected by Tempo. The monitoring dashboards are described below; for the tracing dashboard see [Enable tracing](https://documentation.ubuntu.com/jaas/latest/howto/observability-cos/enable-tracing.md#enable-tracing).

#### NOTE
This guide covers monitoring for JIMM only. For monitoring the other components of your deployment — for example OpenFGA, PostgreSQL or Vault — see the documentation of the corresponding charms.

## Prerequisites

- A running JAAS deployment
- A deployed COS stack

## Integrate with Grafana, Prometheus and Loki

JIMM exposes three COS integration endpoints:

| JIMM endpoint       | Interface           | Provides                               |
|---------------------|---------------------|----------------------------------------|
| `grafana-dashboard` | `grafana_dashboard` | The JAAS dashboards                    |
| `metrics-endpoint`  | `prometheus_scrape` | Scraping of JIMM’s `/metrics` endpoint |
| `logging`           | `loki_push_api`     | Forwarding of JIMM’s workload logs     |

To integrate JAAS with the Grafana, Prometheus and Loki applications of your COS stack — directly or through an application offer — follow the integration instructions in [Integrate JAAS with the Canonical Observability Stack](https://documentation.ubuntu.com/jaas/latest/howto/manage-your-jaas-deployment.md#integrate-jaas-with-the-canonical-observability-stack).

Once the relations settle, Grafana automatically provisions the JAAS dashboards — no manual import is needed.

## Verify

Open the Grafana UI of your COS deployment and log in. In the Grafana UI, open **Dashboards**. You should see the JAAS dashboards listed alongside the operator overview dashboards:

| Dashboard    | Description                                  |
|--------------|----------------------------------------------|
| JAAS Metrics | Operational metrics collected via Prometheus |
| JAAS Logs    | Workload logs collected via Loki             |

### What to expect in the JAAS Metrics dashboard

The dashboard is organised in rows, each covering an area of JIMM:

| Row              | Panels                                                                                                                  | Data source                                         |
|------------------|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| JIMM             | Active connections, managed controllers, managed models, Go runtime statistics (memory, goroutines, garbage collection) | `jimm_websocket_*`, `jimm_system_*`, `go_*` metrics |
| Juju Controllers | Ping duration, call durations and rates, error rate per controller and method                                           | `jimm_juju_*` metrics                               |
| Auth             | Authentication failure rate per method                                                                                  | `jimm_auth_*` metrics                               |
| Vault            | Vault call durations and rates                                                                                          | `jimm_vault_*` metrics                              |
| OpenFGA          | OpenFGA call durations and rates                                                                                        | `jimm_openfga_*` metrics                            |
| Database         | Database query durations and rates                                                                                      | `jimm_db_*` metrics                                 |

For the up-to-date definition of the dashboards, see the [Grafana dashboards in the JIMM charm source](https://github.com/canonical/jimm-k8s-operator/tree/main/src/grafana_dashboards).

#### NOTE
Prometheus only creates a time series the first time a counter is incremented. On an idle deployment — no connected controllers, no user activity — most panels will show no data. This is expected: the panels populate as JIMM handles authentication attempts, Juju API calls, and so on. The Go runtime and database panels show data as soon as JIMM is running.

### What to expect in the JAAS Logs dashboard

The dashboard shows JIMM’s workload logs with:

- A **log volume histogram** broken down by severity level (`debug`, `info`, `warn`, `error`)
- A **log stream** panel with the parsed log fields (level, caller, message)

Use the **level** dropdown to filter by severity and the **search** box for full-text, case-insensitive filtering.

## Troubleshooting

- **All panels show no data and the variable dropdowns are empty**: check that Grafana can reach the Prometheus and Loki datasources. Their URLs are derived from the ingress, so a broken or misconfigured ingress (for example, a TLS certificate that does not cover the datasource hostnames) makes the topology variables fail silently.
- **The JAAS Metrics dashboard shows data only in the database and Go runtime panels**: this is expected on an idle deployment — see the note above.
