diff --git a/lemur/common/health.py b/lemur/common/health.py index e5b6d509..1dfb2732 100644 --- a/lemur/common/health.py +++ b/lemur/common/health.py @@ -7,10 +7,21 @@ .. moduleauthor:: Kevin Glisson """ from flask import Blueprint +from lemur.database import db mod = Blueprint('healthCheck', __name__) @mod.route('/healthcheck') def health(): - return 'ok' + try: + if healthcheck(db): + return 'ok' + except: + return 'db check failed' + + +def healthcheck(db): + with db.engine.connect() as connection: + connection.execute('SELECT 1;') + return True