diff --git a/check_bandwidth.py b/check_bandwidth.py index 76a58f5..4bc8cc8 100755 --- a/check_bandwidth.py +++ b/check_bandwidth.py @@ -53,15 +53,16 @@ def main(): bandwidth_utilization = data[i][1] if bandwidth_utilization >= crit_value: critical.append(interface) - data[i][2] = 'critical' + state = 'critical' exit_code = nagios.CRITICAL elif bandwidth_utilization >= warn_value: warn.append(interface) - data[i][2] = 'warning' + state = 'warning' exit_code = nagios.WARNING else: ok.append(interface) - data[i][2] = 'ok' + state = 'ok' + data[i][2] = f'[{state.upper()}]' perf_data.append(f'{interface}={round(bandwidth_utilization, 2)}MB;{warn_value};{crit_value};{f"0;{args.max};" if args.max else ""} ') if len(ok):