From 07656fd7ff67e4b189aa14ca1645c90a580d72f1 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Fri, 15 Nov 2024 18:06:20 +0100 Subject: [PATCH] Network problem when no bitrate available #3014 --- glances/plugins/network/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/plugins/network/__init__.py b/glances/plugins/network/__init__.py index 615d9d1c0..996c559da 100644 --- a/glances/plugins/network/__init__.py +++ b/glances/plugins/network/__init__.py @@ -299,11 +299,11 @@ def msg_curse(self, args=None, max_width=None): to_bit = 8 unit = 'b' - if args.network_cumul and 'bytes_recv' in i: + if args.network_cumul and 'bytes_recv' in i and 'bytes_sent' in i: 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: + elif 'bytes_recv_rate_per_sec' in i and 'bytes_sent_rate_per_sec' in i: 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