KosmoKrator

analytics

Grafana CLI for Shell Scripts

Use the Grafana CLI for shell scripts with headless JSON commands, schema discovery, credentials, and permission controls.

7 functions 6 read 1 write API token auth

Grafana CLI for Shell Scripts

Call integration functions from shell scripts with stable JSON input and output.

Use shell scripts for small local automations that need one or more integration calls. The Grafana CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.

Command Shape

# Grafana CLI for Shell Scripts
kosmokrator integrations:configure grafana --set api_token="$GRAFANA_API_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call grafana.grafana_list_dashboards '{"query":"example_query","type":"example_type","limit":1}' --json

Discovery Before Execution

Agents and scripts can inspect Grafana docs and schemas before choosing a function.

kosmo integrations:docs grafana --json
kosmo integrations:docs grafana.grafana_list_dashboards --json
kosmo integrations:schema grafana.grafana_list_dashboards --json
kosmo integrations:search "Grafana" --json
kosmo integrations:list --json

Useful Grafana CLI Functions

FunctionTypeParametersDescription
grafana.grafana_list_dashboards Read query, type, limit Search and list Grafana dashboards. Returns dashboard UIDs, titles, and folder info. Use query to filter by title.
grafana.grafana_get_dashboard Read uid Get a Grafana dashboard by its UID. Returns the full dashboard definition including panels, queries, and settings.
grafana.grafana_create_dashboard Write dashboard, folderUid, overwrite Create or update a Grafana dashboard. Provide the full dashboard JSON with panels, queries, and settings. Set overwrite to true to update an existing dashboard.
grafana.grafana_list_datasources Read none List all configured datasources in Grafana. Returns datasource IDs, names, types (e.g., Prometheus, InfluxDB), and access info.
grafana.grafana_list_alerts Read dashboardId, panelId List Grafana alerts. Optionally filter by dashboard ID or panel ID. Returns alert states, thresholds, and conditions.
grafana.grafana_list_teams Read page, perPage List all Grafana teams. Returns team IDs, names, emails, and member counts with pagination support.
grafana.grafana_get_current_user Read none Get the currently authenticated Grafana user. Useful for verifying credentials and identifying the connected account.

Automation Notes

Related Grafana CLI Pages