Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

grafana-webhooks

БесплатноЗапускает вложенные скриптыНе проверен

Receive and verify Grafana Alerting webhook contact point notifications. Use when setting up a Grafana webhook receiver, debugging Grafana HMAC signature…

hookdeckот hookdeck★ 104 звезды на GitHub

Об этом скилле

Grafana Webhooks

Covers the Grafana Alerting webhook contact point (Grafana-managed alerting, the only alerting system in Grafana 11+; also Grafana Cloud).

Not covered: Grafana legacy dashboard alerting webhooks (removed in Grafana 11 — different payload with ruleName/evalMatches, no HMAC); Grafana OnCall / IRM outgoing webhooks (separate product, own templates and auth); Prometheus Alertmanager webhook_config (payload is a close relative — Grafana's is Alertmanager's plus extra fields — but Alertmanager has no HMAC signing).

When to Use This Skill

  • How do I receive Grafana alert webhooks?
  • How do I verify a Grafana webhook signature?
  • What is X-Grafana-Alerting-Signature and how do I check it?
  • Why is my Grafana webhook HMAC verification failing?
  • How do I tell a firing alert from a resolved one in the Grafana payload?
  • How do I secure a Grafana webhook contact point (HMAC, basic auth, bearer token)?

Verification (core)

HMAC-SHA256, lowercase hex, over the raw body — or over <unix-seconds> + ":" + rawBody when a timestamp header is configured. The digest is bare: no sha256= prefix, no t=...,v1= structure. Both header names are user-configurable; the signature header defaults to X-Grafana-Alerting-Signature and the timestamp header has no default name (unset = body-only signing).

Node:

const crypto = require('crypto');

function verify(rawBody, signature, timestamp, secret) {
  if (!signature || !secret) return false;
  const hmac = crypto.createHmac('sha256', secret);       // secret used as-is (UTF-8)
  if (timestamp) hmac.update(`${timestamp}:`);            // COLON separator, seconds
  hmac.update(rawBody);                                   // RAW bytes, never re-serialized JSON
  const expected = hmac.digest('hex');
  const received = Buffer.from(signature.toLowerCase(), 'utf8');
  const want = Buffer.from(expected, 'utf8');
  return received.length === want.length && crypto.timingSafeEqual(received, want);
}

Python:

import hmac, hashlib

def verify(raw_body: bytes, signature: str, timestamp: str | None, secret: str) -> bool:
    if not signature or not secret:
        return False
    mac = hmac.new(secret.encode("utf-8"), digestmod=hashlib.sha256)
    if timestamp:
        mac.update(f"{timestamp}:".encode("utf-8"))   # COLON separator, unix seconds
    mac.update(raw_body)                              # RAW bytes
    # Compare bytes: compare_digest raises TypeError on non-ASCII str input
    received = signature.strip().lower().encode("utf-8", errors="replace")
    return hmac.compare_digest(received, mac.hexdigest().encode("ascii"))

If you configure a timestamp header, also reject stale timestamps (a replay window is your choice — Grafana documents no tolerance; 300s is a sane default) and reject requests that arrive without the header.

For complete handlers with route wiring, dispatch, and tests, see:

No Event Types — Dispatch on Status

Grafana sends no event-type header and no event-type field. Each request is one notification for an alert group. Dispatch on these fields instead:

Field Values Meaning
status firing, resolved Group status — firing if any alert in the group is firing
state alerting, ok Grafana's equivalent of status
alerts[].status firing, resolved Per-alert status

A firing notification can contain individual resolved alerts, so iterate alerts[] rather than trusting the top-level status alone. Resolved notifications can be turned off with Disable resolved message.

Payload Shape (default)

{
  "receiver": "My Super Webhook",
  "status": "firing",
  "orgId": 1,
  "alerts": [
    {
      "status": "firing",
      "labels": { "alertname": "High memory usage", "team": "blue", "zone": "us-1" },
      "annotations": { "description": "The system has high memory usage" },
      "startsAt": "2021-10-12T09:51:03.157076+02:00",
      "endsAt": "0001-01-01T00:00:00Z",
      "generatorURL": "https://play.grafana.org/alerting/1afz29v7z/edit",
      "fingerprint": "c6eadffa33fcdf37",
      "silenceURL": "https://play.grafana.org/alerting/silence/new?...",
      "dashboardURL": "",
      "panelURL": "",
      "values": { "B": 44.23943737541908, "C": 1 }
    }
  ],
  "groupLabels": {},
  "commonLabels": { "team": "blue" },
  "commonAnnotations": {},
  "externalURL": "https://play.grafana.org/",
  "version": "1",
  "groupKey": "{}:{}",
  "truncatedAlerts": 0,
  "title": "[FIRING:2]  (blue)",
  "state": "alerting",
  "message": "**Firing**\n..."
}

endsAt is "0001-01-01T00:00:00Z" while an alert is still firing. title and message are template-driven. truncatedAlerts counts alerts dropped by Max Alerts. With the **Custo

Полный SKILL.md на GitHub

Установить grafana-webhooks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

TODO.mdexamples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/grafana/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

Что делает скилл grafana-webhooks?

Receive and verify Grafana Alerting webhook contact point notifications. Use when setting up a Grafana webhook receiver, debugging Grafana HMAC signature verification (X-Grafana-Alerting-Signature, HMAC-SHA256 hex over the raw body, optionally timestamp + ":" + body), or handling firing and resolved alert notifications from Grafana-managed alerting or Grafana Cloud.

Как установить скилл grafana-webhooks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл grafana-webhooks запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить grafana-webhooks с