This document describes how to manage your uptime checks by using the Google Cloud console, the Google Cloud CLI, the Cloud Monitoring API, and the client libraries.
This feature is supported only for Google Cloud projects.
Before you begin
Complete the following in the Google Cloud project that stores your uptime checks:
-
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
C#
To use the .NET samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
Go
To use the Go samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
Java
To use the Java samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
Node.js
To use the Node.js samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
PHP
To use the PHP samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
Python
To use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
Ruby
To use the Ruby samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
List all uptime checks
Console
-
In the Google Cloud console, go to the Uptime checks page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring.
The following example shows a sample Uptime checks page:
In the toolbar of the Google Cloud console, select your Google Cloud project.
(Optional) To restrict the uptime checks that are listed, add filters.
Each filter is composed of a name and a value. You can set the value to be an exact match for an uptime check name, or a partial match. Matches aren't case sensitive. For example, to list all uptime checks whose name contains
default
, do the following:- Click Filter table and select Display name.
- Enter
default
and then press the return key.
If you have multiple filters, then the filters are automatically joined by a logical
AND
unless you insert anOR
filter. The previous example uses theOR
filter so that an uptime check is listed if its name matchesdefault
orTesting check
.
gcloud
To list your uptime checks and synthetic monitors, run
the gcloud monitoring uptime list-configs
command:
gcloud monitoring uptime list-configs --project=PROJECT_ID
Before you run the previous command, replace the following:
- PROJECT_ID: The identifier of the project.
The returned data includes the following:
- Name and display name.
- Check identifier.
- Monitored resource.
- Period between checks.
You can configure the Google Cloud CLI command to filter and sort the results.
REST
To list your uptime checks and synthetic monitors, call the
projects.uptimeCheckConfigs.list
method. Specify the following parameters:
parent: Required. The project whose uptime checks are listed. This field has the following format:
projects/PROJECT_ID
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
View details of an uptime check
Console
-
In the Google Cloud console, go to the Uptime checks page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring.
- In the toolbar of the Google Cloud console, select your Google Cloud project.
Locate the uptime check that you want to view, and then click its name.
The following screenshot shows the uptime details for an uptime check with the name "My Uptime Check":
The Uptime details page contains the following information:
- The selected time interval. By default, the interval is 1 hour.
- The name of the uptime check. In the sample, the name is My Uptime Check.
- The labels that you added to the uptime check.
The uptime percentage and the average latency. The Percent uptime value is a percentage calculated as
(S/T)*100
, whereS
is the number of successful check responses andT
is the total number of check responses, from all locations. For group checks, the values ofS
andT
are summed across all current group members.For example, over a 25-minute period, an uptime check with a one-minute period running from all regions would get 25 requests from each of 6 locations, for a total of 150 requests. If the dashboard reports an 83.3% uptime, then 125 of 150 requests succeeded.
The Passed checks and Uptime check latency panes graphically display the number of passed checks and latency of each check as a function of time.
The Current status pane displays the status of the most recent checks. A green circle with a check next to a region indicates the last run of the check in that region succeeded; a red circle with an x indicates failure.
The Configuration pane shows the configuration of the uptime check. This data is assigned when the uptime check is created. The Check Id value corresponds to the
CHECK_ID
value in API calls.The Alert Policies pane lists information about associated alerting policies. In the sample dashboard, one alerting policy is configured.
gcloud
To list the details of an uptime check or synthetic monitor,
run the gcloud monitoring uptime describe
command:
gcloud monitoring uptime describe CHECK_ID --project=PROJECT_ID
Before you run the previous command, replace the following:
- PROJECT_ID: The identifier of the project.
- CHECK_ID: The
identifier of the uptime check or synthetic monitor. You can find the
identifier by running the
gcloud monitoring uptime list-configs
command and examining the name field. For more information, see Find the unique identifier of an uptime check.
The data returned for the uptime check includes the following:
- Name and display name.
- Check identifier.
- Monitored resource.
- Period between checks.
REST
To list the details of an uptime check or synthetic monitor, call the
projects.uptimeCheckConfigs.get
method. Specify the following parameter:
name: The full name of the uptime check configuration.
projects/PROJECT_ID/uptimeCheckConfigs/CHECK_ID
In the previous expression:
PROJECT_ID is the project that stores the uptime check.
CHECK_ID is the identifier of the uptime check or synthetic monitor. For more information, see Find the unique identifier of an uptime check.
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Edit an uptime check
You can modify some fields of an uptime check. For example, you might want the check to occur more frequently, or you might want to increase the timeout associated with validation of the response. However, if your uptime check isn't configured with the correct protocol, resource type, or resource, then delete the current uptime check and create a new one.
For information about how to edit an alerting policy that monitors an uptime check, see the following documents:
To edit a public uptime check, you can use the process on any of the following tabs. To edit a private uptime check, use the Console or API tab:
Console
-
In the Google Cloud console, go to the Uptime checks page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring.
- In the toolbar of the Google Cloud console, select your Google Cloud project.
Locate the uptime check that you want to edit, then do one of the following:
- Click More more_vert and select Edit.
- View the uptime check details, and then click Edit.
Change the values of the fields as needed. You can't modify all fields. If the custom header values of a check are hidden, you cannot make them viewable.
To verify if the check works, click Test. If the test fails, see Failed checks for possible causes.
Click Save.
gcloud
To modify an uptime check or synthetic monitor,
run the gcloud monitoring uptime update
command:
gcloud monitoring uptime update CHECK_ID OPTIONAL_FLAGS --project=PROJECT_ID
Before you run the previous command, replace the following:
- PROJECT_ID: The identifier of the project.
- CHECK_ID: The
identifier of the uptime check or synthetic monitor. You can find the
identifier by running the
gcloud monitoring uptime list-configs
command and examining the name field. For more information, see Find the unique identifier of an uptime check.
You must also define which fields that you want to modify.
For example, to set the period of an uptime check to be 10 minutes, run the following command:
gcloud monitoring uptime update CHECK_ID --period=10
REST
Call the projects.uptimeCheckConfigs.patch
method. Set the parameters to the method as follows:
uptimeCheckConfig.name: Required. This is part of the REST URL. It is the resource name of the uptime check to edit:
projects/PROJECT_ID/uptimeCheckConfigs/CHECK_ID
In the previous expression:
PROJECT_ID is the project that stores the uptime check.
CHECK_ID is the identifier of the uptime check or synthetic monitor. For more information, see Find the unique identifier of an uptime check.
updateMask: Optional. This is a query parameter:
?updateMask=[FIELD_LIST]
.[FIELD_LIST]
is a comma-separated list of fields in theUptimeCheckConfig
object that should be changed. For example:"resource.type,httpCheck.path"
The request body must contain an
UptimeCheckConfig
with the new field values.
If updateMask
is set, then only the fields listed in updateMask
replace
the corresponding fields in the existing configuration. If a field has
subfields, and the field is listed in the field mask but none of its subfields
are, then all subfields of that field replace the corresponding fields.
If updateMask
isn't set, then the configuration in the request body
replaces the entire existing configuration.
The patch
method returns the
UptimeCheckConfig
object for the altered configuration.
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
There can be a delay of up to 5 minutes before you see the new uptime check results. During that time, the results of the former uptime check are displayed in the dashboards and used in alerting policies.
Delete an uptime check
We recommend that you delete an uptime check when you turn down the service or resource it monitors.
To delete an uptime check, do the following:
Console
-
In the Google Cloud console, go to the Uptime checks page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring.
- In the toolbar of the Google Cloud console, select your Google Cloud project.
Locate the uptime check that you want to edit, then do one of the following:
- Click More more_vert and select Delete.
- View the uptime check details, and then click Delete
gcloud
To delete an uptime check or synthetic monitor,
run the gcloud monitoring uptime delete
command:
gcloud monitoring uptime delete CHECK_ID --project=PROJECT_ID
Before you run the previous command, replace the following:
- PROJECT_ID: The identifier of the project.
- CHECK_ID: The
identifier of the uptime check or synthetic monitor. You can find the
identifier by running the
gcloud monitoring uptime list-configs
command and examining the name field. For more information, see Find the unique identifier of an uptime check.
REST
To delete an uptime check or a synthetic monitor, call the
projects.uptimeCheckConfigs.delete
method. Fill out the parameter as follows:
name: Required. This is the resource name of the uptime check configuration to delete:
projects/PROJECT_ID/uptimeCheckConfigs/CHECK_ID
In the previous expression:
PROJECT_ID is the project that stores the uptime check.
CHECK_ID is the identifier of the uptime check or synthetic monitor. For more information, see Find the unique identifier of an uptime check.
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Monitor an uptime check
We recommend that you create an alerting policy to notify you when your uptime check fails. For more information, see Create alerting policies for uptime checks.
Find the unique identifier of an uptime check
When your uptime check is created, Monitoring assigns it an identifier, referred to as the uptime-check ID. This identifier is embedded in the resource name for the uptime check:
projects/PROJECT_ID/uptimeCheckConfigs/CHECK_ID
The PROJECT_ID is the identifier of the project that stores the uptime check.
The uptime-check ID is included in the response of Cloud Monitoring API methods that create or list uptime checks. You can also find the uptime-check ID in the Configuration pane of the Uptime details page in the Google Cloud console. For information about how to view the Uptime details page, see the View details of an uptime check section of this document.
What's next
- List uptime-check server IP addresses
- Create alerting policies for uptime checks
- Chart uptime-check metrics