fix(monitoring): prevent Vault crash and DNS null error
- Vault: Wrap resp.json() in a try-except block to prevent JSONDecodeError when hitting an HTML error page (e.g. 502/503). This prevents the entire agent from crashing and missing heartbeats. - Uptime Kuma DNS: Explicitly set dns_resolve_server to 1.1.1.1 in Python API payload to prevent Uptime Kuma backend from crashing on null properties.
This commit is contained in:
parent
475eb762b9
commit
8a056a381b
@ -261,6 +261,7 @@ def setup_uptime_kuma(dry_run=False, only=None):
|
||||
"hostname": hostname,
|
||||
"port": 53,
|
||||
"accepted_statuscodes": ["200-299"],
|
||||
"dns_resolve_server": "1.1.1.1",
|
||||
"dns_resolve_type": dns_resolve_type,
|
||||
"interval": interval,
|
||||
}
|
||||
@ -280,6 +281,7 @@ def setup_uptime_kuma(dry_run=False, only=None):
|
||||
"hostname": hostname,
|
||||
"port": 53,
|
||||
"accepted_statuscodes": ["200-299"],
|
||||
"dns_resolve_server": "1.1.1.1",
|
||||
"dns_resolve_type": dns_resolve_type,
|
||||
"interval": interval,
|
||||
}
|
||||
|
||||
@ -140,11 +140,14 @@ def check_vault():
|
||||
max_ping = max(max_ping, ms)
|
||||
|
||||
if resp is not None:
|
||||
data = resp.json()
|
||||
if not data.get("sealed"):
|
||||
unsealed_count += 1
|
||||
else:
|
||||
errors.append(f"{node} SEALED")
|
||||
try:
|
||||
data = resp.json()
|
||||
if not data.get("sealed"):
|
||||
unsealed_count += 1
|
||||
else:
|
||||
errors.append(f"{node} SEALED")
|
||||
except Exception as e:
|
||||
errors.append(f"{node} invalid response: {resp.status_code}")
|
||||
else:
|
||||
errors.append(f"{node} unreachable: {err}")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user