-
Notifications
You must be signed in to change notification settings - Fork 3
/
start_monitor.py
31 lines (26 loc) · 920 Bytes
/
start_monitor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import logging
import sys
import os
import rollbar
from monitor import loop, config
log_level = logging.DEBUG if os.environ.get('DEBUG') == '1' else logging.INFO
log_format = '%(levelname)s: %(message)s'
logging.basicConfig(stream=sys.stdout, level=log_level, format=log_format)
logger = logging.getLogger(__name__)
if __name__ == '__main__':
if not config.CLUSTER_ID and config.ENVIRONMENT not in ['development', 'test']:
logger.error("No cluster id set!")
sys.exit(1)
if config.ENVIRONMENT not in ['development', 'test']:
rollbar.init(
config.CLUSTER_ID, # Use cluster id as access token
config.ENVIRONMENT,
endpoint=config.ROLLBAR_ENDPOINT,
root=os.path.dirname(os.path.realpath(__file__)))
try:
loop.start()
except:
rollbar.report_exc_info()
raise
else:
loop.start()