Overview
Runs Grafana with the expanse-prometheus datasource pointing at prometheusUrl and Expanse's cluster-health dashboard provisioned: node health, resource health, volume health, quorum, and per-node degraded and unreachable flags. With a storage entry, Grafana's database and plugins live on the volume.
Grafana 13.2 no longer includes its Prometheus datasource, so nodes also need Expanse's packages.grafana-plugins flake output (nix/grafana-plugins.nix, which ships grafanaPlugins.prometheus). The block links the shipped plugins into Grafana's plugin directory on every start; plugins installed through Grafana's UI stay as they are.
- Shape
- Singleton on a replicated volume
- Reached at
- Node port, or a VIP
- Node package
pkgs.grafanaand Expanse'spackages.grafana-plugins
Fetched on demand: the first time a block of this type is placed on a node, its agent fetches pkgs.grafana and Expanse's packages.grafana-plugins, built from the node's own nixpkgs so the NixOS binary cache serves it. That first placement needs network access (or a binary cache on the LAN) and waits for the download; later placements on that node start at once.
Example
apiVersion: expanse.io/v1 kind: Block metadata: name: grafana namespace: default spec: type: monitor/grafana replicas: 1 strategy: kind: SINGLETON storage: - name: data size: 1Gi replication: 3 mountPath: /var/lib/grafana config: prometheusUrl: http://<prometheus block address> adminPassword: <at least 8 characters>
$ expanse ctl block apply -f grafana.yaml --dry-run # validate only $ expanse ctl block apply -f grafana.yaml
Configuration
Keys go under spec.config and are checked against the type's JSON Schema when the block is applied. A default is what the block uses when the key is unset.
| Key | Default | Meaning |
|---|---|---|
prometheusUrl | required | URL of the Prometheus to query, such as the monitor/prometheus block's address. The deploy form lists the Prometheus blocks' addresses and fills in the only one. |
adminPassword | required | Password of Grafana's admin user, at least 8 characters. Applied only when Grafana first creates its database; change it later in Grafana. Sealed: kept out of the stored block (block secrets). |
port | 3000 | Port of the web UI. |
anonymousViewer | false | Let anyone who reaches the port view dashboards without logging in. |
Using it
Open http://<address>:3000/ and log in as admin. Grafana's usage reporting, update checks and plugin preinstall are turned off, so it starts on a cluster with no internet access.
When a node fails
With a replicated volume, the singleton restarts on the node that takes over the volume's primary, with the same users and dashboards.
Limits
- One datasource is provisioned; add more in Grafana.
Source
- docs/OBSERVABILITY.md: the Expanse guide this page follows.
- nix/blocks/monitor/grafana: the type's identity and JSON Schema.