def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender( 'localhost', 'zenactiond', self.options.heartbeatTimeout) self._maintenanceCycle = MaintenanceCycle( self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor
# ############################################################################## import time import Globals from Products.ZenEvents.Schedule import Schedule from Products.ZenEvents.ActionRule import ActionRule print "Adjusting schedules for daylight savings time." print "%s %s" % ('-' * 57, '-' * 21) from Products.ZenUtils.ZenScriptBase import ZenScriptBase dmd = ZenScriptBase(connect=True).dmd s = Schedule(None, dmd) for next, window in s.makeWorkList(time.time(), s.getWindows()): nextList = time.localtime(next) startList = time.localtime(window.start) target = window.target() windowString = "%s on " % window.id if isinstance(target, ActionRule): windowString += "%s/%s" % (target.getUserid(), target.getId()) else: windowString += target.getId() if nextList[3] == startList[3]: print "%56s: No adjustment needed." % windowString elif nextList[3] == (startList[3] - 1) or \ (nextList[3] == 23 and startList[3] == 0): print "%56s: Fall back." % windowString window.start = next + 3600