Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren committed Nov 5, 2024
1 parent 68f6a46 commit a0052f3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions keep/providers/zabbix_provider/zabbix_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ def __send_request(self, method: str, params: dict = None):

def _get_alerts(self) -> list[AlertDto]:
# https://www.zabbix.com/documentation/current/en/manual/api/reference/problem/get
time_from = (datetime.datetime.now() - datetime.timedelta(days=7)).isoformat()
time_from = int(
(datetime.datetime.now() - datetime.timedelta(days=7)).timestamp()
)
problems = self.__send_request(
"problem.get",
{
Expand Down Expand Up @@ -440,6 +442,8 @@ def setup_webhook(
{"name": "host_ip", "value": "{HOST.IP}"},
{"name": "host_name", "value": "{HOST.NAME}"},
{"name": "url", "value": "{$ZABBIX.URL}"},
{"name": "update_action", "value": "{EVENT.UPDATE.ACTION}"},
{"name": "event_ack", "value": "{EVENT.ACK.STATUS}"},
]

if scripts:
Expand Down Expand Up @@ -579,7 +583,7 @@ def _format_alert(
last_received, "%Y.%m.%d %H:%M:%S"
).isoformat()

update_action = event.get("update_action")
update_action = event.get("update_action", "")
if update_action == "acknowledged":
status = AlertStatus.ACKNOWLEDGED
elif "suppressed" in update_action:
Expand Down

0 comments on commit a0052f3

Please sign in to comment.