HealthΒΆ

Read StatusΒΆ

Health.read_health_status(standby_ok=False, active_code=200, standby_code=429, dr_secondary_code=472, performance_standby_code=473, sealed_code=503, uninit_code=501, method='HEAD')[source]

Read the health status of Vault.

This matches the semantics of a Consul HTTP health check and provides a simple way to monitor the health of a Vault instance.

Parameters:
  • standby_ok (bool) – Specifies if being a standby should still return the active status code instead of the standby status code. This is useful when Vault is behind a non-configurable load balance that just wants a 200-level response.
  • active_code (int) – The status code that should be returned for an active node.
  • standby_code (int) – Specifies the status code that should be returned for a standby node.
  • dr_secondary_code (int) – Specifies the status code that should be returned for a DR secondary node.
  • performance_standby_code (int) – Specifies the status code that should be returned for a performance standby node.
  • sealed_code (int) – Specifies the status code that should be returned for a sealed node.
  • uninit_code (int) – Specifies the status code that should be returned for a uninitialized node.
  • method (str | unicode) – Supported methods: HEAD: /sys/health. Produces: 000 (empty body) GET: /sys/health. Produces: 000 application/json
Returns:

The JSON response of the request.

Return type:

requests.Response

ExamplesΒΆ

import hvac
client = hvac.Client(url='https://127.0.0.1:8200')

status = client.sys.read_health_status(method='GET')
print('Vault initialization status is: %s' % status['initialized'])

Example output:

Vault initialization status is: True