mirror of
https://github.com/FAUSheppy/icinga-webhook-gateway
synced 2025-12-06 07:21:38 +01:00
implement simple overview
This commit is contained in:
@@ -13,6 +13,7 @@ from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.sql import func
|
||||
import sqlalchemy
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.sql.expression import func
|
||||
|
||||
app = flask.Flask("Icinga Report In Gateway")
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.sqlite'
|
||||
@@ -44,6 +45,13 @@ def buildReponseDict(status, service=None):
|
||||
"timestamp" : status.timestamp,
|
||||
"info" : status.info_text }
|
||||
|
||||
@app.route('/overview')
|
||||
def overview():
|
||||
baseQuery = db.session.query(Status, func.max(Status.timestamp))
|
||||
query = baseQuery.group_by(Status.service).order_by(Status.service)
|
||||
results = query.all()
|
||||
return flask.render_template("overview.html", services=results, datetime=datetime.datetime)
|
||||
|
||||
@app.route('/alive')
|
||||
def alive():
|
||||
# simple location for icinga alive checks via HTTP #
|
||||
|
||||
Reference in New Issue
Block a user