This commit is contained in:
cronekorkn 2022-09-24 14:40:58 +02:00
parent 12621fa36b
commit 6c300f24f0
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python3
from requests import Session
from requests.exceptions import ConnectionError
from sys import argv
from time import time
from time import sleep, time
if len(argv) > 1 and argv[1] == "remove":
action = "remove"
@ -17,6 +19,18 @@ session = Session()
session.auth = ('root', '${icinga_password}')
now = int(time())
# wait online
for _ in range(10):
try:
session.get(api_url).raise_for_status()
except ConnectionError as error:
print(f'{error}: retrying...')
sleep(3)
else:
break
# look for existing downtimes
response = session.get(