Skip to content

Commit

Permalink
implement further examples
Browse files Browse the repository at this point in the history
  • Loading branch information
davegarvey committed Dec 23, 2024
1 parent b880113 commit 291b477
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 11 deletions.
3 changes: 2 additions & 1 deletion deployments/healthcheck-blackbox/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
image: prom/prometheus:v3.0.1
volumes:
- ./deployments/healthcheck-blackbox/volumes/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yml
- ./deployments/healthcheck-blackbox/volumes/prometheus/alert.rules:/etc/prometheus/alert.rules
ports:
- "9090:9090"
command:
Expand Down Expand Up @@ -36,4 +37,4 @@ services:
- tyk

Check failure on line 37 in deployments/healthcheck-blackbox/docker-compose.yml

View workflow job for this annotation

GitHub Actions / Yamllint

37:12 [trailing-spaces] trailing spaces

volumes:
grafana-data:
grafana-data:
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 2,
"id": 1,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -1044,7 +1044,10 @@
"Time 9": true,
"Value": true,
"Value #A": false,
"Value #B": true,
"Value #C": true,
"Value #F": true,
"Value #H": true,
"Value #I": true,
"Value #J": false,
"__name__": true,
Expand All @@ -1060,6 +1063,7 @@
"__name__ 9": true,
"fingerprint_sha256": true,
"instance": false,
"issuer": true,
"job": true,
"job 1": true,
"job 10": true,
Expand All @@ -1082,8 +1086,10 @@
"phase 4": true,
"phase 5": true,
"subject": true,
"subjectalternative": true
"subjectalternative": true,
"version": true
},
"includeByName": {},
"indexByName": {
"Time 1": 15,
"Time 10": 43,
Expand Down Expand Up @@ -2056,6 +2062,6 @@
"timezone": "",
"title": "Tyk System Health",
"uid": "tyk-system-health",
"version": 1,
"version": 2,
"weekStart": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ providers:
updateIntervalSeconds: 10
allowUiUpdates: true
options:
path: /etc/grafana/provisioning/dashboards
path: /etc/grafana/provisioning/dashboards
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ datasources:
basicAuth: false
isDefault: true
version: 1
editable: true
editable: true
11 changes: 11 additions & 0 deletions deployments/healthcheck-blackbox/volumes/prometheus/alert.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
groups:
- name: blackbox_alerts
rules:
- alert: BlackboxProbeFailed
expr: probe_success == 0
for: 2m
labels:
severity: critical
annotations:
summary: "Probe failure for {{ $labels.instance }}"
description: "The Blackbox probe for {{ $labels.instance }} has failed for over 2 minutes."
14 changes: 12 additions & 2 deletions deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modules:

Check failure on line 1 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

1:1 [document-start] missing document start "---"
http_2xx_json:
http_200_json_status_pass:
prober: http
timeout: 5s
http:
Expand All @@ -8,4 +8,14 @@ modules:
valid_status_codes: [200]

Check failure on line 8 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

8:28 [brackets] too few spaces inside brackets

Check failure on line 8 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

8:31 [brackets] too few spaces inside brackets
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]

Check failure on line 9 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

9:29 [brackets] too few spaces inside brackets

Check failure on line 9 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

9:51 [brackets] too few spaces inside brackets
fail_if_body_not_matches_regexp:
- '{"status":"pass".*}'
- '{"status":"pass".*}'
tls_config:
insecure_skip_verify: true # Disables certificate validation
http_200:
prober: http
timeout: 5s
http:
method: GET
preferred_ip_protocol: ip4
valid_status_codes: [200]

Check failure on line 20 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

20:28 [brackets] too few spaces inside brackets

Check failure on line 20 in deployments/healthcheck-blackbox/volumes/prometheus/blackbox.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

20:31 [brackets] too few spaces inside brackets
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,51 @@ global:
scrape_interval: 15s
evaluation_interval: 15s

rule_files:
- /etc/prometheus/alert.rules

scrape_configs:
- job_name: 'blackbox'
- job_name: 'gateway_status'
metrics_path: /probe
params:
module: [http_2xx_json]
module: [http_200_json_status_pass]
static_configs:
- targets:
- http://tyk-gateway:8080/hello
- https://tyk-gateway-2:8080/hello
- http://tyk-worker-gateway:8080/hello
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
- job_name: 'mdcb_status'
metrics_path: /probe
params:
module: [http_200_json_status_pass]
static_configs:
- targets:
- http://tyk-mdcb:8181/readiness
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
replacement: blackbox-exporter:9115
- job_name: 'api_status'
metrics_path: /probe
params:
module: [http_200]
static_configs:
- targets:
- http://tyk-gateway:8080/basic-open-api/get
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115

0 comments on commit 291b477

Please sign in to comment.