dsh-grafana-hosts: Multi-Instance Read-Only Grafana Access Plugin

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 host parameter or a default value.
  • Unified search: grafana_search can query all configured instances when no host is specified, returning results grouped by host.
  • Dashboard query: grafana_dashboard supports viewing a Dashboard summary (panels, variables, time range) or JSON mode.
  • Panel query: grafana_query executes the query behind a panel from a Dashboard or panel URL, using the saved template variable values from the Dashboard.
  • Metric query: grafana_metric supports PromQL and LogQL expressions, with mode=instant (default) or mode=range.
  • Alert query: grafana_alerts queries Alertmanager alerts, returning firing status by default. Use state=all to 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:

  1. Via the Chat tool:
grafana_hosts action=add name=prod url=https://grafana.example.com token=<token>
  1. 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 with list, add, remove, set-default, and test.
  • grafana_search: Search Dashboard titles and tags. When no host is specified, queries all instances and groups results by host.
  • grafana_dashboard: Retrieve a Dashboard summary or JSON. mode=json outputs 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 with mode=instant or mode=range.
  • grafana_alerts: Query alerts. Returns firing by default; use state=all to 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 dsh process. Please verify the source code and license before installation.
  • grafana_query only 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_metric only works with Prometheus-compatible and Loki data sources. For other types, use grafana_query on 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
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye