Skip to main content

OpenStack Health Middleware

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openstack_health_middleware-0.20241220.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file openstack_health_middleware-0.20241220.0.tar.gz.

File metadata

File hashes

Hashes for openstack_health_middleware-0.20241220.0.tar.gz
Algorithm Hash digest
SHA256 a935440f4eb476ebb022470a7c40c31992fe90dfe84285f48c2e3a3c9d28bbcc
MD5 824a76e303fe44a3ee202b075f94e4a3
BLAKE2b-256 dc5bfb3ef116ff3dc53f21071b74d3ab074a6d4f5611fc3d21f893a0359e764f

See more details on using hashes here.

File details

Details for the file openstack_health_middleware-0.20241220.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openstack_health_middleware-0.20241220.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bba7fdb6faae8bf7467973c349433a0410c0ddeef04e22fac15242992aa702c6
MD5 6176c256e346cdb71d68095462d61403
BLAKE2b-256 54d11310240b8dabbf7ca2131692d37831418c314b0d7f50267e58000df45d57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page