Merge remote-tracking branch 'origin/master' into accounts

This commit is contained in:
Karol Wypchlo 2021-02-08 16:54:18 +01:00
commit f968e6a6c8
2 changed files with 30 additions and 5 deletions

View File

@ -9,11 +9,11 @@
"bytes": "3.1.0", "bytes": "3.1.0",
"classnames": "2.2.6", "classnames": "2.2.6",
"fontsource-metropolis": "4.0.0", "fontsource-metropolis": "4.0.0",
"gatsby": "2.31.1", "gatsby": "2.32.3",
"gatsby-image": "2.10.0", "gatsby-image": "2.11.0",
"gatsby-plugin-manifest": "2.11.0", "gatsby-plugin-manifest": "2.11.0",
"gatsby-plugin-matomo": "0.9.0", "gatsby-plugin-matomo": "0.9.0",
"gatsby-plugin-react-helmet": "3.9.0", "gatsby-plugin-react-helmet": "3.10.0",
"gatsby-plugin-remove-serviceworker": "1.0.0", "gatsby-plugin-remove-serviceworker": "1.0.0",
"gatsby-plugin-robots-txt": "1.5.5", "gatsby-plugin-robots-txt": "1.5.5",
"gatsby-plugin-sass": "3.1.0", "gatsby-plugin-sass": "3.1.0",
@ -43,7 +43,7 @@
"eslint-plugin-cypress": "2.11.2", "eslint-plugin-cypress": "2.11.2",
"eslint-plugin-react": "7.22.0", "eslint-plugin-react": "7.22.0",
"husky": "4.3.8", "husky": "4.3.8",
"lint-staged": "10.5.3", "lint-staged": "10.5.4",
"prettier": "2.2.1" "prettier": "2.2.1"
}, },
"keywords": [ "keywords": [

View File

@ -242,7 +242,12 @@ def contains_string(string_to_check, string_to_find):
async def check_alerts(): async def check_alerts():
print("\nChecking portal siad 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) cmd_string = "docker exec {} siac alerts".format(CONTAINER_NAME)
siac_alert_output = os.popen(cmd_string).read().strip() siac_alert_output = os.popen(cmd_string).read().strip()
@ -277,6 +282,23 @@ async def check_alerts():
if contains_string(line, health_of): if contains_string(line, health_of):
siafile_alerts.append(line) siafile_alerts.append(line)
# Repair Size
# Execute 'siac renter' and read the response
cmd_string = "docker exec {} siac renter".format(CONTAINER_NAME)
siac_renter_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_renter_output.split("\n"):
# Check for the type of alert
if contains_string(line, repair_str):
repair_remaining = line.split()[1]:
################################################################################ ################################################################################
# create a message # create a message
################################################################################ ################################################################################
@ -296,6 +318,9 @@ async def check_alerts():
message += "{} Warning Alerts found. ".format(num_warning_alerts) message += "{} Warning Alerts found. ".format(num_warning_alerts)
message += "{} SiaFiles with bad health found. ".format(num_siafile_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) # send a message if we force notification, or just once daily (heartbeat)
# on 1 AM # on 1 AM
if force_notify or datetime.utcnow().hour == 1: if force_notify or datetime.utcnow().hour == 1: