Grafana
Discover Grafana dashboards, datasources, and folders.
The Grafana molecule automatically syncs Grafana data into your SixDegree ontology, providing visibility into dashboards, metrics, and monitoring infrastructure.
- SixDegree Platform installed
- Grafana instance with API access
- Grafana API token or service account token
discovery:
enabled: true
settings:
# Grafana API connection
api_url: "https://grafana.company.com"
token: "your_grafana_api_token"
# Optional: Organization ID (defaults to 1)
organization_id: 1
# Optional: What to discover
include_dashboards: true
include_datasources: true
include_folders: true
# Optional: Filter folders by name pattern
folder_filter: ".*"
mcp:
enabled: true
settings:
api_url: "https://grafana.company.com"
token: "your_grafana_api_token"
namespace: "production"
The Grafana molecule discovers:
entities.sixdegree.ai/v1/GrafanaInstance- Grafana instance informationentities.sixdegree.ai/v1/GrafanaDashboard- Grafana dashboards with metadataentities.sixdegree.ai/v1/GrafanaDatasource- Data sources (Prometheus, Loki, etc.)entities.sixdegree.ai/v1/GrafanaFolder- Dashboard folders
Each GrafanaDashboard entity includes:
- Title: Dashboard title
- UID: Unique dashboard identifier
- URL: Direct link to dashboard
- Tags: Dashboard tags
- Folder: Parent folder name
- Created/Updated: Timestamps
Common datasource types discovered:
-
Prometheus
-
Loki
-
Elasticsearch
-
InfluxDB
-
MySQL/PostgreSQL
-
CloudWatch
-
Azure Monitor
-
HOSTED_BY- Dashboard/Datasource hosted by Grafana instance -
IN_FOLDER- Dashboard in Folder
AI agents can use these Grafana tools:
List all dashboards.
Parameters:
folder(string, optional) - Filter by folder nametags(array, optional) - Filter by tags
Example:
User: "What Grafana dashboards do we have?"
AI: [Calls grafana_list_dashboards]
"Found 23 dashboards:
• API Service Metrics (Production folder)
• Kubernetes Cluster Overview (Infrastructure)
• Application Performance (APM)
• Database Monitoring (Databases)"
Get detailed dashboard information.
Parameters:
uid(string, required) - Dashboard UID
Example:
User: "Show me the API Service dashboard"
AI: [Calls grafana_get_dashboard]
"API Service Metrics dashboard:
• 12 panels (Request Rate, Latency, Error Rate, etc.)
• Datasource: Prometheus
• Last updated: 2 days ago
• Tags: api, production, monitoring
• Link: https://grafana.company.com/d/abc123"
Search dashboards by keyword.
Parameters:
query(string, required) - Search termtags(array, optional) - Filter by tags
Example:
User: "Find dashboards related to Kubernetes"
AI: [Calls grafana_search_dashboards]
"Found 5 Kubernetes dashboards:
• Kubernetes Cluster Overview
• K8s Pod Metrics
• K8s Node Monitoring
• K8s Ingress Performance
• K8s Resource Usage"
List all datasources.
Example:
User: "What monitoring datasources are configured?"
AI: [Calls grafana_list_datasources]
"Found 8 datasources:
• Prometheus (prometheus) - Metrics
• Loki (loki) - Logs
• Tempo (tempo) - Traces
• Elasticsearch (elasticsearch) - Logs
• CloudWatch (cloudwatch) - AWS Metrics"
Get panels/widgets from a dashboard.
Parameters:
uid(string, required) - Dashboard UID
Example:
User: "What metrics are on the API dashboard?"
AI: [Calls grafana_get_dashboard_panels]
"API Service dashboard has 12 panels:
• Request Rate (Graph) - Requests per second
• Response Time (Graph) - P50/P95/P99 latency
• Error Rate (Gauge) - Percentage of failed requests
• Active Users (Stat) - Current concurrent users
• ..."
Get all dashboards in a folder.
Parameters:
folder(string, required) - Folder name
Example:
User: "What's in the Production monitoring folder?"
AI: [Calls grafana_get_folder_dashboards]
"Production folder contains 8 dashboards:
• API Service Metrics
• Frontend Performance
• Worker Queue Status
• Database Performance
• Cache Hit Rates"
degree discovery run grafana@1.0.0 --config grafana-config.yaml
degree discovery run grafana@1.0.0 --config grafana-config.yaml --dry-run
GRAFANA_LOG_LEVEL=debug degree discovery run grafana@1.0.0 --config grafana-config.yaml
Once configured, AI agents can query Grafana:
You: "Show me all dashboards related to the API service"
AI: [Uses grafana_search_dashboards]
"Found 3 API-related dashboards:
• API Service Metrics - Main service dashboard
• API Gateway Performance - Gateway metrics
• API Rate Limiting - Rate limit monitoring"
You: "What's the current error rate?"
AI: [Uses grafana_get_dashboard_panels + queries Prometheus]
"According to the API Service dashboard:
• Error rate: 0.02% (very low)
• Last 5 minutes: 3 errors out of 15,243 requests"
cd grafana
go build -o ../bin/grafana
cd ..
make dev
For Grafana Cloud instances:
discovery:
settings:
api_url: "https://your-org.grafana.net"
token: "glc_your_grafana_cloud_token"
-
Navigate to Administration → Service Accounts
-
Click Add service account
-
Give it a name (e.g., "SixDegree Discovery")
-
Set role to Viewer (for discovery only)
-
Click Add service account token
-
Copy the token
-
Navigate to Configuration → API Keys
-
Click Add API key
-
Give it a name and set role to Viewer
-
Copy the key
Required Grafana permissions:
- Discovery: Viewer role (read dashboards, datasources, folders)
- MCP Tools: Viewer role (query dashboards and datasources)
Filter discovered dashboards by folder:
folder_filter: "^[Pp]roduction.*"
folder_filter: "^(?!.*(test|dev|sandbox)).*"
folder_filter: "^(Production|Staging|Monitoring)$"
- Store tokens as secrets in your configuration
- Use service accounts with minimal permissions (Viewer only)
- Regularly rotate API tokens
- For production, use dedicated service accounts
- Audit API key usage in Grafana
Connection refused:
- Verify Grafana API URL is correct
- Check Grafana is accessible from SixDegree
- Ensure firewall allows traffic
Authentication failed:
- Verify API token is valid and not expired
- Check token has required permissions
- Try generating a new token
No dashboards found:
- Verify token has access to organization
- Check
organization_idis correct - Enable debug logging to see API responses
Missing dashboards:
- Check
folder_filterregex is not too restrictive - Verify token has permission to view all folders
- Ensure
include_dashboards: trueis set
Link Grafana dashboards to Kubernetes resources:
relations:
- from: grafana-dashboard:api-service
to: k8s-deployment:api-service
type: MONITORS
Link dashboards to services:
relations:
- from: service:api-service
to: grafana-dashboard:api-metrics
type: HAS_DASHBOARD
MIT - See LICENSE file in molecules directory