This commit is contained in:
parent
dddd7392b2
commit
3901791a6e
1 changed files with 3 additions and 3 deletions
|
|
@ -3,15 +3,13 @@ from aiohttp import web
|
|||
from datetime import datetime
|
||||
import os
|
||||
|
||||
|
||||
homeserver = os.environ['MATRIX_HOMESERVER']
|
||||
access_token = os.environ['MATRIX_ACCESS_TOKEN']
|
||||
room = os.environ['MATRIX_ROOM']
|
||||
|
||||
|
||||
_last_timestamp = 0
|
||||
_counter = 0
|
||||
|
||||
|
||||
def unique_number():
|
||||
global _last_timestamp
|
||||
global _counter
|
||||
|
|
@ -43,6 +41,7 @@ async def handle_alert(request):
|
|||
body = await request.json()
|
||||
title = body['title']
|
||||
status = body['status']
|
||||
print(body)
|
||||
await send_message(f'[{status}] {title}')
|
||||
return web.Response(text='Ok')
|
||||
|
||||
|
|
@ -54,4 +53,5 @@ app.add_routes([
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print('grafana_webhook_to_matrix.py starting')
|
||||
web.run_app(app, host='0.0.0.0', port=8003)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue