예제 #1
0
def get_terminal_moid(e164='', ip=''):
    if e164:
        with get_redis_client() as client:
            return client.hget('terminal:%s:baseinfo' % e164, 'moid')
    if ip:
        with get_redis_client() as client:
            return client.hget('terminal:ip2moid', ip)
예제 #2
0
def ev_machine_room_sfu_info(machine_room_moid, used_sfu, remainder_sfu):
    key = 'machine_room:' + machine_room_moid + ':info'
    with get_redis_client() as client:
        client.hmset(key, {
            'used_sfu': used_sfu,
            'remainder_sfu': remainder_sfu
        })
예제 #3
0
def ev_machine_room_res_info(machine_room_moid, total_port, remainder_port,
                             remainder_tra):
    key = 'machine_room:' + machine_room_moid + ':info'
    with get_redis_client() as client:
        client.hmset(
            key, {
                'total_port': total_port,
                'remainder_port': remainder_port,
                'remainder_tra': remainder_tra
            })
예제 #4
0
def ev_rms_mp_info(service_type, moid, total_h264, used_h264, total_h265,
                   used_h265):
    suffix = 'mg' if service_type == 0 else 'g_mg'
    key = 'domain:' + moid + ':' + suffix
    with get_redis_client() as client:
        client.hmset(
            key, {
                'total_h264': total_h264,
                'used_h264': used_h264,
                'total_h265': total_h265,
                'used_h265': used_h265
            })
예제 #5
0
def get_types():
    with get_redis_client() as client:
        return client.smembers('p_server:type'), client.smembers(
            'l_server:type')
예제 #6
0
def flush_redis_db():
    with get_redis_client() as client:
        client.flushall()
예제 #7
0
def get_collector_online_server(collectorid):
    with get_redis_client() as client:
        return client.hgetall('collector:%s:online' % collectorid)
예제 #8
0
def add_collector(collectorid, devid):
    with get_redis_client() as client:
        client.sadd('collector', collectorid)
        client.hset('collector:%s:info' % collectorid, 'p_server_moid', devid)
예제 #9
0
def get_collectors():
    with get_redis_client() as client:
        return client.smembers('collector')
예제 #10
0
def ev_aps_add_mt_info(moid, operator_type):
    with get_redis_client() as client:
        client.hset('terminal:' + moid + ':baseinfo', 'operator_type',
                    operator_type)
예제 #11
0
def get_warning_server_limit(moid, resource):
    with get_redis_client() as client:
        limit = client.hget('warning:limit:' + moid, resource)
    if limit is None:
        limit = common.SERVER_RESOURCE_LIMIT[resource]
    return limit
예제 #12
0
def get_collector_p_server_moid(collectorid):
    with get_redis_client() as client:
        key = 'collector:%s:info' % collectorid
        return client.hget(key, 'p_server_moid')
예제 #13
0
def ev_rms_vmr_info(moid, mapping):
    key = 'domain:' + moid + ':vmr'
    with get_redis_client() as client:
        client.hmset(key, mapping)
예제 #14
0
def ev_logical_server_info(moid, version):
    with get_redis_client() as client:
        client.hset('l_server:' + moid + ':info', 'version', version)
예제 #15
0
def nms_is_first_import():
    with get_redis_client() as client:
        r = client.get('nms_first_import')
        return r != common.IMPORT_FLAG
예제 #16
0
def get_warning_global_limit(resource):
    with get_redis_client() as client:
        return client.hget('warning:limit:global', resource)
예제 #17
0
def set_nms_first_import():
    with get_redis_client() as client:
        client.set('nms_first_import', common.IMPORT_FLAG)
예제 #18
0
def get_stop_warning(moid):
    with get_redis_client() as client:
        return client.sismember('warning:stop', moid)
예제 #19
0
def ev_srv_system_uptime(moid, uptime):
    with get_redis_client() as client:
        client.hset('p_server:' + moid + ':info', 'uptime', uptime)