(atype, cid, check_key, action)
return replydata['data']
Web based API for various health checks
Web based API for various health checks
Web based API for various health checks
def checkapi_page(atype, cid, check_key, action):
    ''' Web based API for various health checks '''
    monitor = Monitor(cid)
    monitor.config = app.config
    urldata = {
        'cid': cid,
        'atype': atype,
        'check_key': check_key,
        'action': action
    }
    app.logger.debug("Got new API request with these details: %s" % json.dumps(urldata))
    try:
        webapi = __import__(
            "monitorapis." + atype, globals(), locals(), ['webCheck'], -1)
        replydata = webapi.webCheck(request, monitor, urldata, g.rdb_conn)
    except Exception as e:
        app.logger.error("/api/%s - webCheck action failed - %s" % (atype, e.message))
        replydata = {
            'headers': {'Content-type': 'application/json'},
            'data': "{ 'results' : 'fatal error'  }"
        }

    print("/api/%s - API request") % atype
    return replydata['data']
def checkapi_page ( atype , cid , check_key , action ) : monitor = Monitor ( cid ) monitor . config = app . config urldata = { 'cid' : cid , 'atype' : atype , 'check_key' : check_key , 'action' : action } app . logger . debug ( "Got new API request with these details: %s" % json . dumps ( urldata ) ) try : webapi = __import__ ( "monitorapis." + atype , globals ( ) , locals ( ) , [ 'webCheck' ] , - 1 ) replydata = webapi . webCheck ( request , monitor , urldata , g . rdb_conn ) except Exception as e : app . logger . error ( "/api/%s - webCheck action failed - %s" % ( atype , e . message ) ) replydata = { 'headers' : { 'Content-type' : 'application/json' } , 'data' : "{ 'results' : 'fatal error'  }" } print ( "/api/%s - API request" ) % atype return replydata [ 'data' ]