Skip to content

Instantly share code, notes, and snippets.

@abiydv
Last active September 28, 2021 15:01
Show Gist options
  • Save abiydv/ea2257a2e88a2ae1219750597b0af6fc to your computer and use it in GitHub Desktop.
Save abiydv/ea2257a2e88a2ae1219750597b0af6fc to your computer and use it in GitHub Desktop.
Example Blackbox config for POST call monitoring
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: []
method: GET
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
post_one_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: []
method: POST
headers:
content-type: application/json
body: '{"data": "one"}'
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
fail_if_body_not_matches_regexp: [".*one.*"]
post_two_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: []
method: POST
headers:
content-type: application/json
body: '{"data": "two"}'
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
fail_if_body_not_matches_regexp: [".*two.*"]
global:
scrape_interval: 1m
scrape_configs:
- job_name: blackbox
metrics_path: /metrics
static_configs:
- targets:
- host.docker.internal:9115
- job_name: blackbox-http
metrics_path: /probe
scrape_interval: 5m
params:
module: [http_2xx]
static_configs:
- targets:
- https://httpbin.org
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: host.docker.internal:9115
- job_name: blackbox-http-post-one
metrics_path: /probe
scrape_interval: 5m
params:
module: [post_one_2xx]
static_configs:
- targets:
- https://httpbin.org/post
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: host.docker.internal:9115
- job_name: blackbox-http-post-two
metrics_path: /probe
scrape_interval: 5m
params:
module: [post_two_2xx]
static_configs:
- targets:
- https://httpbin.org/post
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: host.docker.internal:9115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment