From 01b8586a8d093ee0f69ab4a454065f813b6842e2 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Fri, 21 Apr 2023 23:54:20 -0600 Subject: [PATCH] fix default values --- check_speedtest.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/check_speedtest.py b/check_speedtest.py index 83e3c0e..4a567c0 100755 --- a/check_speedtest.py +++ b/check_speedtest.py @@ -14,10 +14,10 @@ def main(): https://github.com/tevslin/cloudflarepycli/blob/main/src/cloudflarepycli/__main__.py """ parser = argparse.ArgumentParser(description='Check internet speed.') - parser.add_argument('--warn-up', type=int, default=999999, help='Warn level of upload speed in Mbps.') - parser.add_argument('--critical-up', type=int, default=999999, help='Critical level of upload speed in Mbps.') - parser.add_argument('--warn-down', type=int, default=999999, help='Warn level of download speed in Mbps.') - parser.add_argument('--critical-down', type=int, default=999999, help='Critical level of download speed in Mbps.') + parser.add_argument('--warn-up', type=int, default=-1, help='Warn level of upload speed in Mbps.') + parser.add_argument('--critical-up', type=int, default=-1, help='Critical level of upload speed in Mbps.') + parser.add_argument('--warn-down', type=int, default=-1, help='Warn level of download speed in Mbps.') + parser.add_argument('--critical-down', type=int, default=-1, help='Critical level of download speed in Mbps.') parser.add_argument('--warn-latency', type=int, default=60, help='Warn level of latency in ms.') parser.add_argument('--critical-latency', type=int, default=100, help='Critical level of latency in ms.') args = parser.parse_args() @@ -31,17 +31,17 @@ def main(): if speedtest_results['90th_percentile_upload_speed']['value'] <= args.warn_up and exit_code < nagios.WARNING: exit_code = nagios.WARNING - if speedtest_results['90th_percentile_upload_speed']['value'] <= args.critical_up and exit_code < nagios.CRITICAL: + elif speedtest_results['90th_percentile_upload_speed']['value'] <= args.critical_up and exit_code < nagios.CRITICAL: exit_code = nagios.CRITICAL if speedtest_results['90th_percentile_download_speed']['value'] <= args.warn_down and exit_code < nagios.WARNING: exit_code = nagios.WARNING - if speedtest_results['90th_percentile_download_speed']['value'] <= args.critical_down and exit_code < nagios.CRITICAL: + elif speedtest_results['90th_percentile_download_speed']['value'] <= args.critical_down and exit_code < nagios.CRITICAL: exit_code = nagios.CRITICAL if speedtest_results['latency_ms']['value'] <= args.warn_latency and exit_code < nagios.WARNING: exit_code = nagios.WARNING - if speedtest_results['latency_ms']['value'] <= args.warn_latency and exit_code < nagios.CRITICAL: + elif speedtest_results['latency_ms']['value'] <= args.warn_latency and exit_code < nagios.CRITICAL: exit_code = nagios.CRITICAL if exit_code == nagios.OK: