def controller_api_get_current_sensors(engine):
    """Returns a list of current active sensors"""
    redis = get_redis()
    sensors = []

    if engine is None or engine == "" or engine not in supported_engines:
        return Response(
            "Invalid 'engine' supplied.  Must be one of %s.\nExample URI:\n\n/dalton/controller_api/get-current-sensors/suricata"
            % supported_engines,
            status=400,
            mimetype="text/plain",
            headers={"X-Dalton-Webapp": "OK"},
        )

    # first, clean out old sensors
    clear_old_agents(redis)

    # get active sensors based on engine
    if redis.exists("sensors"):
        for sensor in redis.smembers("sensors"):
            t = redis.get("%s-tech" % sensor)
            if t.lower().startswith(engine.lower()):
                sensors.append(t)

    # sort so highest version number is first; ignore "rust_" prefix
    try:
        sensors.sort(
            key=lambda v: LooseVersion(
                prefix_strip(v.split("/", 1)[1], prefixes="rust_")
            ),
            reverse=True,
        )
    except Exception:
        try:
            sensors.sort(key=LooseVersion, reverse=True)
        except Exception:
            sensors.sort(reverse=True)

    # return json
    json_response = {"sensor_tech": sensors}
    return Response(
        json.dumps(json_response),
        status=200,
        mimetype="application/json",
        headers={"X-Dalton-Webapp": "OK"},
    )
Returns a list of current active sensors
app/dalton.py