Use auth on metrics API

This commit is contained in:
Cyber MacGeddon 2026-03-26 16:55:27 +00:00
parent 9c55a0a0ff
commit b09e785a53

View file

@ -178,7 +178,11 @@ def check_processors(url: str, min_processors: int, timeout: int, token: Optiona
url += '/'
metrics_url = f"{url}api/metrics/query?query=processor_info"
resp = requests.get(metrics_url, timeout=timeout)
headers = {}
if token:
headers["Authorization"] = f"Bearer {token}"
resp = requests.get(metrics_url, timeout=timeout, headers=headers)
if resp.status_code == 200:
data = resp.json()
processor_count = len(data.get("data", {}).get("result", []))