openstack-health-middleware
This middleware checks the healthiness of an OpenStack component by checking its configured database and messaging services (e.g. MariaDB and RabbitMQ).
In the future more checks, like e.g. log file checking will be implemented.
This plugin is derived from the official oslo.middleware
healthcheck
and should behave as described in that document:
- it returns HTTP status code 200 if infrastructure checks were successful
- it returns HTTP status code 503 if at least one check was not successful
Configuration
The plugin can be enabled via the api-paste.ini under the [app:healthcheck] group.
See this example configuration for neutron api-paste.ini:
[composite:neutron]
use = egg:Paste#urlmap
/networking/: neutronversions_composite
/networking/healthcheck: healthcheck
/networking/v2.0: neutronapi_v2_0
...
[app:healthcheck]
paste.app_factory = oslo_middleware:Healthcheck.app_factory
oslo_config_project = neutron
backends = infra_health
messaging_timeout = 5
database_timeout = 5
detailed = False
Options
messaging_timeout: Timeout in seconds for test notification to be received.
database_timeout: Timeout in seconds for database connection to succeed.
Usage
The check itself can be executed by calling the healthcheck endpoint of
the respective OpensStack component, e.g. neutron:
curl -X GET -i -H "Accept: application/json" http://192.168.13.37:9696/networking/healthcheck
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 650
Date: Wed, 14 Aug 2024 08:38:55 GMT
{
"detailed": false,
"reasons": [
[
{
"database": {
"connection": "mysql+pymysql://***:***@127.0.0.1/neutron?charset=utf8&plugin=dbcounter",
"result": "Connection to database is ok"
},
"messaging": {
"message_sent": {
"notification_time": 1723624734622068313
},
"result": "Notification successfully received via messaging",
"transport_url": "rabbit://***:***@192.168.13.37:5672/"
}
}
]
]
}
This example shows a result with unavailable status:
curl -X GET -i -H "Accept: application/json" http://192.168.13.37:9696/networking/healthcheck
HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 514
Date: Wed, 14 Aug 2024 08:56:02 GMT
{
"detailed": false,
"reasons": [
[
{
"database": {
"connection": "mysql+pymysql://***:***@127.0.0.1/neutron?charset=utf8&plugin=dbcounter",
"result": "Connection to database is ok"
},
"messaging": {
"result": "Notification timed out after 5 seconds",
"transport_url": "rabbit://***:***@192.168.13.37:5672/"
}
}
]
]
}
Future ideas
- check processes like nova-compute if they are running (e.g. because logs stopped being written)
- check the logs for errors
Metadata
Release files for openstack-health-middleware 0.20241220.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openstack_health_middleware-0.20241220.0.tar.gz | 11.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openstack_health_middleware-0.20241220.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.6 kB
Release files / openstack_health_middleware-0.20241220.0.tar.gz
| Download URL | openstack_health_middleware-0.20241220.0.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a935440f4eb476ebb022470a7c40c31992fe90dfe84285f48c2e3a3c9d28bbcc
|
|
BLAKE2b-256 checksum How to use checksums |
dc5bfb3ef116ff3dc53f21071b74d3ab074a6d4f5611fc3d21f893a0359e764f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.3
|
Release files / openstack_health_middleware-0.20241220.0-py3-none-any.whl
| Download URL | openstack_health_middleware-0.20241220.0-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bba7fdb6faae8bf7467973c349433a0410c0ddeef04e22fac15242992aa702c6
|
|
BLAKE2b-256 checksum How to use checksums |
54d11310240b8dabbf7ca2131692d37831418c314b0d7f50267e58000df45d57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.3
|