[add] check:http_request:timeout
This commit is contained in:
parent
4934a0829a
commit
48aa2e18fe
|
|
@ -547,6 +547,11 @@
|
||||||
"target"
|
"target"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"timeout": {
|
||||||
|
"description": "maximum allowed execution time in seconds",
|
||||||
|
"type": "float",
|
||||||
|
"default": 5.0
|
||||||
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ class implementation_check_kind_http_request(interface_check_kind):
|
||||||
"target"
|
"target"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"timeout": {
|
||||||
|
"description": "maximum allowed execution time in seconds",
|
||||||
|
"type": "float",
|
||||||
|
"default": 5.0
|
||||||
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
|
|
@ -80,6 +85,7 @@ class implementation_check_kind_http_request(interface_check_kind):
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET"
|
"method": "GET"
|
||||||
},
|
},
|
||||||
|
"timeout": 5.0,
|
||||||
"response": {
|
"response": {
|
||||||
"status_code": 200
|
"status_code": 200
|
||||||
},
|
},
|
||||||
|
|
@ -102,7 +108,8 @@ class implementation_check_kind_http_request(interface_check_kind):
|
||||||
if (parameters["request"]["method"] == "GET"):
|
if (parameters["request"]["method"] == "GET"):
|
||||||
try:
|
try:
|
||||||
response = _requests.get(
|
response = _requests.get(
|
||||||
parameters["request"]["target"]
|
parameters["request"]["target"],
|
||||||
|
timeout = parameters["timeout"]
|
||||||
)
|
)
|
||||||
error = None
|
error = None
|
||||||
except Exception as error_:
|
except Exception as error_:
|
||||||
|
|
@ -111,7 +118,8 @@ class implementation_check_kind_http_request(interface_check_kind):
|
||||||
elif (parameters["request"]["method"] == "POST"):
|
elif (parameters["request"]["method"] == "POST"):
|
||||||
try:
|
try:
|
||||||
response = _requests.post(
|
response = _requests.post(
|
||||||
parameters["request"]["target"]
|
parameters["request"]["target"],
|
||||||
|
timeout = parameters["timeout"]
|
||||||
)
|
)
|
||||||
error = None
|
error = None
|
||||||
except Exception as error_:
|
except Exception as error_:
|
||||||
|
|
|
||||||
1
todo.md
1
todo.md
|
|
@ -7,3 +7,4 @@
|
||||||
- Versionierung
|
- Versionierung
|
||||||
- Test-Routinen
|
- Test-Routinen
|
||||||
- neu schreiben in TypeScript (und plankton dafür nutzen)?
|
- 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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue