analytics
Grafana CLI for Cron Jobs
Use the Grafana CLI for cron jobs with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 6 read 1 write API token auth
Grafana CLI for Cron Jobs
Schedule repeatable integration workflows from cron while keeping credentials in KosmoKrator config.
Use the headless CLI from cron when an operation should run without an interactive agent session. 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 Cron Jobs
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
| Function | Type | Parameters | Description |
|---|---|---|---|
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
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.