From f37e260d7bd976f481e899f30c8539d935b23de0 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Fri, 21 Apr 2023 23:54:18 -0600 Subject: [PATCH] output formatting --- check_bandwidth.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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):