Example #1
0
def get_top10_flapping():

    try:
        query, _, _, group, _, _, _ = parse_fields(request.args)
    except Exception as e:
        return jsonify(status="error", message=str(e)), 400

    try:
        top10 = db.get_topn_flapping(query=query, group=group, limit=10)
    except Exception as e:
        return jsonify(status="error", message=str(e)), 500

    for item in top10:
        for resource in item['resources']:
            resource['href'] = absolute_url('/alert/' + resource['id'])

    if top10:
        return jsonify(status="ok", total=len(top10), top10=top10)
    else:
        return jsonify(
            status="ok",
            message="not found",
            total=0,
            top10=[],
        )
Example #2
0
def get_top10_flapping():

    try:
        query, _, _, group, _, _, _ = parse_fields(request.args)
    except Exception as e:
        return jsonify(status="error", message=str(e)), 400

    try:
        top10 = db.get_topn_flapping(query=query, group=group, limit=10)
    except Exception as e:
        return jsonify(status="error", message=str(e)), 500

    for item in top10:
        for resource in item['resources']:
            resource['href'] = absolute_url('/alert/' + resource['id'])

    if top10:
        return jsonify(
            status="ok",
            total=len(top10),
            top10=top10
        )
    else:
        return jsonify(
            status="ok",
            message="not found",
            total=0,
            top10=[],
        )
Example #3
0
 def get_top10_flapping(query: Query = None) -> List[Dict[str, Any]]:
     return db.get_topn_flapping(query, topn=10)
Example #4
0
 def get_top10_flapping(query=None):
     return db.get_topn_flapping(query, topn=10)
Example #5
0
 def get_top10_flapping(query=None):
     return db.get_topn_flapping(query)
Example #6
0
 def get_topn_flapping(query: Query = None,
                       topn: int = 10) -> List[Dict[str, Any]]:
     return db.get_topn_flapping(query, topn=topn)
Example #7
0
 def get_top10_flapping(query: Query=None) -> List[Dict[str, Any]]:
     return db.get_topn_flapping(query, topn=10)