def get_network_interfaces(self): io_counters = self.node.net_io_counters.get() addresses = get_interface_addresses() netifs = {} for addr in addresses: c = io_counters.get(addr["name"]) if not c: continue netifs[addr["name"]] = { "name": addr["name"], "ip": addr["ip"], "bytes_sent": c["bytes_sent"], "bytes_recv": c["bytes_recv"], "packets_sent": c["packets_sent"], "packets_recv": c["packets_recv"], "errors_in": c["errin"], "errors_out": c["errout"], "dropped_in": c["dropin"], "dropped_out": c["dropout"], "send_rate": c["tx_per_sec"], "recv_rate": c["rx_per_sec"], } return netifs
def get_network_interfaces(self): io_counters = self.node.net_io_counters.get() addresses = get_interface_addresses() netifs = {} for addr in addresses: c = io_counters.get(addr['name']) if not c: continue netifs[addr['name']] = { 'name': addr['name'], 'ip': addr['ip'], 'bytes_sent': c['bytes_sent'], 'bytes_recv': c['bytes_recv'], 'packets_sent': c['packets_sent'], 'packets_recv': c['packets_recv'], 'errors_in': c['errin'], 'errors_out': c['errout'], 'dropped_in': c['dropin'], 'dropped_out': c['dropout'], 'send_rate': c['tx_per_sec'], 'recv_rate': c['rx_per_sec'] } return netifs
def build_network_interfaces(): io_counters = current_app.psdash.net_io_counters.get() addresses = get_interface_addresses() if io_counters: for inf in addresses: inf.update(io_counters.get(inf['name'], {})) return addresses