Skip to content

Commit

Permalink
Handle flexible downtimes for Zabbix (#1078)
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfessorLogout authored Nov 18, 2024
1 parent eb1cdaf commit 2bbc6d2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Nagstamon/Servers/Zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,15 @@ def _set_downtime(self, hostname, service, author, comment, fixed, start_time, e

hostids = [self.hosts[hostname].hostid]

date = datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M")
stime = int(time.mktime(date.timetuple()))
if fixed == 1:
start_date = datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M")
end_date = datetime.datetime.strptime(end_time, "%Y-%m-%d %H:%M")
else:
start_date = datetime.datetime.now()
end_date = start_date + datetime.timedelta(hours=hours, minutes=minutes)

date = datetime.datetime.strptime(end_time, "%Y-%m-%d %H:%M")
etime = int(time.mktime(date.timetuple()))
stime = int(time.mktime(start_date.timetuple()))
etime = int(time.mktime(end_date.timetuple()))

if conf.debug_mode is True:
self.debug(server=self.get_name(),
Expand Down

0 comments on commit 2bbc6d2

Please sign in to comment.