diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index 8497b2cc310e778f08c892b871cd0b928591c44b..fea6e948a27ea329a20b4db0e4169c0cd8803a16 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -82,3 +82,23 @@ def poller_interface_oids(hostname): result.append(ifc_data) return jsonify(result) + + +@routes.route('/services/{category}', methods=['GET', 'POST']) +@common.require_accepts_json +def service_category_interfaces(category): + + result = [] + + r = common.get_current_redis() + for k in r.scan_iter(f'interface-services:{category}:*'): + ifc = r.get(k.decode('utf-8')) + result.append(json.loads(ifc.decode('utf-8'))) + + if not result: + return Response( + response=f'no info available for service category {category}', + status=404, + mimetype="text/html") + + return jsonify(result)