Monitor Composite Health
This page shows how to monitor the health of published services that use Composite Health. You can do the following:
- Monitor current health states: Check the real-time health state of a published service or an individual backend service.
- View logs for health state transitions: Use Cloud Logging to view log entries that record changes in health states for monitored resources.
You monitor published services through their associated composite health checks, and you monitor individual backend services through their associated health sources. Service consumers can view logs for Private Service Connect NEGs that connect to published services that use Composite Health.
Composite Health uses the following states to represent the health of published services and backend services.
HEALTHY
UNHEALTHY
UNKNOWN
Before you begin
You must configure Composite Health before you can use it to monitor the health of published services.
Required roles
To get the permissions that you need to monitor Composite Health, ask your administrator to grant you the following IAM roles on your project:
- Check the health state of health sources or composite health checks: Compute Viewer
(
roles/compute.viewer) - View Composite Health logging: Logs Viewer
(
roles/logging.viewer)
For more information about granting roles, see Manage access to projects, folders, and organizations .
You might also be able to get the required permissions through custom roles or other predefined roles .
Check the health state of a single health source
This section shows how to retrieve the following information about a health source:
- The overall health state
- The number of healthy endpoints compared to the total number of endpoints in each instance group or NEG that is associated with the health source's backend service
If the health source is associated with the backend service of an
internal passthrough Network Load Balancer that has multiple forwarding rules, the health state is
calculated independently for each of the load balancer's forwarding rules. In
this case, the health state details include a forwardingRule
field to
identify the forwarding rule that is being evaluated.
Console
-
In the Google Cloud console, go to the Composite Healthpage:
-
Click Health sources.
-
Click the name of the health source that you want to view.
-
To view more details, in the Health statussection, click the expander arrow next to the backend service that you want to view. If forwarding rules are displayed, click the expander arrow next to a forwarding rule to view the status of the associated backends.
gcloud
Use the gcloud compute health-sources get-health
command
.
gcloud compute health-sources get-health HEALTH_SOURCE \ --region= REGION
Replace the following:
-
HEALTH_SOURCE: the name of the health source -
REGION: the region of the health source
API
Send a request to the regionHealthSources.getHealth
method
.
HTTP method and URL:
GET https://compute.googleapis.com/compute/v1/projects/ PROJECT_ID /regions/ REGION /healthSources/ HEALTH_SOURCE /getHealth
Replace the following:
-
PROJECT_ID: the ID of your project -
REGION: the region of the health source -
HEALTH_SOURCE: the name of the health source
Check the health state of a composite health check
This section shows how to check the health state of a composite health check, including the following information:
- The overall health state of the monitored regional published service
-
The individual health state of each health source that is associated with the composite health check
Console
-
In the Google Cloud console, go to the Composite Healthpage:
-
Click the name of the composite health check that you want to view.
-
To view more details, in the Health statussection, click the expander arrow next to the composite health check that you want to view.
gcloud
Use the gcloud compute composite-health-checks get-health
command
.
gcloud compute composite-health-checks get-health COMPOSITE_CHECK_NAME \ --region= REGION
Replace the following:
-
COMPOSITE_CHECK_NAME: the name of the composite health check -
REGION: the region of the composite health check
API
Send a request to the regionCompositeHealthChecks.getHealth
method
.
HTTP method and URL:
GET https://compute.googleapis.com/compute/v1/projects/ PROJECT_ID /regions/ REGION /compositeHealthChecks/ COMPOSITE_CHECK_NAME /getHealth
Replace the following:
-
PROJECT_ID: the ID of your project -
REGION: the region of the composite health check -
COMPOSITE_CHECK_NAME: the name of the composite health check
View Composite Health logs
You can use Cloud Logging
to track changes in health states.
These logs are generated each time a health state changes
(for example, from HEALTHY
to UNHEALTHY
).
Logging is enabled by default for health sources, composite health checks, and Private Service Connect NEGs that connect to published services that are configured to use Composite Health.
For more information about querying and analyzing log data, see Analyze logs using Logs Explorer and Observability Analytics .
Console
To view Composite Health logs, do the following.
-
In the Google Cloud console, go to the Logs Explorerpage.
-
If you don't see the query editor field in the Querypane, click the Show querytoggle.
-
In the query editor field:
-
To view logs for producer resources (health sources and composite health checks), enter the following query:
logName="projects/ PROJECT_ID /logs/compute.googleapis.com%2Fcompositehealth"
-
To view logs for consumer resources (Private Service Connect NEGs connected to published services that use composite health checks), enter the following query:
logName="projects/ PROJECT_ID /logs/compute.googleapis.com%2Fservicehealthchecks"
Replace
PROJECT_IDwith your project ID. -
-
Click Run query.

