Server Cluster Monitoring — Observability Stack
Purpose
The monitoring module provides a comprehensive observability stack for the server cluster using Prometheus (metrics), Loki (logs), Grafana (visualisation), and Grafana Alloy for authenticated OTLP ingestion. All components are configured as reusable NixOS modules with automatic cross-host discovery.
The system consists of three layers:
-
Exporters (run on all servers)
node_exporterwith an explicit, minimal collector profile for system-level metrics- NixOS build metadata exported through the
node_exportertextfile collector - Grafana Alloy for shipping journald logs and Caddy access logs to Loki
- Conditional Exporters: The following exporters are enabled if their corresponding services are configured on the host:
- Caddy access logs are parsed and sent to Loki
- fail2ban exporter available on the IO Coordinator
- PostgreSQL exporter available on the Database Coordinator
- Redis exporter available on the Database Coordinator
- Proxmox exporter available on the Monitoring Coordinator
-
Collectors (run on the Monitoring Coordinator)
- Prometheus for metrics aggregation
- Loki for log aggregation with 90-day retention
- Alertmanager for alert routing and notifications
- OTLP/HTTP ingestion on
otlp.${data.site.domain}with bearer-token authentication
-
Visualisation (runs on the Monitoring Coordinator)
- Grafana with provisioned datasources and dashboards
Entry Point
- Main file:
modules/nixos/server/monitoring/default.nix
Architecture / Services / Scope
Configuration
Enabling Monitoring
Monitoring is enabled by default on all servers, this can be disabled with server.monitoring.enable = false.
Options
server.monitoring.collector.alerting.enable
| Type | boolean |
| Default | cfg.enable |
| Example | true |
Whether to enable Alertmanager and alert rules.
server.monitoring.collector.alerting.homeAssistant.enable
| Type | boolean |
| Default | false |
| Example | true |
Whether to enable Home Assistant webhook alerting.
server.monitoring.collector.alerting.nextcloudTalk.enable
| Type | boolean |
| Default | false |
| Example | true |
Whether to enable Nextcloud Talk webhook alerting.
server.monitoring.collector.enable
| Type | boolean |
| Default | thisIsMonitoringPrimaryHost && cfg.enable |
| Example | true |
Whether to enable monitoring collector services (Prometheus, Loki, Grafana).
server.monitoring.collector.grafana.kanidm.enable
| Type | boolean |
| Default | true |
| Example | true |
Whether to enable Kanidm OAuth2 authentication for Grafana.
server.monitoring.collector.otlp.bearerTokenSecret
| Type | string |
| Default | "MONITORING/OLTP/BEARER_TOKEN" |
SOPS secret path used as the bearer token for OTLP/HTTP ingestion.
server.monitoring.collector.otlp.enable
| Type | boolean |
| Default | isThisMonitoringPrimaryHost && cfg.enable |
| Example | true |
Whether to enable OTLP/HTTP ingestion via Grafana Alloy.
server.monitoring.collector.otlp.port
| Type | signed integer |
| Default | 4318 |
Port for the OTLP/HTTP ingestion endpoint.
server.monitoring.collector.otlp.subdomain
| Type | string |
| Default | "otlp" |
Subdomain used for the OTLP/HTTP ingestion endpoint.
server.monitoring.collector.proxmox.enable
| Type | boolean |
| Default | isThisMonitoringPrimaryHost && cfg.enable |
| Example | true |
Whether to enable Proxmox VE metrics collection.
server.monitoring.enable
| Type | boolean |
| Default | true |
| Example | true |
Whether to enable monitoring for this server.
server.monitoring.exporters.caddy.enable
| Type | boolean |
| Default | cfg.enable && config.services.caddy.enable |
| Example | true |
Whether to enable Caddy metrics exporter.
server.monitoring.exporters.fail2ban.enable
| Type | boolean |
| Default | cfg.enable && isThisIOPrimaryHost && config.server.fail2ban.enable |
| Example | true |
Whether to enable fail2ban metrics exporter.
server.monitoring.exporters.node.enable
| Type | boolean |
| Default | cfg.enable |
| Example | true |
Whether to enable node_exporter for system-level metrics.
server.monitoring.exporters.postgres.enable
| Type | boolean |
| Default | cfg.enable && thisIsIOPrimaryHost && hasPostgresDatabases |
| Example | true |
Whether to enable PostgreSQL exporter.
server.monitoring.exporters.process.enable
| Type | boolean |
| Default | cfg.enable |
| Example | true |
Whether to enable Process exporter for monitoring specific processes.
server.monitoring.exporters.redis.enable
| Type | boolean |
| Default | cfg.enable && thisIsIOPrimaryHost && hasRedisInstances |
| Example | true |
Whether to enable Redis exporter.
server.monitoring.logs.capture.allowedClientCommonNames
| Type | list of string |
| Default | [ ] |
Optional allow-list of client certificate common names. Empty means any client cert signed by the configured CA is accepted.
server.monitoring.logs.capture.defaultTTLSeconds
| Type | positive integer, meaning >0 |
| Default | 1800 |
Default expanded-capture duration when no TTL is specified.
server.monitoring.logs.capture.enable
| Type | boolean |
| Default | false |
| Example | true |
Whether to enable mTLS API to temporarily disable journal drops and limits.
server.monitoring.logs.capture.listenAddress
| Type | string |
| Default | "0.0.0.0" |
Address for the capture API listener.
server.monitoring.logs.capture.maxTTLSeconds
| Type | positive integer, meaning >0 |
| Default | 14400 |
Maximum allowed expanded-capture duration.
server.monitoring.logs.capture.port
| Type | 16 bit unsigned integer; between 0 and 65535 (both inclusive) |
| Default | 12445 |
Port for the capture API listener.
server.monitoring.logs.capture.relay.defaultTTLSeconds
| Type | positive integer, meaning >0 |
| Default | 1800 |
Default expanded-capture duration when no TTL is specified.
server.monitoring.logs.capture.relay.enable
| Type | boolean |
| Default | true |
| Example | true |
Whether to enable loopback relay so Grafana can manually trigger expanded capture.
server.monitoring.logs.capture.relay.listenAddress
| Type | string |
| Default | "127.0.0.1" |
Address for the relay listener.
server.monitoring.logs.capture.relay.maxTTLSeconds
| Type | positive integer, meaning >0 |
| Default | 14400 |
Maximum allowed expanded-capture duration.
server.monitoring.logs.capture.relay.port
| Type | 16 bit unsigned integer; between 0 and 65535 (both inclusive) |
| Default | 12446 |
Port for the relay listener.
server.monitoring.logs.capture.relay.targets
| Type | list of string |
| Default | [ "nixai" "nixarr" "nixcloud" "nixdev" "nixio" "nixmon" "nixserv" ] |
Hosts the relay is allowed to trigger for expanded capture.
server.monitoring.logs.capture.relay.tls.caCertSecret
| Type | string |
| Default | "MONITORING/ALLOY_DYNAMIC/CA_CERT" |
SOPS secret containing the PEM CA trust bundle for upstream capture APIs.
server.monitoring.logs.capture.relay.tls.clientCertSecret
| Type | string |
| Default | "MONITORING/ALLOY_DYNAMIC/CLIENT_CERT" |
SOPS secret containing the PEM client certificate chain (leaf followed by intermediate) used by the relay.
server.monitoring.logs.capture.relay.tls.clientKeySecret
| Type | string |
| Default | "MONITORING/ALLOY_DYNAMIC/CLIENT_KEY" |
SOPS secret containing the PEM client private key used by the relay.
server.monitoring.logs.capture.tls.caCertSecret
| Type | string |
| Default | "MONITORING/ALLOY_DYNAMIC/CA_CERT" |
SOPS secret containing the PEM CA trust bundle used to verify client certificates.
server.monitoring.logs.capture.tls.serverCertSecret
| Type | string |
| Default | "MONITORING/ALLOY_DYNAMIC/SERVER_CERT" |
SOPS secret containing the PEM server certificate chain (leaf followed by intermediate) for the capture API.
server.monitoring.logs.capture.tls.serverKeySecret
| Type | string |
| Default | "MONITORING/ALLOY_DYNAMIC/SERVER_KEY" |
SOPS secret containing the PEM server private key for the capture API.
server.monitoring.logs.dropLevels
| Type | list of string |
| Default | [ "debug" "trace" ] |
Detected log levels that are dropped before shipping.
server.monitoring.logs.dropUnits
| Type | list of string |
| Default | [ "hermes-agent.service" "minio.service" "seaweedfs.service" "uptime-kuma.service" "hacompanion.service" ] |
Journal units whose log lines are dropped before shipping. Use this for high-volume units whose output is not useful in Loki.
server.monitoring.logs.enable
| Type | boolean |
| Default | cfg.enable |
| Example | true |
Whether to enable Alloy log shipping.
server.monitoring.logs.extraConfiguration
| Type | strings concatenated with "\n" |
| Default | "" |
Additional configuration for the alloy log processor. This is useful for adding custom Loki stages, relabeling rules, or write targets.
Note that the default configuration for processing the system journal is always included and does not need to be specified here.
server.monitoring.logs.rateLimit.burst
| Type | positive integer, meaning >0 |
| Default | 600 |
Burst size for the journal rate limiter.
server.monitoring.logs.rateLimit.enable
| Type | boolean |
| Default | true |
| Example | true |
Whether to enable rate-limiting low-value journal logs.
server.monitoring.logs.rateLimit.levels
| Type | list of string |
| Default | [ "info" "debug" "trace" ] |
Levels affected by the journal rate limit.
server.monitoring.logs.rateLimit.rate
| Type | positive integer, meaning >0 |
| Default | 120 |
Maximum journal lines per second allowed for rate-limited levels.
server.monitoring.retention.logs
| Type | string |
| Default | "90d" |
Loki log retention period.
server.monitoring.retention.metrics
| Type | string |
| Default | "90d" |
Prometheus TSDB retention period.
server.monitoring.scrapeConfigs
| Type | attribute set of (submodule) |
| Default | { } |
Declarative scrape configs for services running on this host. These are collected by the monitoring primary host and converted into Prometheus scrape configurations.
server.monitoring.scrapeConfigs.<name>.bearer_token_secret
| Type | null or string |
| Default | null |
SOPS secret path for bearer token authentication. When set, the secret will be created on the monitoring primary host.
server.monitoring.scrapeConfigs.<name>.host
| Type | string |
| Default | config.host.name |
Host to scrape metrics from.
server.monitoring.scrapeConfigs.<name>.job_name
| Type | string |
| Default | "‹name›" |
Prometheus job name for this scrape target.
server.monitoring.scrapeConfigs.<name>.metrics_path
| Type | string |
| Default | "/metrics" |
HTTP path to the metrics endpoint.
server.monitoring.scrapeConfigs.<name>.port
| Type | signed integer |
Port the metrics endpoint listens on.
server.monitoring.scrapeConfigs.<name>.scheme
| Type | one of "http", "https" |
| Default | "http" |
URL scheme for scraping.
node_exporter Collector Profile
node_exporter runs with --collector.disable-defaults and only enables the collectors listed below.
This avoids the upstream default set, which includes many hardware, filesystem, and kernel collectors that are useless or misleading inside an LXC.
| Collector | Virtual hosts | Physical hosts | Why |
|---|---|---|---|
filesystem | yes | yes | Root and bind-mount free space inside the container. The Proxmox exporter reports storage allocation, not per-mount free space. |
systemd | yes | yes | Unit state and failed units inside the container. The host cannot see these. |
cpu | no | yes | CPU, memory, disk, and network dashboards/alerts use pve_* metrics for LXCs. Host metrics still use node_*. |
meminfo | no | yes | Same as above. |
netdev | no | yes | Same as above. |
diskstats | no | yes | Per-device I/O on physical hosts. Container I/O comes from pve_disk_*. |
loadavg | no | yes | Host load average. LXC load is host-wide unless lxcfs virtualises it. |
pressure | no | yes | PSI is not reliably namespaced in containers. |
stat | no | yes | Host boot time and context-switch counters. |
time | no | yes | Host clock synchronisation state. |
vmstat | no | yes | Host virtual-memory counters. |
NixOS Build Metadata
A oneshot service writes /var/lib/prometheus-node-exporter/textfile/nixos.prom before node_exporter starts.
The textfile collector exposes:
| Metric | Description |
|---|---|
nixos_system_install_timestamp_seconds | Unix timestamp of the current system activation. |
nixos_system_build_info | Gauge with version, code_name, nixpkgs_revision, and configuration_revision labels. |
Secrets
Declared secrets
| Secret key | Purpose |
|---|---|
MONITORING/OLTP/BEARER_TOKEN | Bearer token for OTLP HTTP ingestion |
MONITORING/GRAFANA/SECRET_KEY | Grafana secret key |
MONITORING/GRAFANA/OAUTH_SECRET | Kanidm OAuth2 secret for Grafana |
MONITORING/HOME_ASSISTANT/WEBHOOK_URL | Home Assistant alert webhook |
MONITORING/NEXTCLOUD_TALK/WEBHOOK_URL | Nextcloud Talk alert webhook |
MONITORING/ALLOY_DYNAMIC/CA_CERT | mTLS CA trust bundle for the dynamic capture API |
MONITORING/ALLOY_DYNAMIC/SERVER_CERT | mTLS server certificate chain for the dynamic capture API |
MONITORING/ALLOY_DYNAMIC/SERVER_KEY | mTLS server key for the dynamic capture API |
MONITORING/ALLOY_DYNAMIC/CLIENT_CERT | mTLS client certificate chain used by the Grafana relay |
MONITORING/ALLOY_DYNAMIC/CLIENT_KEY | mTLS client key used by the Grafana manual-trigger relay |
PROXMOX/USER | Proxmox metrics user |
PROXMOX/TOKEN_ID | Proxmox token name |
PROXMOX/TOKEN_SECRET | Proxmox token secret |
The MONITORING/ALLOY_DYNAMIC/* entries are sops-nix secret names backed by binary files under hosts/server/<host>/alloy/.
Generating Secrets
Generating secure random secrets can be done with the following command:
cat /dev/urandom | tr -dc 'A-Za-z0-9' | head -c 48
The MONITORING/GRAFANA/OAUTH_SECRET must match the value in hosts/server/<Application Server>/secrets.yaml
under KANIDM/OAUTH2/GRAFANA_SECRET (the Kanidm provisioning side).
mTLS CA scope
The dynamic capture API uses Alloy Dynamic Capture Intermediate CA, signed by Fleet mTLS Root CA.
See Internal mTLS CA for the hierarchy, key custody, rotation, and trust-store policy.
MONITORING/ALLOY_DYNAMIC/CA_CERT contains the Fleet root certificate.
The dynamic capture API was never deployed with a legacy CA, so no legacy trust anchors are needed.
SERVER_CERT and CLIENT_CERT are chains ordered leaf first, then the Alloy intermediate.
Alloy leaf certificates
Server certificates are valid for two years and include these SANs:
DNS:<host>DNS:<host>.localdomainDNS:<host>.${data.site.domain}IP:127.0.0.1
The bare host name is required because the relay connects to https://<host>:12445.
data.site.domain is the fleet’s DNS suffix.
Server certificates use extendedKeyUsage = serverAuth.
The client certificate uses commonName = alloy-capture-relay and extendedKeyUsage = clientAuth.
The manual procedure below assumes root.crt, alloy-intermediate.crt and alloy-intermediate.key
from the Internal mTLS CA procedure.
data.site.domain is declared in data/site.nix.
For new hosts, use the provision-alloy-certs helper.
It reads the Fleet root and the Alloy intermediate from a KeePassXC vault, issues the certificates,
SOPS-encrypts the output, and merges each new leaf back into the same vault.
It takes the hosts to provision and defaults to every server host when they are omitted:
provision-alloy-certs --vault pki.kdbx --vault-password-file vault-pass nixai
The vault must contain root/Fleet mTLS Root CA with a cert.pem attachment
and intermediate/alloy-dynamic-capture/Alloy Dynamic Capture Intermediate CA with cert.pem and key.pem attachments.
Override them with --root-entry / --root-common-name and --intermediate-entry / --intermediate-common-name.
The root and intermediate are validated against those common names before anything is issued.
The intermediate private key is streamed into memory for signing and is not written to the work directory.
Pass --include-client to also reissue the nixmon relay client certificate;
the client certificate is skipped by default, and --skip-client states that explicitly.
Leaves are stored under leafs/alloy-dynamic-capture with cert.pem and key.pem attachments,
and the vault is backed up to <db>.bak-<timestamp> before each merge.
The manual procedure below remains the reference for the certificate profiles.
domain="$(nix eval --raw .#data.site.domain)"
for host in nixai nixarr nixcloud nixdev nixio nixmon nixserv; do
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out "$host.key"
openssl req -new -key "$host.key" -subj "/CN=$host" -out "$host.csr"
openssl x509 -req -in "$host.csr" -CA alloy-intermediate.crt -CAkey alloy-intermediate.key \
-CAcreateserial -days 730 -sha256 -out "$host.crt" -extensions v3 \
-extfile <(printf '[v3]\nbasicConstraints=critical,CA:FALSE\nkeyUsage=critical,digitalSignature,keyEncipherment\nextendedKeyUsage=serverAuth\nsubjectKeyIdentifier=hash\nauthorityKeyIdentifier=keyid,issuer\nsubjectAltName=DNS:%s,DNS:%s.localdomain,DNS:%s.%s,IP:127.0.0.1\n' "$host" "$host" "$host" "$domain")
cat "$host.crt" alloy-intermediate.crt > "$host-chain.crt"
done
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out client.key
openssl req -new -key client.key -subj "/CN=alloy-capture-relay" -out client.csr
openssl x509 -req -in client.csr -CA alloy-intermediate.crt -CAkey alloy-intermediate.key \
-CAcreateserial -days 730 -sha256 -out client.crt -extensions v3 \
-extfile <(printf '[v3]\nbasicConstraints=critical,CA:FALSE\nkeyUsage=critical,digitalSignature\nextendedKeyUsage=clientAuth\nsubjectKeyIdentifier=hash\nauthorityKeyIdentifier=keyid,issuer\nsubjectAltName=DNS:alloy-capture-relay\n')
cat client.crt alloy-intermediate.crt > client-chain.crt
Store each certificate as a binary SOPS file under the host directory, then encrypt it in place:
for host in nixai nixarr nixcloud nixdev nixio nixmon nixserv; do
mkdir -p "hosts/server/$host/alloy"
cp root.crt "hosts/server/$host/alloy/CA_CERT"
cp "$host-chain.crt" "hosts/server/$host/alloy/SERVER_CERT"
cp "$host.key" "hosts/server/$host/alloy/SERVER_KEY"
sops encrypt --input-type binary --in-place "hosts/server/$host/alloy/CA_CERT"
sops encrypt --input-type binary --in-place "hosts/server/$host/alloy/SERVER_CERT"
sops encrypt --input-type binary --in-place "hosts/server/$host/alloy/SERVER_KEY"
done
cp client-chain.crt hosts/server/nixmon/alloy/CLIENT_CERT
cp client.key hosts/server/nixmon/alloy/CLIENT_KEY
sops encrypt --input-type binary --in-place hosts/server/nixmon/alloy/CLIENT_CERT
sops encrypt --input-type binary --in-place hosts/server/nixmon/alloy/CLIENT_KEY
sops uses the target path to select the .sops.yaml recipients.
The encrypted file is a SOPS JSON envelope; format = "binary" makes sops-nix decrypt it back to the original PEM.
Only the monitoring host needs the client certificate and key because the relay is gated by server.monitoring.collector.enable.
Capture is enabled for all servers in hosts/server/shared/default.nix and accepts only client certificates with CN=alloy-capture-relay.
Caddy Virtual Hosts
The module configures four virtual hosts on Monitoring Coordinator:
| Service | Subdomain | Access |
|---|---|---|
| Grafana | grafana.${data.site.domain} | Public |
| OTLP | otlp.${data.site.domain} | Public, bearer token required |
| Prometheus | prometheus.${data.site.domain} | LAN |
| Loki | loki.${data.site.domain} | LAN |
Grafana remains protected by the existing Kanidm-backed login flow.
The OTLP ingestion endpoint is intended for machine-to-machine clients and requires an Authorization: Bearer <token> header on every request.
The exposed OTLP/HTTP paths are the standard /v1/metrics and /v1/logs endpoints.
These are defined in hosts/server/nixmon/default.nix and collected by the IO Coordinator’s Caddy configuration.
Alert Rules
The following alerts are configured by default:
| Alert | Condition | Severity |
|---|---|---|
HostDown | up{job="node"} == 0 for 2 minutes | Critical |
DiskSpaceCritical | Root filesystem < 10% free for 5 minutes | Critical |
HighCPUUsage | CPU usage > 90% for 5 minutes | Warning |
HighMemoryUsage | Memory usage > 90% for 5 minutes | Warning |
ServiceDown | up{job!="node"} == 0 for 2 minutes | Critical |
Alerts are routed to:
- Home Assistant: All critical and warning alerts via webhook (requires
collector.alerting.homeAssistant.enable = true) - Nextcloud Talk: Critical alerts only via webhook (requires
collector.alerting.nextcloudTalk.enable = true)
Module Structure
modules/nixos/server/monitoring/
├── default.nix # Entry point, imports sub-modules
├── options.nix # All server.monitoring.* options
├── collector/
│ ├── default.nix # Imports collector sub-modules
│ ├── prometheus.nix # Prometheus server + scrape targets
│ ├── loki.nix # Loki server + storage config
│ ├── grafana.nix # Grafana + Kanidm OAuth2
│ ├── otlp.nix # OTLP ingestion
│ ├── alerting.nix # Alertmanager + alert rules
│ └── dashboards.nix # Dashboard provisioning
├── exporters/
│ ├── default.nix # Imports exporter sub-modules
│ ├── node.nix # node_exporter
│ ├── caddy.nix # Caddy metrics
│ ├── postgres.nix # PostgreSQL exporter
│ ├── redis.nix # Redis exporter
│ └── fail2ban.nix # fail2ban metrics exporter
├── logs/
│ └── alloy.nix # Alloy log shipping
└── integrations/
└── proxmox.nix # PVE exporter for Proxmox API
Operational Notes / Assumptions
Troubleshooting
Checking Service Status
On the monitoring host (Monitoring Coordinator):
systemctl status prometheus.service
systemctl status loki.service
systemctl status grafana.service
systemctl status prometheus-alertmanager.service
systemctl status prometheus-pve-exporter.service
On any server:
systemctl status prometheus-node-exporter.service
systemctl status prometheus-fail2ban-exporter.service
systemctl status alloy.service
Verifying Metrics Collection
Check Prometheus targets are up:
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets[] | {instance: .labels.instance, health: .health}'
Verifying Log Collection
Alloy applies ingest-time parsing for journal stdout logs and Caddy access logs before forwarding to Loki:
-
Caddy access logs are read as JSON, not plain text
-
Legacy timestamps in form
YYYY/MM/DD HH:MM:SSare parsed and used as event timestamps -
ISO-8601 timestamps with a log level prefix are parsed and normalised
-
detected_leveldefaults toinfowhen the source log line does not provide one -
Caddy JSON fields
level,ts,logger, andstatusare extracted into Loki labels and timestamps -
Caddy access logs are read from
/var/log/caddy-access-*.logand use the timestamp and level prefix in each line when present
Log Filtering
Alloy drops journal lines from the units listed in server.monitoring.logs.dropUnits before parsing.
The default list targets high-volume application units.
Lines whose detected level is debug or trace are also dropped.
Alloy also rate-limits low-value levels (info, debug, trace) with a hard cap (server.monitoring.logs.rateLimit).
This protects the central Loki path when one host gets noisy.
Caddy access logs are a separate loki.source.file pipeline and are not affected by these journal filters, so successful requests remain available.
Dynamic Expanded Capture API (mTLS)
Capture is enabled for all servers by hosts/server/shared/default.nix.
Each host exposes an mTLS-protected API to temporarily disable journal drops and rate limits.
This is useful for short incident windows.
- Endpoint:
POST https://<host>:12445/capture - Client cert is required and must chain to
MONITORING/ALLOY_DYNAMIC/CA_CERT - The configured CN allow-list is
alloy-capture-relay - Optional CN allow-list:
server.monitoring.logs.capture.allowedClientCommonNames
Example payloads:
{ "action": "enable_extra_capture", "ttl_seconds": 1800 }
{ "action": "disable_extra_capture" }
Status endpoint:
curl --cert client.crt --key client.key --cacert ca.crt \
https://<host>:12445/status
Manual trigger from Grafana
When both of these are enabled on the monitoring coordinator:
server.monitoring.logs.capture.enable = trueserver.monitoring.logs.capture.relay.enable = true
A loopback relay service is started and Grafana contact points are provisioned.
The dynamic capture API, relay, and control helper are packaged in pkgs/alloy-dynamic-capture
and consumed by modules/nixos/server/monitoring/logs/alloy.nix:
alloy-capture-<host>-enablealloy-capture-<host>-disable
You can manually trigger expanded capture from Grafana UI by opening Alerting → Contact points and clicking Test on the desired contact point. The relay then calls the host mTLS API and applies the configured TTL.
Check Alloy is shipping logs:
journalctl -u alloy.service -f
Query Loki directly:
curl -s 'http://localhost:3100/loki/api/v1/labels' | jq
Common Issues
Grafana OAuth login fails:
- Verify
MONITORING/GRAFANA/OAUTH_SECRETin the Monitoring Coordinator matchesKANIDM/OAUTH2/GRAFANA_SECRETin the Identity Coordinator - Check Kanidm provisioning has the Grafana OAuth2 client configured
- Verify DNS resolves
auth.${data.site.domain}correctly
Prometheus targets showing as down:
- Check firewall rules allow traffic on exporter ports from the monitoring host
- Verify the exporter service is running on the target host
- Check network connectivity between Monitoring Coordinator and the target host
Proxmox metrics missing:
- Verify
PROXMOX/TOKEN_IDandPROXMOX/TOKEN_SECRETare valid - Check PVE API is accessible from Monitoring Coordinator:
curl -k https://pve.${data.site.domain}/api2/json - Review PVE exporter logs:
journalctl -u prometheus-pve-exporter.service