Skip to content

googleMonitoringUptimeCheckConfig

This message configures which resources and services to monitor for availability.

To get more information about UptimeCheckConfig, see:

\~> Warning: All arguments including httpCheckAuthInfoPassword will be stored in the raw state as plain-text. Read more about sensitive data in state.

Example Usage - Uptime Check Config Http

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.monitoringUptimeCheckConfig.MonitoringUptimeCheckConfig(
  this,
  "http",
  {
    checker_type: "STATIC_IP_CHECKERS",
    content_matchers: [
      {
        content: '"example"',
        json_path_matcher: [
          {
            json_matcher: "EXACT_MATCH",
            json_path: "$.path",
          },
        ],
        matcher: "MATCHES_JSON_PATH",
      },
    ],
    display_name: "http-uptime-check",
    http_check: [
      {
        body: "Zm9vJTI1M0RiYXI=",
        content_type: "URL_ENCODED",
        path: "some-path",
        port: "8010",
        request_method: "POST",
      },
    ],
    monitored_resource: [
      {
        labels: [
          {
            host: "192.168.1.1",
            project_id: "my-project-name",
          },
        ],
        type: "uptime_url",
      },
    ],
    timeout: "60s",
  }
);

Example Usage - Uptime Check Config Status Code

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.monitoringUptimeCheckConfig.MonitoringUptimeCheckConfig(
  this,
  "status_code",
  {
    checker_type: "STATIC_IP_CHECKERS",
    content_matchers: [
      {
        content: '"example"',
        json_path_matcher: [
          {
            json_matcher: "EXACT_MATCH",
            json_path: "$.path",
          },
        ],
        matcher: "MATCHES_JSON_PATH",
      },
    ],
    display_name: "http-uptime-check",
    http_check: [
      {
        accepted_response_status_codes: [
          {
            status_class: "STATUS_CLASS_2XX",
          },
          {
            status_value: 301,
          },
          {
            status_value: 302,
          },
        ],
        body: "Zm9vJTI1M0RiYXI=",
        content_type: "URL_ENCODED",
        path: "some-path",
        port: "8010",
        request_method: "POST",
      },
    ],
    monitored_resource: [
      {
        labels: [
          {
            host: "192.168.1.1",
            project_id: "my-project-name",
          },
        ],
        type: "uptime_url",
      },
    ],
    timeout: "60s",
  }
);

Example Usage - Uptime Check Config Https

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.monitoringUptimeCheckConfig.MonitoringUptimeCheckConfig(
  this,
  "https",
  {
    content_matchers: [
      {
        content: "example",
        json_path_matcher: [
          {
            json_matcher: "REGEX_MATCH",
            json_path: "$.path",
          },
        ],
        matcher: "MATCHES_JSON_PATH",
      },
    ],
    display_name: "https-uptime-check",
    http_check: [
      {
        path: "/some-path",
        port: "443",
        use_ssl: true,
        validate_ssl: true,
      },
    ],
    monitored_resource: [
      {
        labels: [
          {
            host: "192.168.1.1",
            project_id: "my-project-name",
          },
        ],
        type: "uptime_url",
      },
    ],
    timeout: "60s",
  }
);

Example Usage - Uptime Check Tcp

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleMonitoringGroupCheck = new google.monitoringGroup.MonitoringGroup(
  this,
  "check",
  {
    display_name: "uptime-check-group",
    filter: 'resource.metadata.name=has_substring("foo")',
  }
);
new google.monitoringUptimeCheckConfig.MonitoringUptimeCheckConfig(
  this,
  "tcp_group",
  {
    display_name: "tcp-uptime-check",
    resource_group: [
      {
        group_id: googleMonitoringGroupCheck.name,
        resource_type: "INSTANCE",
      },
    ],
    tcp_check: [
      {
        port: 888,
      },
    ],
    timeout: "60s",
  }
);

Argument Reference

The following arguments are supported:

  • displayName - (Required) A human-friendly name for the uptime check configuration. The display name should be unique within a Stackdriver Workspace in order to make it easier to identify; however, uniqueness is not enforced.

  • timeout - (Required) The maximum amount of time to wait for the request to complete (must be between 1 and 60 seconds). Accepted formats https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration


  • period - (Optional) How often, in seconds, the uptime check is performed. Currently, the only supported values are 60s (1 minute), 300s (5 minutes), 600s (10 minutes), and 900s (15 minutes). Optional, defaults to 300s.

  • contentMatchers - (Optional) The expected content on the page the check is run against. Currently, only the first entry in the list is supported, and other entries will be ignored. The server will look for an exact match of the string in the page response's content. This field is optional and should only be specified if a content match is required. Structure is documented below.

  • selectedRegions - (Optional) The list of regions from which the check will be run. Some regions contain one location, and others contain more than one. If this field is specified, enough regions to include a minimum of 3 locations must be provided, or an error message is returned. Not specifying this field will result in uptime checks running from all regions.

  • checkerType - (Optional) The checker type to use for the check. If the monitored resource type is servicedirectory_service, checkerType must be set to VPC_CHECKERS. Possible values are staticIpCheckers and vpcCheckers.

  • httpCheck - (Optional) Contains information needed to make an HTTP or HTTPS check. Structure is documented below.

  • tcpCheck - (Optional) Contains information needed to make a TCP check. Structure is documented below.

  • resourceGroup - (Optional) The group resource associated with the configuration. Structure is documented below.

  • monitoredResource - (Optional) The monitored resource (https://cloud.google.com/monitoring/api/resources) associated with the configuration. The following monitored resource types are supported for uptime checks: uptime_url gce_instance gae_app aws_ec2_instance aws_elb_load_balancer k8s_service servicedirectory_service Structure is documented below.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The contentMatchers block supports:

  • content - (Required) String or regex content to match (max 1024 bytes)

  • matcher - (Optional) The type of content matcher that will be applied to the server output, compared to the content string when the check is run. Default value is containsString. Possible values are containsString, notContainsString, matchesRegex, notMatchesRegex, matchesJsonPath, and notMatchesJsonPath.

  • jsonPathMatcher - (Optional) Information needed to perform a JSONPath content match. Used for contentMatcherOption::matchesJsonPath and contentMatcherOption::notMatchesJsonPath. Structure is documented below.

The jsonPathMatcher block supports:

  • jsonPath - (Required) JSONPath within the response output pointing to the expected contentMatcher::content to match against.

  • jsonMatcher - (Optional) Options to perform JSONPath content matching. Default value is exactMatch. Possible values are exactMatch and regexMatch.

The httpCheck block supports:

  • requestMethod - (Optional) The HTTP request method to use for the check. If set to METHOD_UNSPECIFIED then requestMethod defaults to GET. Default value is get. Possible values are methodUnspecified, get, and post.

  • contentType - (Optional) The content type to use for the check. Possible values are typeUnspecified and urlEncoded.

  • authInfo - (Optional) The authentication information. Optional when creating an HTTP check; defaults to empty. Structure is documented below.

  • port - (Optional) The port to the page to run the check against. Will be combined with host (specified within the MonitoredResource) and path to construct the full URL. Optional (defaults to 80 without SSL, or 443 with SSL).

  • headers - (Optional) The list of headers to send as part of the uptime check request. If two headers have the same key and different values, they should be entered as a single header, with the value being a comma-separated list of all the desired values as described at https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). Entering two separate headers with the same key in a Create call will cause the first to be overwritten by the second. The maximum number of headers allowed is 100.

  • path - (Optional) The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. If the provided path does not begin with "/", a "/" will be prepended automatically. Optional (defaults to "/").

  • useSsl - (Optional) If true, use HTTPS instead of HTTP to run the check.

  • validateSsl - (Optional) Boolean specifying whether to include SSL certificate validation as a part of the Uptime check. Only applies to checks where monitoredResource is set to uptime_url. If useSsl is false, setting validateSsl to true has no effect.

  • maskHeaders - (Optional) Boolean specifying whether to encrypt the header information. Encryption should be specified for any headers related to authentication that you do not wish to be seen when retrieving the configuration. The server will be responsible for encrypting the headers. On Get/List calls, if mask_headers is set to True then the headers will be obscured with ******.

  • body - (Optional) The request body associated with the HTTP POST request. If contentType is URL_ENCODED, the body passed in must be URL-encoded. Users can provide a Content-Length header via the headers field or the API will do so. If the requestMethod is GET and body is not empty, the API will return an error. The maximum byte size is 1 megabyte. Note - As with all bytes fields JSON representations are base64 encoded. e.g. "foo=bar" in URL-encoded form is "foo%3Dbar" and in base64 encoding is "Zm9vJTI1M0RiYXI=".

  • acceptedResponseStatusCodes - (Optional) If present, the check will only pass if the HTTP response status code is in this set of status codes. If empty, the HTTP status code will only pass if the HTTP status code is 200-299. Structure is documented below.

The authInfo block supports:

  • password - (Required) The password to authenticate. Note: This property is sensitive and will not be displayed in the plan.

  • username - (Required) The username to authenticate.

The acceptedResponseStatusCodes block supports:

  • statusValue - (Optional) A status code to accept.

  • statusClass - (Optional) A class of status codes to accept. Possible values are statusClass1Xx, statusClass2Xx, statusClass3Xx, statusClass4Xx, statusClass5Xx, and statusClassAny.

The tcpCheck block supports:

  • port - (Required) The port to the page to run the check against. Will be combined with host (specified within the MonitoredResource) to construct the full URL.

The resourceGroup block supports:

  • resourceType - (Optional) The resource type of the group members. Possible values are resourceTypeUnspecified, instance, and awsElbLoadBalancer.

  • groupId - (Optional) The group of resources being monitored. Should be the name of a group

The monitoredResource block supports:

  • type - (Required) The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor (https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.monitoredResourceDescriptors#MonitoredResourceDescriptor) object. For example, the type of a Compute Engine VM instance is gce_instance. For a list of types, see Monitoring resource types (https://cloud.google.com/monitoring/api/resources) and Logging resource types (https://cloud.google.com/logging/docs/api/v2/resource-list).

  • labels - (Required) Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels "project_id", "instance_id", and "zone".

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format {{name}}

  • name - A unique resource name for this UptimeCheckConfig. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].

  • uptimeCheckId - The id of the uptime check

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

UptimeCheckConfig can be imported using any of these accepted formats:

$ terraform import google_monitoring_uptime_check_config.default {{name}}

User Project Overrides

This resource supports User Project Overrides.