> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/cgw/1.12/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/cgw/1.12/observability/grafana-dashboard.md).

# Grafana dashboard

The `cgw-support` chart ships a Grafana dashboard named **CGW Overview**. It
visualizes CGW metrics. Consult [Metrics](https://docs.cennso.com/components/cgw/1.12/observability/metrics.md) for the list of available
raw metrics.

Install it with the support chart:

```yaml
dashboard:
  enabled: true
```

> **NOTE:** A panel only shows data if the corresponding exporter port is
> scraped. Panels for exporter ports not covered by the ServiceMonitor
> stay empty. See [Monitoring configuration](https://docs.cennso.com/components/cgw/1.12/configuration/monitoring.md).

## Dashboard controls

Every panel is controlled by the available filters in the dashboard header:

| Filter | Selects |
| --- | --- |
| Datasource | Prometheus datasource used by the panels |
| Cluster | Kubernetes cluster |
| Instance | CGW pods, several at a time |
| Interfaces | Network interfaces of the selected CGWs |
| IPsec Peer (remote ID) | Peers of the selected CGWs, by the identity they authenticate with |
| IPsec Connections | IPsec connections the selected CGWs have loaded, established or not |

Instance, Interfaces, and IPsec Connections also control the layout. The
**Network Throughput** row repeats per selected instance and, inside a row,
one panel per selected interface. The **IPsec** row repeats per selected
connection; its title names the instance and the connection, for example
`IPSec cgw-a → site-b`.

Selecting a peer narrows **IPsec Connections** to the connections with that
peer. A connection that has never been established has no peer identity yet
and stays in the list whichever peer is selected.

> **NOTE:** The interface list omits `erspan0` and `gretap0`. Loading the GRE
> kernel modules creates those in every network namespace, so they exist in
> every pod without carrying traffic.

> **NOTE:** The peer identity comes from the `strongswan_ike_info` metric of
> the IPsec Exporter image shipped with chart 1.12.0. With an older image, the
> peer list is empty and the panels show the connections without their peer.

## ICMP Probe

![ICMP Probe](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-icmp-probe.png)

The ping exporter measures the loss rate towards its configured targets.

* **ICMP Echo Loss Rate [%]** — current loss of every probe, one row per
  source and target pair, with the names from the ping exporter configuration
  next to the addresses. The cell is green at 0% and turns red as loss grows.
* **ICMP Echo Loss Rate History [%]** — the loss of every probe over time, so
  a short outage stays visible after it has passed. The legend lists the last,
  mean and maximum loss per probe.

## Dynamic Routing

![Dynamic Routing](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-routing-protocols.png)

The Dynamic Routing row contains the following panels:

* **Routing protocols** — state of every protocol of every CGW. `State`
  carries the description BIRD prints for the protocol, colored green while
  the protocol is up. Only BGP fills that description in, with `Established`,
  `Connect`, `Idle` etc.; for the internal `Kernel` and `Static` protocols
  BIRD leaves it empty and the column falls back to a plain `up` or `down`.
* **Imported / exported prefixes [count]** — how many routes each protocol
  currently imports into and exports out of the BIRD tables. Imported counts
  are drawn upwards and exported ones mirrored below the zero line, so the two
  directions of a CGW can be read against one another on a single scale. Each
  direction stacks separately.
* **BIRD Configuration State** — the verdict of the last configuration check,
  separately for the IPv4 and the IPv6 daemon. `invalid` means BIRD kept
  running with the previous configuration. The panel stays empty unless
  `bird.birdConfigWatcher.enabled` is set.
* **BGP Session States** — the state description of every BGP session over
  time. It distinguishes the phases of a session: green for `Established`,
  orange while it is connecting, red for `Idle` and dark red for a session
  that is down or disabled. The bands carry the text BIRD reports, including
  the error that caused a session to fail.

## Network Throughput

![Network Throughput](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-network-throughput.png)

One row per CGW, one panel per interface, both driven by the filters in the
dashboard header.

Each panel draws four series:

| Series | Axis | Style |
| --- | --- | --- |
| `RX:bits` | left, bits/s | solid, below zero |
| `TX:bits` | left, bits/s | solid, above zero |
| `RX:packets` | right, packets/s | dashed, below zero |
| `TX:packets` | right, packets/s | dashed, above zero |

Received traffic is mirrored below the zero line so that both directions of an
interface can be read at a glance. Packets share the panel on the right axis
because the ratio of the two matters: bits flat while packets rise means the
average packet is getting smaller, the signature of fragmentation or of a
flood of small packets.

The legend below each graph lists the last, mean and maximum value of every
series.

## Conntrack

![Conntrack](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-conntrack.png)

The conntrack panel shows aspects of the connection tracking table of the pod
network namespace. Since it is a limited resource and must be configured
appropriately, its utilization must be checked.

* **Conntrack table usage [%]** — entries divided by the limit, as a
  percentage with two decimals. Orange from 70%, red from 90%.
* **Conntrack entries [count]** — entries over time against the limit, which
  is drawn as a red dashed line to mark it as a boundary rather than a
  measurement. The axis shows exact numbers instead of `3 Mil`, because that
  is the number to compare against `net.netfilter.nf_conntrack_max`.
* **Conntrack timeouts [s]** — the per protocol entry lifetimes as configured
  and effective in the pod. A table fills up either because the limit is too
  low or because entries outlive the traffic that created them, and the kernel
  default for an established TCP connection is five days.

## IPsec X.509 Certificates

![IPsec X.509
certificates](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-ipsec-x509-certificates.png)

The IPsec X.509 Certificates row describes the IPsec certificates loaded by
`strongSwan`, so it contains data only where the connections authenticate with
certificates: with a pre-shared key, `strongSwan` loads none and all three
panels stay empty.

The metrics come from `strongSwan` per pod and describe the certificate files
in `/etc/ipsec.d/`. One certificate therefore appears once per CGW, and a CGW
usually lists more than its own: in the screenshot both `cgw-a` and `cgw-b`
report three — their own end-entity certificate, the peer's certificate
learned during the IKE exchange, and the CA the two chain to.

* **X.509 Certificate Validity** — one row per loaded certificate, with its key
  attributes. The `Validity` column is the verdict of `strongSwan`, green for
  `Valid` and red for `Invalid`; it is not a comparison of `Not After` against
  the clock of whoever reads the dashboard, which is why the exporter verdict
  is shown separately.
* **X.509 Certificate Expiration** — the same rows, with `Expires in` as the
  remaining lifetime in days, hours, minutes and seconds. This is the column
  to watch: a certificate reads `Valid` right up to the moment it does not.
* **X.509 Certificate Validity Timeline** — the verdict over time, one band per
  CGW and subject, carrying the text `Valid` or `Invalid` rather than the
  number the exporter encodes it as. Where several pods of one CGW report the
  same certificate, the band takes the most pessimistic verdict of them, so a
  certificate that one pod cannot validate reads `Invalid` instead of hiding
  behind the others. Pods disagreeing at all is itself the finding — a clock
  skewed between nodes, a pod still holding the previous version of the
  Secret, or a per pod revocation check that failed.

## IPsec

One row per connection, titled `IPSec <instance> → <connection>`. It opens
with the peer of the connection:

![IKE Peers](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-ipsec-peers.png)

* **IKE Peers** — the local and the remote identity, the remote host, the age
  of the IKE_SA and whether NAT was detected, taken from the newest
  established IKE_SA. A connection that is not established has no line; see
  the *Connection Establishment Timeline* below. The remote host follows the
  peer's current address, while the remote ID stays the same when a peer comes
  back with a new address. *NAT* reads `yes` as well when a side forces UDP
  encapsulation (`forceencaps=yes`), which makes strongSwan fake the NAT
  detection.

The next band describes the configuration and the negotiated result side by
side:

![IPsec connection
parameters](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-ipsec-connection-parameters.png)

* **Connection Configuration** — what `strongSwan` loaded for this connection,
  independent of whether a tunnel exists: IKE version, rekey and reauth
  intervals, the number of CHILD_SA configurations and their rekey limits in
  seconds, bytes and packets. It needs an IPsec Exporter image that supports
  connection metrics, as the chart's default image does. Images without the
  `--enable-conn-metrics` switch the chart passes leave the panel empty.
* **Connections: configured vs established** — loaded connections against
  existing IKE_SAs, per CGW. Note that these count different things: one
  connection can hold more than one IKE_SA, for instance while rekeying, so
  the right column may exceed the left one. Fewer IKE_SAs than connections is
  the interesting direction — something did not come up.
* **CHILD SAs: configured vs established** — the same comparison for the
  CHILD_SAs of this connection. Unlike the panel beside it these numbers are
  per connection. Fewer established than configured means a subnet pair of the
  tunnel is missing.
* **Negotiated IKE Parameters** — what the peers actually agreed on: IKE
  version, who initiated, the NAT detection flags, the negotiated algorithms
  and key sizes, and the number of children. This panel only contains data
  while the IKE_SA is established.
* **Age [s]**, **Next rekey in [s]**, **Next reauth in [s]** — lifetime of the
  current IKE_SA.
* **CHILD_SA Key Parameters** and **CHILD_SA Times [s]** — the same for the
  child SAs, including whether UDP encapsulation was forced.

The next band shows the state over time:

![IPsec connection
timelines](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-ipsec-connection-timelines.png)

* **Connection Establishment Timeline** — whether the connection has an
  established IKE_SA: `Established` or `Not established`. Unlike the IKE status
  below, a connection without any IKE_SA shows here as an outage rather than
  as a gap.
* **IKE Status Timeline** — status of the IKE_SA over time. The bands carry
  the status name itself — `Installed`, `Established`, `Down` — and not the
  number the exporter encodes it as. A band reading `No SA` is a period in
  which the exporter reported no IKE_SA at all. Rekeying is one harmless
  reason for such a gap.
* **Child SA Status Timeline** — the same for every CHILD_SA of the
  connection.

Both timelines name the peer's remote ID next to the instance and the
connection.

The next panel shows how often the connection was set up anew:

![IKE SA churn](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-ipsec-churn.png)

* **IKE SA churn [IKE SAs per interval]** — the number of IKE_SAs the
  connection had per interval, at least one hour. Every rekey, reauthentication
  and reconnect creates a new IKE_SA. The dashed line is the count the
  configured rekey and reauthentication intervals account for. A count above
  it means reconnects: a DPD timeout, a restarted peer or pod, a failing
  authentication. Rekey times are randomized, so a single IKE_SA above the line
  is noise; a lasting gap is not. While a connection keeps failing, the
  initiating side shows its retries here, one IKE_SA per attempt, as far as the
  scrapes catch them.

The last band shows the traffic of the tunnel:

![IPsec connection
traffic](https://docs.cennso.com/api/assets/components/cgw/1.12/assets/cgw-dashboard-ipsec-connection-traffic.png)

* **Traffic per IKE [bits/s, packets/s]** — traffic of all CHILD_SAs of the
  connection.
* **Traffic per SA [bits/s, packets/s]** — the same, split per CHILD_SA.

The legends name the peer's remote ID.

Both use the conventions of the throughput panels: RX below the zero line in
orange, TX above in blue, bits on the left axis and packets dashed on the
right.
