← 返回 Skills 市场
byungkyu

Grafana

作者 byungkyu · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
330
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install grafana-api
功能描述
Grafana API integration with managed authentication. Manage dashboards, data sources, folders, annotations, alerts, and teams. Use this skill when users want...
使用说明 (SKILL.md)

Grafana

Access Grafana dashboards, data sources, folders, annotations, and alerts via managed API authentication.

Quick Start

python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/grafana/api/search?type=dash-db')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://gateway.maton.ai/grafana/{native-api-path}

The gateway proxies requests to your Grafana instance and automatically injects authentication.

Authentication

All requests require the Maton API key:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Grafana connections at https://ctrl.maton.ai.

List Connections

python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=grafana&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python \x3C\x3C'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'grafana'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Open the returned url in a browser to complete authentication. You'll need to provide your Grafana service account token.

Delete Connection

python \x3C\x3C'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

API Reference

Organization & User

Get Current Organization

GET /grafana/api/org

Response:

{
  "id": 1,
  "name": "Main Org.",
  "address": {
    "address1": "",
    "address2": "",
    "city": "",
    "zipCode": "",
    "state": "",
    "country": ""
  }
}

Get Current User

GET /grafana/api/user

Response:

{
  "id": 1,
  "uid": "abc123",
  "email": "[email protected]",
  "name": "User Name",
  "login": "user",
  "orgId": 1,
  "isGrafanaAdmin": false
}

Dashboards

Search Dashboards

GET /grafana/api/search?type=dash-db

Query Parameters:

  • type - dash-db for dashboards, dash-folder for folders
  • query - Search query string
  • tag - Filter by tag
  • folderIds - Filter by folder IDs
  • limit - Max results (default 1000)

Response:

[
  {
    "id": 1,
    "uid": "abc123",
    "title": "My Dashboard",
    "uri": "db/my-dashboard",
    "url": "/d/abc123/my-dashboard",
    "type": "dash-db",
    "tags": ["production"],
    "isStarred": false
  }
]

Get Dashboard by UID

GET /grafana/api/dashboards/uid/{uid}

Response:

{
  "meta": {
    "type": "db",
    "canSave": true,
    "canEdit": true,
    "canAdmin": true,
    "canStar": true,
    "slug": "my-dashboard",
    "url": "/d/abc123/my-dashboard",
    "expires": "0001-01-01T00:00:00Z",
    "created": "2024-01-01T00:00:00Z",
    "updated": "2024-01-02T00:00:00Z",
    "version": 1
  },
  "dashboard": {
    "id": 1,
    "uid": "abc123",
    "title": "My Dashboard",
    "tags": ["production"],
    "panels": [...],
    "schemaVersion": 30,
    "version": 1
  }
}

Create/Update Dashboard

POST /grafana/api/dashboards/db
Content-Type: application/json

{
  "dashboard": {
    "title": "New Dashboard",
    "panels": [],
    "schemaVersion": 30,
    "version": 0
  },
  "folderUid": "optional-folder-uid",
  "overwrite": false
}

Response:

{
  "id": 1,
  "uid": "abc123",
  "url": "/d/abc123/new-dashboard",
  "status": "success",
  "version": 1,
  "slug": "new-dashboard"
}

Delete Dashboard

DELETE /grafana/api/dashboards/uid/{uid}

Response:

{
  "title": "My Dashboard",
  "message": "Dashboard My Dashboard deleted",
  "id": 1
}

Get Home Dashboard

GET /grafana/api/dashboards/home

Folders

List Folders

GET /grafana/api/folders

Response:

[
  {
    "id": 1,
    "uid": "folder123",
    "title": "My Folder",
    "url": "/dashboards/f/folder123/my-folder",
    "hasAcl": false,
    "canSave": true,
    "canEdit": true,
    "canAdmin": true
  }
]

Get Folder by UID

GET /grafana/api/folders/{uid}

Create Folder

POST /grafana/api/folders
Content-Type: application/json

{
  "title": "New Folder"
}

Response:

{
  "id": 1,
  "uid": "folder123",
  "title": "New Folder",
  "url": "/dashboards/f/folder123/new-folder",
  "hasAcl": false,
  "canSave": true,
  "canEdit": true,
  "canAdmin": true,
  "version": 1
}

Update Folder

PUT /grafana/api/folders/{uid}
Content-Type: application/json

{
  "title": "Updated Folder Name",
  "version": 1
}

Delete Folder

DELETE /grafana/api/folders/{uid}

Data Sources

List Data Sources

GET /grafana/api/datasources

Response:

[
  {
    "id": 1,
    "uid": "ds123",
    "orgId": 1,
    "name": "Prometheus",
    "type": "prometheus",
    "access": "proxy",
    "url": "http://prometheus:9090",
    "isDefault": true,
    "readOnly": false
  }
]

Get Data Source by ID

GET /grafana/api/datasources/{id}

Get Data Source by UID

GET /grafana/api/datasources/uid/{uid}

Get Data Source by Name

GET /grafana/api/datasources/name/{name}

Create Data Source

POST /grafana/api/datasources
Content-Type: application/json

{
  "name": "New Prometheus",
  "type": "prometheus",
  "url": "http://prometheus:9090",
  "access": "proxy",
  "isDefault": false
}

Update Data Source

PUT /grafana/api/datasources/{id}
Content-Type: application/json

{
  "name": "Updated Prometheus",
  "type": "prometheus",
  "url": "http://prometheus:9090",
  "access": "proxy"
}

Delete Data Source

DELETE /grafana/api/datasources/{id}

Annotations

List Annotations

GET /grafana/api/annotations

Query Parameters:

  • from - Epoch timestamp (ms)
  • to - Epoch timestamp (ms)
  • dashboardId - Filter by dashboard ID
  • dashboardUID - Filter by dashboard UID
  • panelId - Filter by panel ID
  • tags - Filter by tags (comma-separated)
  • limit - Max results

Create Annotation

POST /grafana/api/annotations
Content-Type: application/json

{
  "dashboardUID": "abc123",
  "time": 1609459200000,
  "text": "Deployment completed",
  "tags": ["deployment", "production"]
}

Response:

{
  "message": "Annotation added",
  "id": 1
}

Update Annotation

PUT /grafana/api/annotations/{id}
Content-Type: application/json

{
  "text": "Updated annotation text",
  "tags": ["updated"]
}

Delete Annotation

DELETE /grafana/api/annotations/{id}

Teams

Search Teams

GET /grafana/api/teams/search

Query Parameters:

  • query - Search query
  • page - Page number
  • perpage - Results per page

Response:

{
  "totalCount": 1,
  "teams": [
    {
      "id": 1,
      "orgId": 1,
      "name": "Engineering",
      "email": "[email protected]",
      "memberCount": 5
    }
  ],
  "page": 1,
  "perPage": 1000
}

Get Team by ID

GET /grafana/api/teams/{id}

Create Team

POST /grafana/api/teams
Content-Type: application/json

{
  "name": "New Team",
  "email": "[email protected]"
}

Update Team

PUT /grafana/api/teams/{id}
Content-Type: application/json

{
  "name": "Updated Team Name"
}

Delete Team

DELETE /grafana/api/teams/{id}

Alert Rules (Provisioning API)

List Alert Rules

GET /grafana/api/v1/provisioning/alert-rules

Get Alert Rule

GET /grafana/api/v1/provisioning/alert-rules/{uid}

List Alert Rules by Folder

GET /grafana/api/ruler/grafana/api/v1/rules

Service Accounts

Search Service Accounts

GET /grafana/api/serviceaccounts/search

Response:

{
  "totalCount": 1,
  "serviceAccounts": [
    {
      "id": 1,
      "name": "api-service",
      "login": "sa-api-service",
      "orgId": 1,
      "isDisabled": false,
      "role": "Editor"
    }
  ],
  "page": 1,
  "perPage": 1000
}

Plugins

List Plugins

GET /grafana/api/plugins

Response:

[
  {
    "name": "Prometheus",
    "type": "datasource",
    "id": "prometheus",
    "enabled": true,
    "pinned": false
  }
]

Code Examples

JavaScript

const response = await fetch('https://gateway.maton.ai/grafana/api/search?type=dash-db', {
  headers: {
    'Authorization': `Bearer ${process.env.MATON_API_KEY}`
  }
});
const dashboards = await response.json();
console.log(dashboards);

Python

import os
import requests

response = requests.get(
    'https://gateway.maton.ai/grafana/api/search?type=dash-db',
    headers={
        'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'
    }
)
print(response.json())

Notes

  • Dashboard UIDs are unique identifiers used in most operations
  • Use /api/search?type=dash-db to find dashboard UIDs
  • Folder operations require folder UIDs
  • Some admin operations (list all users, orgs) require elevated permissions
  • Alert rules use the provisioning API (/api/v1/provisioning/...)
  • Annotations require epoch timestamps in milliseconds

Error Handling

Status Meaning
200 Success
400 Invalid request
401 Invalid or missing authentication
403 Permission denied
404 Resource not found
409 Conflict (e.g., duplicate name)
412 Precondition failed (version mismatch)
422 Unprocessable entity

Resources

安全使用建议
This skill is internally consistent, but it relies on a third‑party proxy (maton.ai/gateway.maton.ai/ctrl.maton.ai). Before installing: verify Maton is a trusted provider, understand that MATON_API_KEY grants the proxy access to your Grafana API, and avoid giving an overly-privileged key (use least privilege). Review Maton's privacy/retention policy and rotate keys after use. If you prefer not to route Grafana traffic through an external gateway, consider a direct Grafana integration instead.
功能分析
Type: OpenClaw Skill Name: grafana-api Version: 1.0.0 The skill provides a standard integration for managing Grafana instances via a managed API gateway (gateway.maton.ai). It includes documentation and code examples for common operations like searching dashboards, managing data sources, and handling alerts using the MATON_API_KEY. No evidence of malicious intent, data exfiltration, or prompt injection was found; the behavior is consistent with its stated purpose of providing a proxied API interface.
能力评估
Purpose & Capability
Name/description match the behavior: it documents calling a Maton gateway that proxies to Grafana and requires a Maton API key. The single required env var (MATON_API_KEY) is appropriate for a managed proxy service.
Instruction Scope
Instructions only describe HTTP calls to gateway.maton.ai and ctrl.maton.ai and how to manage connections; they do not instruct reading other env vars, local files, or unrelated system state. Note: all Grafana API traffic is routed through Maton endpoints (a third‑party proxy) — this is consistent with the stated 'managed authentication' but is an important trust consideration.
Install Mechanism
Instruction-only skill with no install spec and no included code files — nothing is written to disk or downloaded during install.
Credentials
Only one required env var (MATON_API_KEY) is declared and used in the examples. That credential is proportionate to using a managed API gateway. The SKILL.md also describes using a Grafana service account token in a browser flow (user-supplied), which is expected.
Persistence & Privilege
Skill is not always-enabled and is user-invocable; it does not request system-wide config paths or other skills' credentials. Autonomous model invocation is allowed (platform default) but not combined with other privileged requests.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install grafana-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /grafana-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of Grafana API skill with managed authentication. - Provides secure access to Grafana dashboards, data sources, folders, annotations, alerts, and teams via Maton API gateway. - Supports connection management (list, create, delete connections) through the Maton control panel. - Includes full guides for authenticating with Maton API, environment setup, and example Python requests. - Documents all major Grafana API endpoints for dashboards, folders, data sources, and annotations. - Enables integration for monitoring, visualization, and observability use cases.
元数据
Slug grafana-api
版本 1.0.0
许可证
累计安装 1
当前安装数 0
历史版本数 1
常见问题

Grafana 是什么?

Grafana API integration with managed authentication. Manage dashboards, data sources, folders, annotations, alerts, and teams. Use this skill when users want... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 330 次。

如何安装 Grafana?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install grafana-api」即可一键安装,无需额外配置。

Grafana 是免费的吗?

是的,Grafana 完全免费(开源免费),可自由下载、安装和使用。

Grafana 支持哪些平台?

Grafana 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Grafana?

由 byungkyu(@byungkyu)开发并维护,当前版本 v1.0.0。

💬 留言讨论