Files
SnarfCode/scripts/check_panel_targets.py

25 lines
880 B
Python

import requests
import json
import urllib3
urllib3.disable_warnings()
auth = ("admin", "Katzir476!!!")
resp = requests.get("https://grafana.snarfnet.net/api/dashboards/uid/snarfnet-systems", auth=auth, verify=False)
dash = resp.json()["dashboard"]
print("--- Systems Dashboard Targets ---")
for p in dash.get("panels", []):
targets = p.get("targets", [])
if targets:
exprs = [t.get("expr") for t in targets]
print(f"Panel: {p.get('title')} -> Exprs: {exprs}")
resp2 = requests.get("https://grafana.snarfnet.net/api/dashboards/uid/snarfnet-containers", auth=auth, verify=False)
dash2 = resp2.json()["dashboard"]
print("\n--- Containers Dashboard Targets ---")
for p in dash2.get("panels", []):
targets = p.get("targets", [])
if targets:
exprs = [t.get("expr") for t in targets]
print(f"Panel: {p.get('title')} -> Exprs: {exprs}")