Added health check feature to find faulty components

This commit is contained in:
Martin Schett
2020-12-06 18:53:29 +01:00
parent ddf0cbf2d7
commit 08b30bb9cd
7 changed files with 67 additions and 3 deletions
+18
View File
@@ -104,6 +104,20 @@ def get_all():
return True
def check_system():
print("Checking system health")
baseurl = "http://127.0.0.1:8000"
get_url = "/check"
try:
response = requests.get(baseurl + get_url)
print_response(response)
except os.error:
print("Error checking system health")
return True
metadata = None
index = 0
metadata_folder = "." + os.path.sep
@@ -160,6 +174,7 @@ while (command.lower() not in ["exit", "quit", "end"]):
print("List of commands:")
print("exit - exits the program")
print("help - lists all commands")
print("check - control health of all associated systems")
print("dir - list current selected image folder")
print("len - length of current metadata set")
print("index - display index of current lined up image")
@@ -179,6 +194,9 @@ while (command.lower() not in ["exit", "quit", "end"]):
print()
print()
if command.lower() == "check":
check_system()
if command.lower() == "dir":
print("Current image folder is " + image_folder)