From 9dd93fd7af5134741282eaa4f4cc65d580192e5a Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Fri, 16 May 2025 17:28:15 +0200 Subject: [PATCH] Improve code formatting --- check_iperf3.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/check_iperf3.py b/check_iperf3.py index 2decde2..abf6f28 100755 --- a/check_iperf3.py +++ b/check_iperf3.py @@ -305,12 +305,12 @@ def build_perfdata(options, json_data: dict) -> List[str]: json_end = json_data['end'] bps_avg_up = json_end['sum_sent']['bits_per_second'] if options.bidir or not options.downstream else None - bps_avg_down = json_end['sum_sent_bidir_reverse']['bits_per_second'] if options.bidir else json_data[ - 'end']['sum_sent']['bits_per_second'] if options.downstream else None + bps_avg_down = json_end['sum_sent_bidir_reverse']['bits_per_second'] if options.bidir else \ + json_data['end']['sum_sent']['bits_per_second'] if options.downstream else None if not options.udp: retrans_sum_up = json_end['sum_sent']['retransmits'] if options.bidir or not options.downstream else None - retrans_sum_down = json_end['sum_sent_bidir_reverse']['retransmits'] if options.bidir else json_data[ - 'end']['sum_sent']['retransmits'] if options.downstream else None + retrans_sum_down = json_end['sum_sent_bidir_reverse']['retransmits'] if options.bidir else \ + json_data['end']['sum_sent']['retransmits'] if options.downstream else None if bps_avg_up is not None: perfdata.append(build_single_perfdata("bps_avg_up", bits_per_second( @@ -327,10 +327,10 @@ def build_perfdata(options, json_data: dict) -> List[str]: perfdata.append(build_single_perfdata("retrans_sum_down", packets( retrans_sum_down), options.retrans_warn, options.retrans_crit)) - perfdata.append(build_single_perfdata("local_cpu", percent( - json_end['cpu_utilization_percent']['host_total']))) - perfdata.append(build_single_perfdata("remote_cpu", percent( - json_end['cpu_utilization_percent']['remote_total']))) + perfdata.append(build_single_perfdata("local_cpu", + percent(json_end['cpu_utilization_percent']['host_total']))) + perfdata.append(build_single_perfdata("remote_cpu", + percent(json_end['cpu_utilization_percent']['remote_total']))) return perfdata def check_iperf3(options):