一键导入
grafana-cli
Perform Grafana operations using the Grafana HTTP API via curl. Use for querying dashboards, datasources, alerts, and annotations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Perform Grafana operations using the Grafana HTTP API via curl. Use for querying dashboards, datasources, alerts, and annotations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use the correct AWS CLI profile when running AWS commands based on the target environment.
Analyze code changes between two local Git branches and perform a comprehensive code review. Use ONLY for local git branch comparisons. Do NOT use when a GitLab or GitHub MR/PR URL or MR ID is provided — use gitlab-cli or github-cli skill instead.
Analyze code changes to prepare conventional commit message and commit to a new branch.
Create optimized, secure, production-ready Dockerfiles based on user requirements and application context.
Create a new SKILL.md file based on a guided conversation about a task or workflow.
Create a detailed upgrade plan for a Helm release managed by Terraform, comparing the current and desired chart versions including breaking changes and required code changes.
| name | grafana-cli |
| description | Perform Grafana operations using the Grafana HTTP API via curl. Use for querying dashboards, datasources, alerts, and annotations. |
Use the instance and rules below when constructing all Grafana API commands.
Update the table below with your Grafana instance URLs and corresponding token file paths:
| Environment | Base URL | Token File |
|---|---|---|
| Production | https://<your-grafana-prod-url> | ~/.grafana/prod.token |
| Staging | https://<your-grafana-staging-url> | ~/.grafana/staging.token |
If the target instance is unclear, ask the user before running any command.
Generate a Grafana API token for each instance you intend to use and save it to the corresponding token file (see instance table above). Never print or display token values. Do not perform these steps yourself.
For each instance:
<BASE_URL> → Administration → Users and access → Service accounts → Add service accountmkdir -p ~/.grafana && echo "<your-api-token>" > <TOKEN_FILE> && chmod 600 <TOKEN_FILE>
All API calls use curl with the token read from the instance's token file (see instance table above):
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/<endpoint>" | jq .
Example (production):
curl -s -H "Authorization: Bearer $(cat ~/.grafana/prod.token)" \
"https://<your-grafana-prod-url>/api/health" | jq .
| Endpoint | Method | Description |
|---|---|---|
/api/org | GET | Get current organisation info |
/api/user | GET | Get current authenticated user |
/api/datasources | GET | List all datasources |
/api/datasources/<id> | GET | Get datasource by ID |
/api/dashboards/home | GET | Get the home dashboard |
/api/search?query=<term> | GET | Search dashboards and folders |
/api/dashboards/uid/<uid> | GET | Get dashboard by UID |
/api/folders | GET | List all folders |
/api/folders/<uid> | GET | Get folder by UID |
/api/alerts | GET | List legacy alerts |
/api/v1/provisioning/alert-rules | GET | List all alert rules |
/api/v1/provisioning/alert-rules/<uid> | GET | Get alert rule by UID |
/api/annotations | GET | List annotations |
/api/health | GET | Check Grafana health |
| Endpoint | Method | Description |
|---|---|---|
/api/dashboards/db | POST | Create or update a dashboard |
/api/folders | POST | Create a folder |
/api/folders/<uid> | PUT | Update a folder |
/api/annotations | POST | Create an annotation |
/api/annotations/<id> | PUT | Update an annotation |
/api/v1/provisioning/alert-rules | POST | Create an alert rule |
/api/v1/provisioning/alert-rules/<uid> | PUT | Update an alert rule |
| Endpoint | Method | Reason |
|---|---|---|
/api/dashboards/uid/<uid> | DELETE | Irreversible dashboard deletion |
/api/folders/<uid> | DELETE | Deletes folder and all its dashboards |
/api/datasources/<id> | DELETE | Removes datasource used by dashboards |
/api/annotations/<id> | DELETE | Irreversible annotation deletion |
/api/v1/provisioning/alert-rules/<uid> | DELETE | Removes alert rule permanently |
/api/admin/users/<id> | DELETE | Deactivates a user account |
$(cat <TOKEN_FILE>) — never hardcode a token value in a command.-s (silent) to curl to suppress progress output, and pipe through jq for readable output.page and perpage fields and iterate if needed.