[add] "custom"-Feld für http_request-Prüfung

This commit is contained in:
Christian Fraß 2023-04-24 12:19:10 +02:00
parent aa5c2eac95
commit ca658816e8
4 changed files with 36 additions and 1 deletions

View file

@ -589,6 +589,10 @@
"host": { "host": {
"type": "string" "type": "string"
}, },
"port": {
"type": "integer",
"default": 443
},
"strict": { "strict": {
"description": "whether a violation of this check shall be leveled as critical instead of concerning", "description": "whether a violation of this check shall be leveled as critical instead of concerning",
"type": "boolean", "type": "boolean",
@ -689,6 +693,10 @@
"description": "whether a violation of this check shall be leveled as critical instead of concerning", "description": "whether a violation of this check shall be leveled as critical instead of concerning",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
"custom": {
"description": "custom data, which shall be attached to notifications",
"default": null
} }
}, },
"required": [ "required": [

View file

@ -0,0 +1,20 @@
{
"checks": [
{
"name": "test",
"kind": "http_request",
"parameters": {
"request": {
"target": "http://ich-bin-keine-domain.org"
},
"custom": {
"foo": true,
"bar": {
"baz": "BAZ",
"qux": 2.718
}
}
}
}
]
}

View file

@ -15,6 +15,6 @@
] ]
}, },
"includes": [ "includes": [
"tls_certificate.hmdl.json" "http_request.hmdl.json"
] ]
} }

View file

@ -69,6 +69,10 @@ class implementation_check_kind_http_request(interface_check_kind):
"type": "boolean", "type": "boolean",
"default": True "default": True
}, },
"custom": {
"description": "custom data, which shall be attached to notifications",
"default": None
},
}, },
"required": [ "required": [
"request" "request"
@ -90,6 +94,7 @@ class implementation_check_kind_http_request(interface_check_kind):
"status_code": 200 "status_code": 200
}, },
"strict": True, "strict": True,
"custom": None,
}, },
node, node,
True True
@ -139,6 +144,7 @@ class implementation_check_kind_http_request(interface_check_kind):
"faults": [ "faults": [
translation_get("checks.http_request.request_failed"), translation_get("checks.http_request.request_failed"),
], ],
"custom": parameters["custom"],
} }
} }
else: else:
@ -204,6 +210,7 @@ class implementation_check_kind_http_request(interface_check_kind):
# "body": response.text, # "body": response.text,
}, },
"faults": faults, "faults": faults,
"custom": parameters["custom"],
} }
} }