Health
Read Status
- Health.read_health_status(standby_ok=None, active_code=None, standby_code=None, dr_secondary_code=None, performance_standby_code=None, sealed_code=None, uninit_code=None, 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