This commit is contained in:
Adrià 2020-01-27 00:21:03 +01:00
parent b6d9fc1a28
commit e3707750b4
7 changed files with 108 additions and 100 deletions

View file

@ -27,6 +27,7 @@ output = []
# Functions # Functions
def calculate_count(data): def calculate_count(data):
count = {} count = {}
ls = data.values() ls = data.values()
@ -78,6 +79,7 @@ def getMonit():
# Classes # Classes
class monitDashboard(web.application): class monitDashboard(web.application):
def run(self, port=8080, *middleware): def run(self, port=8080, *middleware):
func = self.wsgifunc(*middleware) func = self.wsgifunc(*middleware)
@ -89,10 +91,12 @@ class index(object):
return render.index(output=getMonit(), return render.index(output=getMonit(),
now=datetime.datetime.now()) now=datetime.datetime.now())
class help(object): class help(object):
def GET(self): def GET(self):
return render.help() return render.help()
class download(object): class download(object):
def GET(self): def GET(self):
filename = 'health_report.xlsx' filename = 'health_report.xlsx'
@ -104,6 +108,7 @@ class download(object):
web.header('Cache-Control', 'no-cache') web.header('Cache-Control', 'no-cache')
return open(filename, 'rb').read() return open(filename, 'rb').read()
# Main # Main
if __name__ == "__main__": if __name__ == "__main__":
app = monitDashboard(urls, globals()) app = monitDashboard(urls, globals())

View file

@ -1,6 +1,7 @@
import xlsxwriter import xlsxwriter
import os import os
def generate_report_excel(output, filename): def generate_report_excel(output, filename):
if os.path.exists(filename): if os.path.exists(filename):
os.remove(filename) os.remove(filename)

View file

@ -84,7 +84,9 @@ $for server in range(len(output)):
<div class="canvas-container"> <div class="canvas-container">
<div class="canvas-graph"> <div class="canvas-graph">
<div class="canvas-header"><h2 style="margin: 0">Hosts status</h2></div> <div class="canvas-header">
<h2 style="margin: 0">Hosts status</h2>
</div>
<canvas id="canvas" width="400" height="400"></canvas> <canvas id="canvas" width="400" height="400"></canvas>
</div> </div>
</div> </div>