mirror of
https://github.com/FAUSheppy/telegram-http-gateway
synced 2025-12-07 07:31:35 +01:00
add icinga specific endpoint because of markdown escaping
This commit is contained in:
@@ -63,6 +63,22 @@ def sendToAll():
|
||||
sendMessageToAllClients(flask.request.json["message"])
|
||||
return ("","204")
|
||||
|
||||
@app.route('/send-all-icinga', methods=["POST"])
|
||||
def sendToAllIcinga():
|
||||
args = flask.request.json
|
||||
|
||||
# build message #
|
||||
serviceName = args["service_name"]
|
||||
if args["service_display_name"]:
|
||||
serviceName = args["service_display_name"]
|
||||
|
||||
message = "*{service} {state}* on [{host}]({host})\n{output}".format(service=serviceName,
|
||||
state=args["service_state"],
|
||||
host=args["service_host"],
|
||||
output=args["service_output"])
|
||||
sendMessageToAllClients(message)
|
||||
return ("","204")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(description='Simple Telegram Notification Interface',
|
||||
|
||||
Reference in New Issue
Block a user