diff --git a/q5-mithal-monitor/dashboard.html b/q5-mithal-monitor/dashboard.html index e69de29..aed253c 100644 --- a/q5-mithal-monitor/dashboard.html +++ b/q5-mithal-monitor/dashboard.html @@ -0,0 +1,98 @@ + + + + + + Application Dashboard + + + + + + + +
+ +

Application Dashboard

+ +

+ Status: + Loading... +

+ +

+ Requests: + 0 +

+ +

+ Response Time: + 0 ms +

+ +
+ + + + + diff --git a/q5-mithal-monitor/monitor.py b/q5-mithal-monitor/monitor.py index e69de29..29f8051 100644 --- a/q5-mithal-monitor/monitor.py +++ b/q5-mithal-monitor/monitor.py @@ -0,0 +1,25 @@ +import requests +import time + +URL = "http://127.0.0.1:8000/health" + +while True: + try: + start = time.time() + + response = requests.get(URL) + + end = time.time() + + response_time = round((end - start) * 1000, 2) + + print("=" * 40) + print("Status Code :", response.status_code) + print("Application :", "UP") + print("Response Time:", response_time, "ms") + + except Exception: + print("=" * 40) + print("Application : DOWN") + + time.sleep(30)