github.com/google/cloudprober@v0.11.3/examples/validators/cloudprober_validator.cfg (about)

     1  # Following probe demonstrates the use of data integrity validator. It probes
     2  # the local HTTP server (configured below) and verifies that the response is
     3  # made up of the repeated pattern "cloudprober".
     4  #
     5  # Since the HTTP server below is configured to use the pattern "cloudprobe",
     6  # we'll see validation failures. Generated monitoring data and logs will look
     7  # like this:
     8  # labels=ptype=http,probe=http_localhost,dst=localhost total=5 success=0 latency=0.000 timeouts=0 resp-code=map:code,200:5 resp-body=map:resp validation_failure=map:validator,data-integrity:5
     9  # E1130 14:33:20.131399   27197 integrity.go:71] bytes are not in the expected format. payload[0-Replica]=[99 108 111 117 100 112 114 111 98 101 99], pattern=[99 108 111 117 100 112 114 111 98 101 114]
    10  probe {
    11      name: "http_localhost"
    12      type: HTTP
    13      targets {
    14          host_names: "localhost"
    15      }
    16      interval_msec: 10000    # Probe every 10s
    17      timeout_msec: 1000
    18  
    19      http_probe {
    20          relative_url: "/data_4096"
    21          port: 3141
    22      }
    23      # This validator will fail as HTTP server is configured to use the pattern
    24      # "cloudprobe".
    25      validator {
    26          name: "data-integrity"
    27          integrity_validator {
    28              pattern_string: "cloudprober"
    29          }
    30      }
    31  }
    32  
    33  server {
    34    type: HTTP
    35    http_server {
    36      port: 3141
    37  
    38      # Return a repeated pattern of "cloudprobe" at the URL /data_4096.
    39      pattern_data_handler {
    40        response_size: 4096
    41        pattern: "cloudprobe"
    42      }
    43    }
    44  }
    45  
    46  # Following probe demonstrates the use of HTTP status code and regex
    47  # validators.
    48  probe {
    49      name: "http_google"
    50      type: HTTP
    51      targets {
    52          host_names: "www.google.com"
    53      }
    54      interval_msec: 10000    # Probe every 10s
    55      timeout_msec: 1000
    56  
    57      # This validator should succeed.
    58      validator {
    59          name: "status_code_2xx_and_HSTS"
    60          http_validator {
    61              success_status_codes: "200-299"
    62              success_header: {
    63                name: "Strict-Transport-Security"
    64                value_regex: "max-age=31536000"
    65              }
    66          }
    67      }
    68      # This validator will fail, notice missing 'o' in our regex.
    69      validator {
    70          name: "gogle_re"
    71          regex: "gogle"
    72      }
    73  }