Added health check feature to find faulty components
This commit is contained in:
@@ -14,7 +14,7 @@ class MongoManager:
|
||||
if MongoManager.__instance != None:
|
||||
raise Exception("This class is a singleton!")
|
||||
else:
|
||||
MongoManager.__instance = pymongo.MongoClient('127.0.0.1', 27017)
|
||||
MongoManager.__instance = pymongo.MongoClient('127.0.0.1', port=27017, serverSelectionTimeoutMS=1000)
|
||||
db = MongoManager.__instance.AIC
|
||||
coll = db.metadata
|
||||
db.coll["identifier"]
|
||||
|
||||
@@ -141,3 +141,14 @@ class ImageEndpoint:
|
||||
result_bool = False
|
||||
|
||||
return JsonResponse({'Result': result_bool}, safe=False)
|
||||
|
||||
class HealthEndpoint:
|
||||
@staticmethod
|
||||
@api_view(['GET'])
|
||||
def check_systems(request):
|
||||
logger.debug('Check health of all sub-systems')
|
||||
mongo = MongoDBService.check()
|
||||
dbx = DropboxService.check()
|
||||
minio = MinioService.check()
|
||||
|
||||
return JsonResponse({'MongoDB': mongo, 'Dropbox': dbx, 'MinIO': minio}, safe=False)
|
||||
|
||||
Reference in New Issue
Block a user