Grafana-Tool: URL korrigiert auf CT 143 (pve-mu-3) statt CT 110

This commit is contained in:
root 2026-03-16 16:28:52 +07:00
parent 69eadaab2e
commit b32cbf353e

View file

@ -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_USER = "admin"
GRAFANA_PASS = "astral66" GRAFANA_PASS = "astral66"
@ -35,25 +35,22 @@ def _api(path):
def handle_get_grafana_status(**kw): def handle_get_grafana_status(**kw):
health = _api("/api/health") health = _api("/api/health")
if not 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 = [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 [] datasources = _api("/api/datasources") or []
lines.append(f"\nDatasources: {len(datasources)}") lines.append(f"\nDatasources: {len(datasources)}")
if datasources:
for ds in datasources: for ds in datasources:
lines.append(f" {ds.get('name', '?')} ({ds.get('type', '?')}) — {'aktiv' if ds.get('access') else 'inaktiv'}") lines.append(f" {ds.get('name', '?')} ({ds.get('type', '?')}) — DB: {ds.get('database', '-')}")
else:
lines.append(" Keine konfiguriert — Prometheus muss noch als Datasource hinzugefuegt werden")
dashboards = _api("/api/search?type=dash-db") or [] dashboards = _api("/api/search?type=dash-db") or []
lines.append(f"\nDashboards: {len(dashboards)}") lines.append(f"\nDashboards: {len(dashboards)}")
for db in dashboards[:10]: for db in dashboards:
lines.append(f" {db.get('title', '?')} (/{db.get('uri', '?')})") url = f"https://grafana.orbitalo.net{db.get('url', '')}"
if not dashboards: lines.append(f" {db.get('title', '?')}{url}")
lines.append(" Keine Dashboards vorhanden")
alerts = _api("/api/alertmanager/grafana/api/v2/alerts") or [] alerts = _api("/api/alertmanager/grafana/api/v2/alerts") or []
if alerts: if alerts:
@ -63,7 +60,7 @@ def handle_get_grafana_status(**kw):
labels = a.get("labels", {}) labels = a.get("labels", {})
lines.append(f" {labels.get('alertname', '?')}{labels.get('severity', '?')}") lines.append(f" {labels.get('alertname', '?')}{labels.get('severity', '?')}")
else: else:
lines.append("\nAlerts: keine") lines.append("\nAlerts: keine aktiven")
return "\n".join(lines) return "\n".join(lines)