summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-04 15:05:44 +0100
committerSimon Rettberg2019-02-04 15:05:44 +0100
commita909153deaf2d0d18f60f28c73aeb6fd9493d44e (patch)
tree07c0dded17bfcb81f82e5cb4fb8b16d5fdd30d7f
parentPrevious commit: Log show limit (diff)
downloadbwlp-monitoring-a909153deaf2d0d18f60f28c73aeb6fd9493d44e.tar.gz
bwlp-monitoring-a909153deaf2d0d18f60f28c73aeb6fd9493d44e.tar.xz
bwlp-monitoring-a909153deaf2d0d18f60f28c73aeb6fd9493d44e.zip
Sanitize file names
-rwxr-xr-xmain.py (renamed from bwLpStatus.py)12
-rw-r--r--template.html (renamed from bwlpMonitor_template.html)0
2 files changed, 6 insertions, 6 deletions
diff --git a/bwLpStatus.py b/main.py
index 59f37b8..489c1cc 100755
--- a/bwLpStatus.py
+++ b/main.py
@@ -150,9 +150,9 @@ def thrift(name, ip, port, server):
# Parses the log from the logfile. Fills the logEntries array.
def parseLog():
global logEntries
- if not (os.path.exists('bwLpStatusLog.txt')):
+ if not (os.path.exists('history.txt')):
return
- with open('bwLpStatusLog.txt', 'r') as log:
+ with open('history.txt', 'r') as log:
for line in log:
line = line.strip()
entry = line.split('\t')
@@ -164,7 +164,7 @@ def parseLog():
# Writes updated log in the logfile.
def writeLog():
- with open('bwLpStatusLog.txt', 'a') as log:
+ with open('history.txt', 'a') as log:
for entry in logEntries[newLogIndex:]:
log_string = entry.date + '\t' + entry.service + '\t' + entry.state + '\t' + entry.host
log_string += '\t' + str(entry.msg)
@@ -261,11 +261,11 @@ for entry in reversed(logEntries[cut_amount:]):
+ entry.msg + '</div></div></div>')
# Copy the .html file and replace the %CONTENT% to generate the final html file.
-shutil.copyfile('bwlpMonitor_template.html', 'bwlpMonitor.html')
+shutil.copyfile('template.html', 'status.html')
# Replace the %CONTENT% in the template with the actual html code.
-html = open('bwlpMonitor_template.html')
-html2 = open('bwlpMonitor.html', 'w')
+html = open('template.html')
+html2 = open('status.html', 'w')
for line in html:
html2.write(line.replace('%CONTENT%', code).replace('%LOG%', log))
diff --git a/bwlpMonitor_template.html b/template.html
index f05c233..f05c233 100644
--- a/bwlpMonitor_template.html
+++ b/template.html