From ff183beb663cf0d9c18eaa1702cd4b104d2c1716 Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Wed, 3 Feb 2021 09:42:55 -0700 Subject: [PATCH 1/3] Add repair size information to health checker --- setup-scripts/health-checker.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/setup-scripts/health-checker.py b/setup-scripts/health-checker.py index 380e3d77..2ed208de 100755 --- a/setup-scripts/health-checker.py +++ b/setup-scripts/health-checker.py @@ -242,7 +242,12 @@ def contains_string(string_to_check, string_to_find): async def check_alerts(): print("\nChecking portal siad alerts...") - # Execute siac alerts and read the response + ################################################################################ + # parse siac + ################################################################################ + + # Alerts + # Execute 'siac alerts' and read the response cmd_string = "docker exec {} siac alerts".format(CONTAINER_NAME) siac_alert_output = os.popen(cmd_string).read().strip() @@ -277,6 +282,23 @@ async def check_alerts(): if contains_string(line, health_of): siafile_alerts.append(line) + # Repair Size + # Execute 'siac renter' and read the response + cmd_string = "docker exec {} siac renter".format(CONTAINER_NAME) + siac_alert_output = os.popen(cmd_string).read().strip() + + # Initialize variables + repair_remaining = '' + + # Pattern strings to search for + repair_str = 'Repair Data Remaining' + + # Split the output by line and check for the repair remaining + for line in siac_alert_output.split("\n"): + # Check for the type of alert + if contains_string(line, repair_str): + repair_remaining = line.split()[1]: + ################################################################################ # create a message ################################################################################ @@ -295,6 +317,9 @@ async def check_alerts(): num_warning_alerts -= num_siafile_alerts message += "{} Warning Alerts found. ".format(num_warning_alerts) message += "{} SiaFiles with bad health found. ".format(num_siafile_alerts) + + # Add repair size + message += "{} of repair remaining. ".format(repair_remaining) # send a message if we force notification, or just once daily (heartbeat) # on 1 AM From 50dff35da8d48823e72c0a304942b76d6e0a2ed7 Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Wed, 3 Feb 2021 10:22:24 -0700 Subject: [PATCH 2/3] Update setup-scripts/health-checker.py Co-authored-by: Marcin S. --- setup-scripts/health-checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-scripts/health-checker.py b/setup-scripts/health-checker.py index 2ed208de..f849cfb6 100755 --- a/setup-scripts/health-checker.py +++ b/setup-scripts/health-checker.py @@ -285,7 +285,7 @@ async def check_alerts(): # Repair Size # Execute 'siac renter' and read the response cmd_string = "docker exec {} siac renter".format(CONTAINER_NAME) - siac_alert_output = os.popen(cmd_string).read().strip() + siac_renter_output = os.popen(cmd_string).read().strip() # Initialize variables repair_remaining = '' From c752a17058ce2dcc2accba96450529eb755447de Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Wed, 3 Feb 2021 10:30:27 -0700 Subject: [PATCH 3/3] Update setup-scripts/health-checker.py --- setup-scripts/health-checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-scripts/health-checker.py b/setup-scripts/health-checker.py index f849cfb6..af6202a2 100755 --- a/setup-scripts/health-checker.py +++ b/setup-scripts/health-checker.py @@ -294,7 +294,7 @@ async def check_alerts(): repair_str = 'Repair Data Remaining' # Split the output by line and check for the repair remaining - for line in siac_alert_output.split("\n"): + for line in siac_renter_output.split("\n"): # Check for the type of alert if contains_string(line, repair_str): repair_remaining = line.split()[1]: