diff --git a/glances/plugins/network/__init__.py b/glances/plugins/network/__init__.py index 449a2d5d..c753876d 100644 --- a/glances/plugins/network/__init__.py +++ b/glances/plugins/network/__init__.py @@ -300,11 +300,11 @@ class PluginModel(GlancesPluginModel): to_bit = 8 unit = 'b' - if args.network_cumul and 'bytes_recv' in i and 'bytes_sent' in i: + if args.network_cumul and i.get('bytes_recv') is not None and i.get('bytes_sent') is not None: rx = self.auto_unit(int(i['bytes_recv'] * to_bit)) + unit tx = self.auto_unit(int(i['bytes_sent'] * to_bit)) + unit ax = self.auto_unit(int(i['bytes_all'] * to_bit)) + unit - elif 'bytes_recv_rate_per_sec' in i and 'bytes_sent_rate_per_sec' in i: + elif i.get('bytes_recv_rate_per_sec') is not None and i.get('bytes_sent_rate_per_sec') is not None: rx = self.auto_unit(int(i['bytes_recv_rate_per_sec'] * to_bit)) + unit tx = self.auto_unit(int(i['bytes_sent_rate_per_sec'] * to_bit)) + unit ax = self.auto_unit(int(i['bytes_all_rate_per_sec'] * to_bit)) + unit