示例#1
0
文件: daemon.py 项目: ntoll/alerta
    def on_disconnected(self):
        global conn

        logging.warning("Connection lost. Attempting auto-reconnect to %s", NOTIFY_TOPIC)
        conn.start()
        conn.connect(wait=True)
        conn.subscribe(destination=NOTIFY_TOPIC, ack="auto", headers={"selector": "repeat = 'false'"})
示例#2
0
文件: daemon.py 项目: ntoll/alerta
    def on_disconnected(self):
        global conn

        logging.warning('Connection lost. Attempting auto-reconnect to %s', ALERT_QUEUE)
        conn.start()
        conn.connect(wait=True)
        conn.subscribe(destination=ALERT_QUEUE, ack='auto')
示例#3
0
文件: daemon.py 项目: ntoll/alerta
    def run(self):
        global alert, hold
        self.running = True

        while not self.shuttingdown:
            if self.shuttingdown:
                break

            notified = dict()
            for alertid in hold:
                if hold[alertid] < time.time():
                    logging.warning("Hold expired for %s and trigger notification", alertid)
                    send_notify(alertid)
                    notified[alertid] = 1

            for alertid in notified:
                del alert[alertid]
                del hold[alertid]

            if not self.shuttingdown:
                time.sleep(5)

        self.running = False