mirror of
https://github.com/FAUSheppy/atlantis-event-dispatcher
synced 2025-12-10 00:08:33 +01:00
Compare commits
2 Commits
df1dfd8b0c
...
178ba5451d
| Author | SHA1 | Date | |
|---|---|---|---|
| 178ba5451d | |||
| 14612016af |
@@ -20,7 +20,7 @@ import sqlalchemy
|
|||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from sqlalchemy.sql.expression import func
|
from sqlalchemy.sql.expression import func
|
||||||
|
|
||||||
|
OPENSEARCH_HEADER_SEPERATOR = ","
|
||||||
HOST = "icinga.atlantishq.de"
|
HOST = "icinga.atlantishq.de"
|
||||||
app = flask.Flask("Signal Notification Gateway")
|
app = flask.Flask("Signal Notification Gateway")
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///sqlite.db"
|
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///sqlite.db"
|
||||||
@@ -357,8 +357,25 @@ def smart_send_to_clients(path=None):
|
|||||||
- supported struct of type "ICINGA|ZABBIX|GENERIC" (see docs) in field "data"
|
- supported struct of type "ICINGA|ZABBIX|GENERIC" (see docs) in field "data"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
instructions = flask.request.json
|
if flask.request.headers.get("opensearch"):
|
||||||
|
|
||||||
|
instructions = {}
|
||||||
|
users = flask.request.headers.get("opensearch-users")
|
||||||
|
groups = flask.request.headers.get("opensearch-groups")
|
||||||
|
|
||||||
|
if groups and OPENSEARCH_HEADER_SEPERATOR in groups:
|
||||||
|
groups = groups.split(OPENSEARCH_HEADER_SEPERATOR)
|
||||||
|
|
||||||
|
if users and OPENSEARCH_HEADER_SEPERATOR in users:
|
||||||
|
users = users.split(OPENSEARCH_HEADER_SEPERATOR)
|
||||||
|
|
||||||
|
message = flask.request.get_data(as_text=True)
|
||||||
|
title = "Opensearch Alert"
|
||||||
|
method = None
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
instructions = flask.request.json
|
||||||
users = instructions.get("users")
|
users = instructions.get("users")
|
||||||
groups = instructions.get("groups")
|
groups = instructions.get("groups")
|
||||||
message = instructions.get("msg")
|
message = instructions.get("msg")
|
||||||
|
|||||||
Reference in New Issue
Block a user