From 71fb07c6e80a4309ad217b5981b0b5936a6b737c Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 19 Nov 2023 17:40:22 -0700 Subject: [PATCH] remove levels from cum --- check_opnsense_traffic_for_host_watcher.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/check_opnsense_traffic_for_host_watcher.py b/check_opnsense_traffic_for_host_watcher.py index 61f6e54..578e15d 100755 --- a/check_opnsense_traffic_for_host_watcher.py +++ b/check_opnsense_traffic_for_host_watcher.py @@ -115,11 +115,14 @@ def main(): perf_data[f'max_rate_in'] = {'value': int(check_result["rate_in"]), 'warn': warn_b_value, 'crit': crit_b_value, 'min': 0, 'unit': 'B'} perf_data[f'max_rate_out'] = {'value': int(check_result["rate_out"]), 'warn': warn_b_value, 'crit': crit_b_value, 'min': 0, 'unit': 'B'} - perf_data[f'cumulative_in'] = {'value': int(check_result["cumulative_in"]), 'warn': warn_b_value, 'crit': crit_b_value, 'min': 0, 'unit': 'B'} - perf_data[f'cumulative_out'] = {'value': int(check_result["cumulative_out"]), 'warn': warn_b_value, 'crit': crit_b_value, 'min': 0, 'unit': 'B'} + + # TODO: add warn/crit values for these metrics + perf_data[f'cumulative_in'] = {'value': int(check_result["cumulative_in"]), 'warn': None, 'crit': None, 'min': 0, 'unit': 'B'} + perf_data[f'cumulative_out'] = {'value': int(check_result["cumulative_out"]), 'warn': None, 'crit': None, 'min': 0, 'unit': 'B'} + perf_data[f'connections'] = {'value': int(check_result["connections"]), 'warn': conn_warn, 'crit': conn_crit, 'min': 0} - text_result = ', '.join(f'{name}: {rate}' for name, rate in [*critical, *warn, *ok, ('cumulative_in', filesize(check_result["cumulative_in"])), ('cumulative_out', filesize(check_result["cumulative_out"]))]) + text_result = ', '.join(f'{name}: {rate}' for name, rate in sorted([*critical, *warn, *ok, ('cumulative_in', filesize(check_result["cumulative_in"])), ('cumulative_out', filesize(check_result["cumulative_out"]))])) print_icinga2_check_status(text_result, exit_code, perf_data) sys.exit(exit_code)