From 20e42a17dcefd0e5646b0f0c1049daf46bcbf2fc Mon Sep 17 00:00:00 2001 From: josiah Date: Sun, 28 Jul 2019 20:16:00 +0000 Subject: [PATCH] Create initial file for mojo-arke integration on v2 api - we have to break out the files into two separate while loops (dumb new decorator syntax breaks my old grammer) - this is the first step; its working here just fine, but i'll need to deploy it as a second docker container --- mojo-arke.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 mojo-arke.py diff --git a/mojo-arke.py b/mojo-arke.py new file mode 100644 index 0000000..66a1c91 --- /dev/null +++ b/mojo-arke.py @@ -0,0 +1,22 @@ +import slack +import pdb +import re +import time +from pathlib import Path +import os + +def react_to_monitoring(): + results_file = Path("/shared/alerts.log") + does_file_exist = results_file.is_file() + if results_file.is_file(): + open_file = open("/shared/alerts.log","r") + for line in open_file: + webclient.chat_postMessage( + channel = channel_id, + text = line + ) + os.remove("/shared/alerts.log") + +if __name__ == '__main__': + while True: + react_to_monitoring()