Introduction¶
DSH (DeepSeek Harness) follows a “everything is a plugin” philosophy, where each plugin runs with the privileges of the current dsh process. When you need to query monitoring data, panel metrics, or alerts across multiple Grafana instances, configuring direct connections is often not flexible enough: different environments require different URLs, path prefixes, and authentication tokens; concatenating multiple connections exposes tokens and makes unified searching and switching difficult.
The muhadif/dsh-grafana-hosts plugin provides multi-instance read-only access, supporting named hosts, unified search, and panel/metric/alert queries. Tokens are stored in DSH’s credential store to prevent leakage in command lines or output.
What It Is¶
muhadif/dsh-grafana-hosts is a DSH plugin that provides read-only access across multiple named Grafana instances. It includes six tools and one settings card, supporting Dashboard queries, PromQL/LogQL metric queries, and alert queries, while storing Grafana authentication tokens in DSH’s credential store to ensure tokens never appear in tool output.
Core Features¶
- Named host configuration: Supports configuring name, URL, and token for each Grafana instance. Tools access instances via the
hostparameter or a default value. - Unified search:
grafana_searchcan query all configured instances when nohostis specified, returning results grouped by host. - Dashboard query:
grafana_dashboardsupports viewing a Dashboard summary (panels, variables, time range) or JSON mode. - Panel query:
grafana_queryexecutes the query behind a panel from a Dashboard or panel URL, using the saved template variable values from the Dashboard. - Metric query:
grafana_metricsupports PromQL and LogQL expressions, withmode=instant(default) ormode=range. - Alert query:
grafana_alertsqueries Alertmanager alerts, returning firing status by default. Usestate=allto include silenced and inhibited alerts. - Secure token storage: Tokens are written to DSH’s credential store (
GRAFANA_TOKEN_<ID>). Only the settings card can write tokens; tool invocations and output never contain tokens. - Read-only design: The plugin registers no write tools, preventing Dashboard modifications and alert rule changes by design.
Installation & Enablement¶
Run from the workspace directory:
dsh plugin --profile <profile> add link:/absolute/path/to/grafana-hosts
Or add a local directory via the DSH UI under “Plugins > Add plugin”. After adding, restart the corresponding profile.
Adding Hosts¶
There are two ways to add a Grafana instance to the store:
- Via the Chat tool:
grafana_hosts action=add name=prod url=https://grafana.example.com token=<token>
- In the “Settings > Plugins > Grafana hosts” settings card, fill in the name, URL, and token, then click “Add host”.
To create a token in Grafana, navigate to: Administration > Users and access > Service accounts. Select the “Viewer” role to meet the read-only requirements of all tools.
Tool Usage¶
grafana_hosts: Manage the host list withlist,add,remove,set-default, andtest.grafana_search: Search Dashboard titles and tags. When nohostis specified, queries all instances and groups results by host.grafana_dashboard: Retrieve a Dashboard summary or JSON.mode=jsonoutputs the full structure.grafana_query: Execute queries from a Dashboard or panel URL using saved template variable values.grafana_metric: Execute a single PromQL or LogQL expression withmode=instantormode=range.grafana_alerts: Query alerts. Returns firing by default; usestate=allto include silenced and inhibited.
When only a Dashboard UID is provided, grafana_dashboard will try hosts in the default order and report which host returned results.
Use Cases & Notes¶
- Suitable for scenarios requiring unified access to multiple Grafana instances without exposing tokens.
- The plugin runs with the privileges of the current
dshprocess. Please verify the source code and license before installation. grafana_queryonly uses template variable values saved in the Dashboard. Panels with unsaved values are skipped and the variable name is reported.- Bare query text in
grafana_metriconly works with Prometheus-compatible and Loki data sources. For other types, usegrafana_queryon saved panels. - Use HTTPS in non-private networks.
Summary¶
muhadif/dsh-grafana-hosts provides DSH with read-only access across named Grafana instances, supporting unified queries for Dashboards, metrics, and alerts, with tokens securely stored in DSH’s credential store. It is well-suited for agent development scenarios that require quick switching and searching of monitoring data across multiple environments.
- Directory page: https://www.skillhub.cn/plugins/muhadif/dsh-grafana-hosts
- GitHub: https://github.com/muhadif/dsh-grafana-hosts