adjust output
This commit is contained in:
parent
0f0e65e272
commit
226412a5d1
|
@ -76,7 +76,7 @@ def main():
|
|||
conn_warn = args.conn_warn if args.conn_warn > -1 else None
|
||||
conn_crit = args.conn_crit if args.conn_crit > -1 else None
|
||||
|
||||
exit_code = nagios.OK
|
||||
exit_code = nagios.STATE_OK
|
||||
critical = []
|
||||
warn = []
|
||||
ok = []
|
||||
|
@ -103,14 +103,15 @@ def main():
|
|||
return nagios.STATE_OK
|
||||
|
||||
in_state = get_state(check_result['rate_in'], warn_b_value, crit_b_value, 'ge')
|
||||
in_exit_code = check(f'rate_in', in_state, check_result['rate_in'])
|
||||
in_exit_code = check(f'max_rate_in', in_state, check_result['rate_in'])
|
||||
|
||||
out_state = get_state(check_result['rate_out'], warn_b_value, crit_b_value, 'ge')
|
||||
out_exit_code = check(f'rate_out', out_state, check_result['rate_out'])
|
||||
out_exit_code = check(f'max_rate_out', out_state, check_result['rate_out'])
|
||||
|
||||
conn_state = get_state(check_result['connections'], conn_warn, conn_crit, 'ge')
|
||||
conn_exit_code = check(f'connections', conn_state, check_result['connections'], do_filesize=False)
|
||||
conn_exit_code = 0
|
||||
|
||||
exit_code = max(exit_code, in_exit_code, out_exit_code, conn_exit_code)
|
||||
|
||||
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'}
|
||||
|
@ -118,7 +119,7 @@ def main():
|
|||
perf_data[f'cumulative_out'] = {'value': int(check_result["cumulative_out"]), 'warn': warn_b_value, 'crit': crit_b_value, '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])
|
||||
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"]))])
|
||||
print_icinga2_check_status(text_result, exit_code, perf_data)
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
|
Loading…
Reference in New Issue