diff --git a/homelab-ai-bot/tools/grafana.py b/homelab-ai-bot/tools/grafana.py index 5d797eaf..699cc9cf 100644 --- a/homelab-ai-bot/tools/grafana.py +++ b/homelab-ai-bot/tools/grafana.py @@ -13,7 +13,7 @@ TOOLS = [ }, ] -GRAFANA_URL = "http://100.109.206.43:3000" +GRAFANA_URL = "http://100.66.78.56:3000" GRAFANA_USER = "admin" GRAFANA_PASS = "astral66" @@ -35,25 +35,22 @@ def _api(path): def handle_get_grafana_status(**kw): health = _api("/api/health") if not health: - return "Grafana nicht erreichbar (http://100.109.206.43:3000)" + return "Grafana nicht erreichbar (100.66.78.56:3000 / CT 143 pve-mu-3)" lines = [f"Grafana v{health.get('version', '?')} — DB: {health.get('database', '?')}"] - lines.append(f"URL: https://grafana.orbitalo.net") + lines.append("URL: https://grafana.orbitalo.net") + lines.append("Server: CT 143 (Raspi-Broker) auf pve-mu-3 Muldenstein") datasources = _api("/api/datasources") or [] lines.append(f"\nDatasources: {len(datasources)}") - if datasources: - for ds in datasources: - lines.append(f" {ds.get('name', '?')} ({ds.get('type', '?')}) — {'aktiv' if ds.get('access') else 'inaktiv'}") - else: - lines.append(" Keine konfiguriert — Prometheus muss noch als Datasource hinzugefuegt werden") + for ds in datasources: + lines.append(f" {ds.get('name', '?')} ({ds.get('type', '?')}) — DB: {ds.get('database', '-')}") dashboards = _api("/api/search?type=dash-db") or [] lines.append(f"\nDashboards: {len(dashboards)}") - for db in dashboards[:10]: - lines.append(f" {db.get('title', '?')} (/{db.get('uri', '?')})") - if not dashboards: - lines.append(" Keine Dashboards vorhanden") + for db in dashboards: + url = f"https://grafana.orbitalo.net{db.get('url', '')}" + lines.append(f" {db.get('title', '?')} — {url}") alerts = _api("/api/alertmanager/grafana/api/v2/alerts") or [] if alerts: @@ -63,7 +60,7 @@ def handle_get_grafana_status(**kw): labels = a.get("labels", {}) lines.append(f" {labels.get('alertname', '?')} — {labels.get('severity', '?')}") else: - lines.append("\nAlerts: keine") + lines.append("\nAlerts: keine aktiven") return "\n".join(lines)