예제 #1
0
def getUpDiff(interface):
    if interface not in NET_INTERFACES:
        return 0
    netstats = _statgrab.py_sg_get_network_io_stats()
    for i in netstats:
        if i['interface_name'] == interface:
            NET_LAST_U[interface] = NET_U[interface]
            NET_U[interface] = i['tx']
    return NET_U[interface] - NET_LAST_U[interface]
예제 #2
0
def getDownDiff(interface):
    if interface not in NET_INTERFACES:
        return 0
    netstats = _statgrab.py_sg_get_network_io_stats()
    for i in netstats:
        if i['interface_name'] == interface:
            NET_LAST_D[interface] = NET_D[interface]
            NET_D[interface] = i['rx']
    return NET_D[interface] - NET_LAST_D[interface]
예제 #3
0
def initNetIfaces():
    network_ifaces = _statgrab.py_sg_get_network_iface_stats()
    for i in network_ifaces:
        NET_INTERFACES.append(i['interface_name'])

    for i in NET_INTERFACES:
        netstats = _statgrab.py_sg_get_network_io_stats()
        for j in netstats:
            if j['interface_name'] == i:
                NET_D[i] = NET_LAST_D[i] = j['rx']
                NET_U[i] = NET_LAST_U[i] = j['tx']
예제 #4
0
def initNetIfaces():
    network_ifaces = _statgrab.py_sg_get_network_iface_stats()
    for i in network_ifaces:
        NET_INTERFACES.append(i['interface_name'])

    for i in NET_INTERFACES:
        netstats = _statgrab.py_sg_get_network_io_stats()
        for j in netstats:
            if j['interface_name'] == i:
                NET_D[i] = NET_LAST_D[i] = j['rx']
                NET_U[i] = NET_LAST_U[i] = j['tx']