You're
viewing Apigee X documentation.
View Apigee Edge documentation.
Apigee exposes environment-level default health checks that return the health of the message processor (MP) of that environment. For complex use cases, you can configure a dedicated API proxy as a custom health check endpoint.
Performing a default environment-level health check
You can perform a health check by calling any valid API proxy in an environment by constructing the request as follows:
- Prepend
/healthz/
to the proxy basepath. - Add the header
User-Agent: GoogleHC/*
.
For example, assume that /catalog
is a valid proxy basepath. To do a health check,
call the proxy like this:
curl -H 'User-Agent: GoogleHC/' https://api.foo.com/healthz/catalog Server Ready
Note that this proxy API call will not execute the proxy. The basepath /catalog
is
used only for routing the API to the correct environment. If the MP is healthy, the response
Server Ready
is returned.
Performing a custom environment-level health check
You can define custom health check logic in an API proxy deployed to an environment. For example, you might fail the healthcheck when multiple environments are down. Or, you could fail the healthcheck based on target health or latency.
In this case, you can perform the health check by making a regular API call to that proxy.
For example, assume that you want to check the health of an environment called prod.
Deploy an API proxy to that environment with the basepath /healthcheck-prod
.
To check the health of the prod environment's MP, simply call the proxy. For example:
curl https://api.foo.com/healthcheck-prod
Usage notes
For Apigee hybrid, the health check feature is only available for version 1.4 and higher.
For a custom health check, you don't need to provide the User-Agent
header.
The User-Agent
header is required for the default health check case. If the health check
is consumed by the External HTTP(s)
Google Cloud load balancer,
the load balancer sets the correct User-Agent
header. If your own client consumes the default health check API call, you need to make
sure the correct User-Agent
is set.