Compare commits

..

No commits in common. "main" and "dev-2.0.2" have entirely different histories.

2 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ async def dashboard():
for new_alert in new_alerts_id: for new_alert in new_alerts_id:
message = ( message = (
icon_dict[active_alerts[new_alert]["severity"]] icon_dict[active_alerts[new_alert]["severity"]]
+ f" {active_alerts[new_alert]['host']}\n" + f"{active_alerts[new_alert]['host']}\n"
+ f"{active_alerts[new_alert]['name']}" + f"{active_alerts[new_alert]['name']}"
) )
msg_id = await send_message(message=message, event_id=new_alert) msg_id = await send_message(message=message, event_id=new_alert)

View File

@ -10,8 +10,8 @@ from datetime import datetime, timedelta
def get_active_problems() -> dict: def get_active_problems() -> dict:
api = ZabbixAPI(url=conf.zabbix.url, token=conf.zabbix.token)
try: try:
api = ZabbixAPI(url=conf.zabbix.url, token=conf.zabbix.token)
problems = api.problem.get( problems = api.problem.get(
output=[ output=[
"eventid", "eventid",
@ -28,7 +28,7 @@ def get_active_problems() -> dict:
event_ids.append(problem["eventid"]) event_ids.append(problem["eventid"])
events = api.event.get( events = api.event.get(
selectHosts=["name"], selectHosts=["host"],
eventids=event_ids, eventids=event_ids,
output=[ output=[
"eventid", "eventid",
@ -38,7 +38,7 @@ def get_active_problems() -> dict:
) )
events_dict = {"event_ids": []} events_dict = {"event_ids": []}
for event in events: for event in events:
event["host"] = event.pop("hosts", None)[0]["name"] event["host"] = event.pop("hosts", None)[0]["host"]
events_dict[event["eventid"]] = event events_dict[event["eventid"]] = event
events_dict["event_ids"].append(event["eventid"]) events_dict["event_ids"].append(event["eventid"])
return events_dict return events_dict