diff --git a/doc/hmdl.schema.json b/doc/hmdl.schema.json index f98d7c2..2b3c9b4 100644 --- a/doc/hmdl.schema.json +++ b/doc/hmdl.schema.json @@ -547,6 +547,11 @@ "target" ] }, + "timeout": { + "description": "maximum allowed execution time in seconds", + "type": "float", + "default": 5.0 + }, "response": { "type": "object", "additionalProperties": false, diff --git a/source/logic/checks/http_request.py b/source/logic/checks/http_request.py index 3c117d6..5225aac 100644 --- a/source/logic/checks/http_request.py +++ b/source/logic/checks/http_request.py @@ -29,6 +29,11 @@ class implementation_check_kind_http_request(interface_check_kind): "target" ] }, + "timeout": { + "description": "maximum allowed execution time in seconds", + "type": "float", + "default": 5.0 + }, "response": { "type": "object", "additionalProperties": False, @@ -80,6 +85,7 @@ class implementation_check_kind_http_request(interface_check_kind): "request": { "method": "GET" }, + "timeout": 5.0, "response": { "status_code": 200 }, @@ -102,7 +108,8 @@ class implementation_check_kind_http_request(interface_check_kind): if (parameters["request"]["method"] == "GET"): try: response = _requests.get( - parameters["request"]["target"] + parameters["request"]["target"], + timeout = parameters["timeout"] ) error = None except Exception as error_: @@ -111,7 +118,8 @@ class implementation_check_kind_http_request(interface_check_kind): elif (parameters["request"]["method"] == "POST"): try: response = _requests.post( - parameters["request"]["target"] + parameters["request"]["target"], + timeout = parameters["timeout"] ) error = None except Exception as error_: diff --git a/todo.md b/todo.md index c021620..22de17d 100644 --- a/todo.md +++ b/todo.md @@ -7,3 +7,4 @@ - Versionierung - Test-Routinen - neu schreiben in TypeScript (und plankton dafür nutzen)? +- Benachrichtigungen versenden, wenn ein Zustand sich wieder normalisiert hat (aber vorher über dem Schwellwert oft nicht OK war)