fix: HTTP-Check HEAD statt GET, 15s Timeout, User-Agent
This commit is contained in:
parent
63a429c592
commit
bb0b9892b6
1 changed files with 2 additions and 1 deletions
|
|
@ -107,9 +107,10 @@ def check_all() -> list[str]:
|
||||||
if names:
|
if names:
|
||||||
alerts.append(f"⚠️ Keine Logs seit 35+ Min: {', '.join(names)}")
|
alerts.append(f"⚠️ Keine Logs seit 35+ Min: {', '.join(names)}")
|
||||||
|
|
||||||
|
_headers = {"User-Agent": "Mozilla/5.0 (Hausmeister-Bot/1.0 health-check)"}
|
||||||
for check in HTTP_HEALTH_CHECKS:
|
for check in HTTP_HEALTH_CHECKS:
|
||||||
try:
|
try:
|
||||||
r = requests.get(check["url"], timeout=10, allow_redirects=True)
|
r = requests.head(check["url"], timeout=15, allow_redirects=True, headers=_headers)
|
||||||
if r.status_code >= 400:
|
if r.status_code >= 400:
|
||||||
alerts.append(f"🔴 {check['name']} antwortet mit HTTP {r.status_code}")
|
alerts.append(f"🔴 {check['name']} antwortet mit HTTP {r.status_code}")
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue