alarm/http_status: ensure alarm exists for exception handling
This commit is contained in:
parent
cf027b5c32
commit
a1d777a81c
1 changed files with 2 additions and 0 deletions
|
@ -39,11 +39,13 @@ class AlarmProxyHTTPStatusAutomation(BaseAutomation):
|
||||||
f"{r.status_code} {r.reason}"
|
f"{r.status_code} {r.reason}"
|
||||||
)
|
)
|
||||||
except requests.HTTPError:
|
except requests.HTTPError:
|
||||||
|
alarm = get_or_create_alarm(proxy.brn, "http-status")
|
||||||
alarm.update_state(
|
alarm.update_state(
|
||||||
AlarmState.CRITICAL,
|
AlarmState.CRITICAL,
|
||||||
f"{r.status_code} {r.reason}"
|
f"{r.status_code} {r.reason}"
|
||||||
)
|
)
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
|
alarm = get_or_create_alarm(proxy.brn, "http-status")
|
||||||
alarm.update_state(
|
alarm.update_state(
|
||||||
AlarmState.CRITICAL,
|
AlarmState.CRITICAL,
|
||||||
repr(e)
|
repr(e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue