Catch errors.

TODO: log errors to ES
This commit is contained in:
dave 2015-12-27 15:16:18 -08:00
parent 5f39d2c35b
commit 4e67a87648
1 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ from threading import Thread
from elasticsearch import Elasticsearch
from time import time,sleep
from pymonitor.builtins import sysinfo
import traceback
import datetime
import logging
import json
@ -175,7 +176,11 @@ class MonitorThread(Thread):
while self.alive:
if time() - self.lastRun > self.delay:
self.lastRun = time()
self.execute(self.config["args"])
try:
self.execute(self.config["args"])
except:
tb = traceback.format_exc()
print(tb)
sleep(0.5)
self.logger.info("scheduler exited")