29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
import requests
|
|
import json
|
|
import urllib3
|
|
urllib3.disable_warnings()
|
|
|
|
auth = ("admin", "Katzir476!!!")
|
|
for uid in ["snarfnet-containers", "snarfnet-systems", "snarfnet-ai-stack"]:
|
|
url = f"https://grafana.snarfnet.net/api/dashboards/uid/{uid}"
|
|
resp = requests.get(url, auth=auth, verify=False, timeout=10)
|
|
data = resp.json()
|
|
dash = data.get("dashboard", {})
|
|
title = dash.get("title")
|
|
folder_id = data.get("meta", {}).get("folderId")
|
|
folder_title = data.get("meta", {}).get("folderTitle")
|
|
panels = dash.get("panels", [])
|
|
templating = [v.get("name") for v in dash.get("templating", {}).get("list", [])]
|
|
print(f"\n==========================================")
|
|
print(f"UID: {uid} | Title: {title} | Folder: {folder_title} (ID: {folder_id})")
|
|
print(f"Template variables: {templating}")
|
|
print(f"Panels ({len(panels)}):")
|
|
for p in panels:
|
|
p_type = p.get("type")
|
|
p_title = p.get("title")
|
|
if p_type == "row":
|
|
print(f" [ROW] {p_title}")
|
|
else:
|
|
print(f" - [{p_type}] {p_title}")
|
|
|