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

78 lines (77 loc) 2.48 kB
/** * create-dashboard tool * * Registers an agent tool that creates Grafana dashboards from templates. * The agent calls this tool when a user asks for a dashboard. * * This tool wraps POST /api/dashboards/db with built-in templates * (llm-command-center, session-explorer, cost-intelligence, tool-performance) * or custom dashboard JSON. */ import { GrafanaClientRegistry } from "../grafana-client-registry.js"; import type { GrafanaClient } from "../grafana-client.js"; import type { QueryValidationEntry } from "./update-dashboard.js"; type Panel = Record<string, unknown>; /** Per-panel validation result for custom dashboards. */ export type PanelValidationDetail = { panelId: number; title: string; status: "ok" | "nodata" | "error" | "skipped"; error?: string; queries?: QueryValidationEntry[]; }; /** Aggregate validation result across all panels. */ export type DashboardValidation = { panelsTotal: number; panelsValid: number; panelsNoData: number; panelsError: number; panelsSkipped: number; details: PanelValidationDetail[]; }; /** * Validate all panel PromQL queries in a custom dashboard. * Dry-runs each panel's expressions and reports per-panel health. * Never throws — individual panel failures are captured as error status. */ export declare function validateDashboardPanels(client: GrafanaClient, panels: Panel[]): Promise<DashboardValidation>; export declare function createDashboardToolFactory(registry: GrafanaClientRegistry): (_ctx: unknown) => { name: string; label: string; description: string; parameters: { type: "object"; properties: { template: { type: string; enum: string[]; description: string; }; title: { type: string; description: string; }; dashboard: { type: string; description: string; }; folderUid: { type: string; description: string; }; overwrite: { type: string; description: string; default: boolean; }; }; }; execute(_toolCallId: string, params: Record<string, unknown>): Promise<{ content: Array<{ type: "text"; text: string; }>; details: unknown; }>; }; export {};