output formatting

This commit is contained in:
Cyberes 2023-04-21 23:54:18 -06:00
parent 12a2ccf145
commit f37e260d7b
1 changed files with 4 additions and 3 deletions

View File

@ -53,15 +53,16 @@ def main():
bandwidth_utilization = data[i][1] bandwidth_utilization = data[i][1]
if bandwidth_utilization >= crit_value: if bandwidth_utilization >= crit_value:
critical.append(interface) critical.append(interface)
data[i][2] = 'critical' state = 'critical'
exit_code = nagios.CRITICAL exit_code = nagios.CRITICAL
elif bandwidth_utilization >= warn_value: elif bandwidth_utilization >= warn_value:
warn.append(interface) warn.append(interface)
data[i][2] = 'warning' state = 'warning'
exit_code = nagios.WARNING exit_code = nagios.WARNING
else: else:
ok.append(interface) 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 ""} ') 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): if len(ok):