v1.9.42: full Grafana/Prometheus GUI & CLI improvements

Grafana tab:
- Datasources table (Name, Type, URL, Default)
- Open Grafana button (opens browser)
- Switch to AlertManager endpoint for real-time active alerts

Prometheus tab:
- Quick query buttons (up, CPU, Memory)
- Metrics browser popup with filter (loads all metric names)
- Rules section (recording + alerting rules Treeview)

CLI:
- --grafana-datasources ALIAS
- --prom-rules ALIAS

i18n: 28 new keys (EN/RU/ZH)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chrome-storm-c442
2026-03-06 10:23:33 -05:00
parent 6a2db542c3
commit 8ff62d8f11
7 changed files with 384 additions and 61 deletions

View File

@@ -138,6 +138,16 @@ class GrafanaClient:
log.error("Grafana list_alerts failed: %s", exc)
return []
def get_active_alerts(self) -> list[dict]:
"""List active (firing) alerts via AlertManager endpoint."""
try:
results = self._get("/api/alertmanager/grafana/api/v2/alerts")
log.info("Grafana: %d active alerts", len(results))
return results
except Exception as exc:
log.error("Grafana get_active_alerts failed: %s", exc)
return []
def list_datasources(self) -> list[dict]:
"""
List all datasources via GET /api/datasources.