Grafana
Turn Grafana alerts into timeline sparklines on your Lock Screen. See metric history at a glance with real-time updates while alerts are firing.
This page covers the standalone pushward-grafana service for timeline sparklines. For simple alert-style notifications (firing/resolved), use the Relay integration instead — no extra container needed.
How It Works
- Webhook — Grafana fires an alert and sends the webhook to pushward-grafana
- Query — The service queries Prometheus or VictoriaMetrics for the metric's recent history
- Timeline — A Live Activity starts with a sparkline chart showing the metric over time
- Poll — While the alert is firing, the service polls for new data points and pushes updates
- Resolve — When the alert resolves, the activity ends with a final snapshot
Setup
1. Get Your Integration Key
Open the PushWard app → Settings → Integration Key to find your default hlk_ key.
To create a dedicated key for this integration:
- Go to Settings → Manage Keys
- Tap +
- Set name (e.g. "Grafana"), choose , Full management scope, and restrict to
grafana-* - Copy the generated
hlk_key
2. Deploy the Service
services:
pushward-grafana:
image: ghcr.io/mac-lucky/pushward-grafana:latest
ports:
- "8090:8090"
environment:
PUSHWARD_URL: https://api.pushward.app
PUSHWARD_API_KEY: hlk_YOUR_INTEGRATION_KEY
PUSHWARD_METRICS_URL: http://prometheus:9090
# Optional: webhook secret (must match Grafana contact point)
# PUSHWARD_WEBHOOK_TOKEN: your-shared-secret
# Optional: Grafana API for auto-extracting PromQL from alert rules
# PUSHWARD_GRAFANA_URL: http://grafana:3000
# PUSHWARD_GRAFANA_API_TOKEN: glsa_...
restart: unless-stopped3. Configure Grafana Contact Point
- Navigate to Alerts & IRM > Alerting > Contact points
- Click + Add contact point
- Select Webhook as the integration type
- Set URL to your pushward-grafana instance (e.g.
http://pushward-grafana:8090/webhook) - If you set
PUSHWARD_WEBHOOK_TOKEN, expand Optional settings and set Authorization header scheme toBearerwith the matching token - Click Test, then Save
Create a Notification policy that routes alerts to this contact point.
Configuration
| Environment Variable | Description | Default |
|---|---|---|
PUSHWARD_URL | PushWard server URL | -- |
PUSHWARD_API_KEY | Integration key (hlk_ prefix) | -- |
PUSHWARD_METRICS_URL | Prometheus or VictoriaMetrics URL | -- |
PUSHWARD_WEBHOOK_TOKEN | Shared secret for webhook authentication | (none) |
PUSHWARD_SERVER_ADDRESS | HTTP listen address | :8090 |
PUSHWARD_PRIORITY | Activity priority (0-10) | 5 |
PUSHWARD_CLEANUP_DELAY | Delay before cleanup after resolved | 15m |
PUSHWARD_STALE_TIMEOUT | Ends activity if no updates received | 24h |
PUSHWARD_GRAFANA_URL | Grafana API URL for auto-extracting PromQL | (none) |
PUSHWARD_GRAFANA_API_TOKEN | Grafana service account token (Editor role) | (none) |
PUSHWARD_TIMELINE_HISTORY_WINDOW | How far back to query on alert fire | 30m |
PUSHWARD_TIMELINE_POLL_INTERVAL | How often to poll for fresh data points | 30s |
PUSHWARD_TIMELINE_SMOOTHING | Curve smoothing on sparkline | true |
PUSHWARD_TIMELINE_SCALE | linear or logarithmic | linear |
PUSHWARD_TIMELINE_DECIMALS | Value precision | 1 |
Dashboard Links
The bridge forwards the alert's silenceURL, generatorURL, and panel
links straight through to the notification — both http:// and https:// schemes are accepted, so a self-hosted Grafana on a LAN (e.g. http://grafana.internal/d/abc) round-trips cleanly for users on VPN. URLs without an http(s):// scheme are dropped on the way in.
PromQL Resolution
pushward-grafana needs a PromQL expression to query metric history. It resolves the query in this order:
- Auto-extract (recommended) — If
PUSHWARD_GRAFANA_URLandPUSHWARD_GRAFANA_API_TOKENare set, the service reads the alert rule's PromQL expression via the Grafana API. No per-rule configuration needed. - Annotations — Add annotations to your Grafana alert rules to specify the query explicitly.
- Webhook values — Falls back to the numeric values included in the Grafana webhook payload (no history, just the current value).
Per-Rule Annotations
Add these annotations to your Grafana alert rules when not using auto-extract:
| Annotation | Description | Example |
|---|---|---|
pushward_query | PromQL expression for history backfill | avg(rate(http_requests_total[5m])) |
pushward_unit | Unit label shown on the sparkline | %, °C, ms |
pushward_threshold | Threshold value shown as dashed line | 80 |
pushward_ref_id | Which values key to use (default: first) | B |
Severity Colors
The sparkline accent color and icon are derived from the severity label on the alert rule:
| Severity Label | Color | Icon |
|---|---|---|
warning | Orange | Alert |
info | Blue | Information |
Add a severity label to your alert rules (e.g. severity = warning) for automatic color and icon theming.