Grafana
Grafana アラートを Lock Screen 上の timeline スパークラインに変換します。アラート発生中もリアルタイムで更新され、メトリクスの履歴を一目で確認できます。

Two ways to bring Grafana into PushWard. The app plugin below is the recommended path — it runs the timeline bridge and a widget engine inside Grafana, with one-click setup. For simple alert-style notifications (firing/resolved, no history), the Relay integration needs no plugin or container at all.
Get Your Integration Key
PushWard アプリを開き、設定 → 連携キーでデフォルトの hlk_ キーを確認します。
この連携用に専用のキーを作成するには:
- 設定 → キーの管理を開きます
- + をタップします
- 名前を設定し(例:「Grafana」)、選択:, フル管理 スコープを選択し、限定する対象:
grafana-* - 生成された
hlk_キーをコピーします
Grafana App Plugin (Recommended)
The PushWard app plugin is the in-Grafana setup and management layer. One click wires up the webhook contact point, validates your key, and renders the live timeline sparkline inside Grafana using your existing datasource — no separate container and no extra Prometheus config. It can also poll PromQL on a schedule and publish the results as iOS Home and Lock Screen widgets, so it fully replaces the standalone container described further down.
Grafana hardcodes its native contact-point types in core, so no third party can add one — every integration (including Grafana's own OnCall) delivers through a webhook contact point. This plugin makes that setup first-class and one-click; it doesn't replace the webhook.
Requirements
- Grafana 12.3 or newer (unified alerting plus app-plugin IAM service accounts)
- A PushWard integration key (
hlk_prefix) — thenotificationscapability for test pushes, andwidgetsto publish widgets - A Prometheus or VictoriaMetrics datasource in Grafana (for the timeline history)
1. Install the Plugin
Self-hosted today: download the release ZIP from the plugin repository,
unzip it into your Grafana plugins/ directory, and allowlist the unsigned plugin:
[plugins]
allow_loading_unsigned_plugins = pushward-alerts-appRestart Grafana, then enable the app under Administration > Plugins > PushWard and open its Configuration page.
2. Connect
On the Connect page, one click creates the PushWard webhook contact point (no manual URL or header copying) along with a scoped Grafana service-account token, and validates your integration key against the PushWard API. Add that contact point to any alert rule's notification policy to start receiving timelines.
3. Configure
On the Configuration page (Admin only) you set:
- Integration key — your
hlk_key - Datasource — the Prometheus/VictoriaMetrics datasource the backend queries for metric history
- Severity mapping — which alert label drives the accent color and icon
- History window and poll interval — how far back to backfill and how often to refresh while firing
- Widgets — the widget definitions described below
Widget Engine
Beyond timelines, the backend can poll PromQL on a schedule and publish the results as iOS widgets.
Declare value, progress, status, gauge, and stat_list widgets in the configuration; each runs on its own interval with an on_change or always trigger mode, and a multi-series query fans out into
one widget update per series.
Management and Dashboard
The Overview, Activities, and Widgets pages show current Live Activities, a recent delivery log, and your declared widgets, and let you send a test notification or fire a test timeline. Enabling the app also imports a PushWard Delivery dashboard that charts backend metrics — alerts received, activities created, pushes sent, and errors. Alert rules and instances get a View in PushWard action too.
Standalone Container (Legacy)
The standalone pushward-grafana container will soon be deprecated in favor of the app plugin above, which covers the same timeline bridge plus widgets with no separate deployment. Use it only if you can't run an app plugin on your Grafana.
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
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-stoppedConfigure the 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
| 環境変数 | 説明 | デフォルト |
|---|---|---|
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
The timeline needs a PromQL expression to query metric history. The app plugin reads the firing rule's query from your datasource automatically; the standalone container 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 to override the query or tune the sparkline:
| 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 |
|---|---|---|
critical | Red | Alert circle |
warning | Orange | Alert |
info | Blue | Information |
Add a severity label to your alert rules (e.g. severity = critical) for automatic color and icon theming.