summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc_collector/healthcheck.py40
-rwxr-xr-xsrc/soc_collector/healthcheck.sh11
2 files changed, 0 insertions, 51 deletions
diff --git a/src/soc_collector/healthcheck.py b/src/soc_collector/healthcheck.py
deleted file mode 100644
index 1ccd8f3..0000000
--- a/src/soc_collector/healthcheck.py
+++ /dev/null
@@ -1,40 +0,0 @@
-"""
-Send a healthcheck request
-"""
-import sys
-import time
-import json
-
-import requests
-
-from src.soc_collector.auth import load_api_keys
-
-def check_collector() -> bool:
- """Check our collector using /info
-
- :return: bool
- """
- time.sleep(2) # Prevent race condition with mongodb container healthcheck
-
- req = requests.get(
- "https://localhost:8000/info",
- headers={"API-KEY": load_api_keys("./api_keys.txt")[-1]},
- timeout=3,
- verify="./collector_root_ca.crt",
- )
-
- if req.status_code != 200:
- return False
-
- data = json.loads(req.text)
- if isinstance(data["Estimated document count"], int) and data["Estimated document count"] >= 0:
- return req.status_code == 200
-
- return False
-
-
-if __name__ == "__main__":
- if sys.argv[1] == "COLLECTOR":
- if check_collector():
- sys.exit(0)
- sys.exit(1)
diff --git a/src/soc_collector/healthcheck.sh b/src/soc_collector/healthcheck.sh
deleted file mode 100755
index 10d599c..0000000
--- a/src/soc_collector/healthcheck.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-# If mongodb container
-if [ "$1" = "MONGODB" ]
-then
- /usr/bin/mongosh --eval 'disableTelemetry()' -u "$MONGODB_USERNAME" -p "$MONGODB_PASSWORD" localhost:27017/production /healthcheck-mongodb.js
- exit $?
-fi
-
-# If collector
-/usr/bin/python3 ./src/soc_collector/healthcheck.py "$1" || exit 1