Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data-sources/builtin-toolsets/.nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ nav:
- Datetime: datetime.md
- Docker: docker.md
- GitHub: github.md
- Grafana Dashboards: grafanadashboards.md
- Loki: grafanaloki.md
- Tempo: grafanatempo.md
- Helm: helm.md
Expand Down
88 changes: 88 additions & 0 deletions docs/data-sources/builtin-toolsets/grafanadashboards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Grafana Dashboards

Connect HolmesGPT to Grafana for dashboard analysis, query extraction, and understanding your monitoring setup. This integration enables investigation of dashboard configurations and extraction of Prometheus queries for deeper analysis.

## Prerequisites

A [Grafana service account token](https://grafana.com/docs/grafana/latest/administration/service-accounts/) with the following permissions:

- Basic role → Viewer

## Configuration

=== "Holmes CLI"

Add the following to **~/.holmes/config.yaml**. Create the file if it doesn't exist:

```yaml
toolsets:
grafana/dashboards:
enabled: true
config:
api_key: <your grafana service account token>
url: <your grafana url> # e.g. https://acme-corp.grafana.net or http://localhost:3000
# Optional: Custom health check endpoint (defaults to api/health)
# healthcheck: api/health
# Optional: Additional headers for all requests
# headers:
# X-Custom-Header: "custom-value"
```

--8<-- "snippets/toolset_refresh_warning.md"

To test, run:

```bash
holmes ask "Show me all dashboards tagged with 'kubernetes'"
```

=== "Robusta Helm Chart"

```yaml
holmes:
toolsets:
grafana/dashboards:
enabled: true
config:
api_key: <your grafana API key>
url: <your grafana url> # e.g. https://acme-corp.grafana.net
# Optional: Additional headers for all requests
# headers:
# X-Custom-Header: "custom-value"
```

## Capabilities

| Tool Name | Description |
|-----------|-------------|
| grafana_search_dashboards | Search for dashboards and folders by query, tags, UIDs, or folder locations |
| grafana_get_dashboard_by_uid | Retrieve complete dashboard JSON including all panels and queries |
| grafana_get_home_dashboard | Get the home dashboard configuration |
| grafana_get_dashboard_tags | List all tags used across dashboards for categorization |

## How it Works

### Dashboard Query Extraction

When HolmesGPT retrieves a dashboard, it can extract and analyze Prometheus queries from dashboard panels. This is particularly useful for:

- Understanding what metrics a dashboard monitors
- Extracting queries for further investigation with the Prometheus toolset
- Analyzing dashboard time ranges and variable usage

### Example Usage

**Finding dashboards by tag:**
```bash
holmes ask "Find all dashboards tagged with 'production' or 'kubernetes'"
```

**Analyzing a specific dashboard:**
```bash
holmes ask "Show me what metrics the 'Node Exporter' dashboard monitors"
```

**Extracting queries for investigation:**
```bash
holmes ask "Get the CPU usage queries from the Kubernetes cluster dashboard and check if any nodes are throttling"
```
1 change: 1 addition & 0 deletions docs/data-sources/builtin-toolsets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ HolmesGPT includes pre-built integrations for popular monitoring and observabili
- [:material-clock:{ .lg .middle } **Datetime**](datetime.md)
- [:simple-docker:{ .lg .middle } **Docker**](docker.md)
- [:material-github:{ .lg .middle } **GitHub**](github.md)
- [:simple-grafana:{ .lg .middle } **Grafana Dashboards**](grafanadashboards.md)
- [:material-package:{ .lg .middle } **Helm**](helm.md)
- [:material-web:{ .lg .middle } **Internet**](internet.md)
- [:simple-apachekafka:{ .lg .middle } **Kafka**](kafka.md)
Expand Down
10 changes: 10 additions & 0 deletions holmes/core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,16 @@ def _load_llm_instructions(self, jinja_template: str):
context={"tool_names": tool_names, "config": self.config},
)

def _load_llm_instructions_from_file(self, file_dir: str, filename: str) -> None:
"""Helper method to load LLM instructions from a jinja2 template file.

Args:
file_dir: Directory where the template file is located (typically os.path.dirname(__file__))
filename: Name of the jinja2 template file (e.g., "toolset_grafana_dashboard.jinja2")
"""
template_file_path = os.path.abspath(os.path.join(file_dir, filename))
self._load_llm_instructions(jinja_template=f"file://{template_file_path}")


class YAMLToolset(Toolset):
tools: List[YAMLTool] # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion holmes/plugins/toolsets/grafana/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class GrafanaConfig(BaseModel):
"""A config that represents one of the Grafana related tools like Loki or Tempo
If `grafana_datasource_uid` is set, then it is assume that Holmes will proxy all
If `grafana_datasource_uid` is set, then it is assumed that Holmes will proxy all
requests through grafana. In this case `url` should be the grafana URL.
If `grafana_datasource_uid` is not set, it is assumed that the `url` is the
systems' URL
Expand Down
Loading
Loading