mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
Feature: support HipChat Server
This commit is contained in:
parent
f4096c0356
commit
fac0af548b
@ -110,6 +110,7 @@ MAIL_ASCII_ATTACHMENTS = parse_boolean(os.environ.get('REDASH_MAIL_ASCII_ATTACHM
|
||||
HOST = os.environ.get('REDASH_HOST', '')
|
||||
|
||||
HIPCHAT_API_TOKEN = os.environ.get('REDASH_HIPCHAT_API_TOKEN', None)
|
||||
HIPCHAT_API_URL = os.environ.get('REDASH_HIPCHAT_API_URL', None)
|
||||
HIPCHAT_ROOM_ID = os.environ.get('REDASH_HIPCHAT_ROOM_ID', None)
|
||||
|
||||
WEBHOOK_ENDPOINT = os.environ.get('REDASH_WEBHOOK_ENDPOINT', None)
|
||||
|
@ -349,7 +349,10 @@ def check_alerts_for_query(self, query_id):
|
||||
|
||||
def notify_hipchat(alert, html, new_state):
|
||||
try:
|
||||
hipchat_client = hipchat.HipChat(token=settings.HIPCHAT_API_TOKEN)
|
||||
if settings.HIPCHAT_API_URL:
|
||||
hipchat_client = hipchat.HipChat(token=settings.HIPCHAT_API_TOKEN, url=settings.HIPCHAT_API_URL)
|
||||
else:
|
||||
hipchat_client = hipchat.HipChat(token=settings.HIPCHAT_API_TOKEN)
|
||||
message = '[' + new_state.upper() + '] ' + alert.name + '<br />' + html
|
||||
hipchat_client.message_room(settings.HIPCHAT_ROOM_ID, settings.NAME, message.encode('utf-8', 'ignore'), message_format='html')
|
||||
except Exception:
|
||||
|
Loading…
Reference in New Issue
Block a user