def checkaction_page(cid, action): ''' Dashboard Delete Checks: This will delete health checks via the url parameters ''' verify = verifyLogin(app.config['SECRET_KEY'], app.config['COOKIE_TIMEOUT'], request.cookies) if verify: user = User() user.get('uid', verify, g.rdb_conn) if user.status != "active": pass else: ## Delete the Monitor monitor = Monitor(cid) monitor.get(cid, g.rdb_conn) if user.uid == monitor.uid: if action == "failed": monitor.healthcheck = "web-failed" result = monitor.webCheck(g.rdb_conn) print("/dashboard/action-checks - Manual monitor failure") elif action == "healthy": monitor.healthcheck = "web-healthy" print("/dashboard/action-checks - Manual monitor healthy") result = monitor.webCheck(g.rdb_conn) if result: print("/dashboard/action-checks - Manual monitor queued") flash('Health check status change is queued', 'success') else: print("/dashboard/action-checks - Manual monitor action failed") flash('Something went wrong. Could not modify health check', 'danger') else: print("/dashboard/action-checks - Manual monitor action failed: do not own") flash('It does not appear you own this health check', 'danger') return redirect(url_for('dashboard_page'))
def checkaction_page(cid, action): ''' Dashboard Update Checks: This will update health checks via the url parameters ''' verify = verifyLogin(app.config['SECRET_KEY'], app.config['COOKIE_TIMEOUT'], request.cookies) if verify: user = User() user.config = app.config user.get('uid', verify, g.rdb_conn) if user.status != "active": pass else: # Update the Monitor monitor = Monitor(cid) monitor.config = app.config monitor.get(cid, g.rdb_conn) if user.uid == monitor.uid: if action == "false": monitor.healthcheck = "web-false" result = monitor.webCheck(g.rdb_conn) print("/dashboard/action-checks - Manual monitor failure") elif action == "true": monitor.healthcheck = "web-true" print("/dashboard/action-checks - Manual monitor true") result = monitor.webCheck(g.rdb_conn) if result: print("/dashboard/action-checks - Manual monitor queued") flash('Health check status change is queued.', 'success') else: print("/dashboard/action-checks - \ Manual monitor action failed") flash( 'Something went wrong. \ Could not modify health check.', 'danger') else: print("/dashboard/action-checks - \ Manual monitor action failed: do not own") flash('It does not appear you own this health check.', 'danger') return redirect(url_for('member.dashboard_page'))