UNPKG

openclaw-grafana-lens

Version:

OpenClaw plugin that gives AI agents full Grafana access — 18 composable tools for PromQL/LogQL/TraceQL queries, dashboard creation, alerting, SRE investigation, security monitoring, data collection pipeline management via Grafana Alloy (29 recipes), and

94 lines (93 loc) 3.01 kB
/** * grafana_check_alerts tool * * Seven actions in one tool: * - list: Return pending alerts from the webhook store * - acknowledge: Mark an alert as investigated * - list_rules: List all configured alert rules from Grafana * - delete_rule: Delete an alert rule by UID * - silence / unsilence: Mute / unmute alerts during investigation * - setup: Create webhook contact point + notification policy route in Grafana * * The "setup" action is idempotent — if the contact point already exists, * it returns the existing UID without creating a duplicate. */ import { GrafanaClientRegistry } from "../grafana-client-registry.js"; import type { AlertStore } from "../services/alert-webhook.js"; export declare function createCheckAlertsToolFactory(registry: GrafanaClientRegistry, store: AlertStore): (_ctx: unknown) => { name: string; label: string; description: string; parameters: { type: "object"; properties: { action: { type: string; enum: string[]; description: string; }; alertId: { type: string; description: string; }; matchers: { type: string; items: { type: string; properties: { name: { type: string; description: string; }; value: { type: string; description: string; }; isRegex: { type: string; description: string; }; }; required: string[]; }; description: string; }; duration: { type: string; description: string; }; comment: { type: string; description: string; }; ruleUid: { type: string; description: string; }; silenceId: { type: string; description: string; }; compact: { type: string; description: string; }; webhookUrl: { type: string; description: string; }; }; }; execute(_toolCallId: string, params: Record<string, unknown>): Promise<{ content: Array<{ type: "text"; text: string; }>; details: unknown; }>; }; /** * Extract rule UID from a Grafana generator URL. * Format: http://localhost:3000/alerting/<ruleUID>/edit (or /view) */ export declare function extractRuleUidFromGeneratorUrl(url: string): string | null;