[add] check:http_request:timeout

This commit is contained in:
Christian Fraß 2022-12-15 15:51:07 +01:00
parent 4934a0829a
commit 48aa2e18fe
3 changed files with 16 additions and 2 deletions

View file

@ -547,6 +547,11 @@
"target"
]
},
"timeout": {
"description": "maximum allowed execution time in seconds",
"type": "float",
"default": 5.0
},
"response": {
"type": "object",
"additionalProperties": false,

View file

@ -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_:

View file

@ -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)