From 159402921dc3c1ec3e519fefaf8d08b3b04cbe86 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Mon, 7 Apr 2025 14:23:14 +0530 Subject: [PATCH] Use alias for blackbox targets in dashboard --- .../data/config/monitoring/blackbox.yml | 2 +- .../prometheus-blackbox-exporter.json | 2 +- .../provisioning/alerting/policies.yml | 1 + .../monitoring/prometheus/prometheus.yml | 20 +++++++--- .../stacks/monitoring/monitoring-testnet.md | 37 ++++++++++++++----- .../stacks/monitoring/monitoring-watchers.md | 9 +++-- 6 files changed, 50 insertions(+), 21 deletions(-) diff --git a/stack_orchestrator/data/config/monitoring/blackbox.yml b/stack_orchestrator/data/config/monitoring/blackbox.yml index d24e7574..30cb9ffa 100644 --- a/stack_orchestrator/data/config/monitoring/blackbox.yml +++ b/stack_orchestrator/data/config/monitoring/blackbox.yml @@ -1,7 +1,7 @@ modules: http_2xx: prober: http - timeout: 5s + timeout: 15s http: valid_status_codes: [] #default to 2xx method: GET diff --git a/stack_orchestrator/data/config/monitoring/grafana/dashboards/prometheus-blackbox-exporter.json b/stack_orchestrator/data/config/monitoring/grafana/dashboards/prometheus-blackbox-exporter.json index 638c4d5b..6c018154 100644 --- a/stack_orchestrator/data/config/monitoring/grafana/dashboards/prometheus-blackbox-exporter.json +++ b/stack_orchestrator/data/config/monitoring/grafana/dashboards/prometheus-blackbox-exporter.json @@ -136,7 +136,7 @@ "refId": "A" } ], - "title": "$target status", + "title": "$target", "type": "row" }, { diff --git a/stack_orchestrator/data/config/monitoring/grafana/provisioning/alerting/policies.yml b/stack_orchestrator/data/config/monitoring/grafana/provisioning/alerting/policies.yml index b1beb31d..498b9cf5 100644 --- a/stack_orchestrator/data/config/monitoring/grafana/provisioning/alerting/policies.yml +++ b/stack_orchestrator/data/config/monitoring/grafana/provisioning/alerting/policies.yml @@ -8,6 +8,7 @@ policies: group_by: - grafana_folder - alertname + - instance routes: - receiver: SlackNotifier object_matchers: diff --git a/stack_orchestrator/data/config/monitoring/prometheus/prometheus.yml b/stack_orchestrator/data/config/monitoring/prometheus/prometheus.yml index dea7052d..42e56795 100644 --- a/stack_orchestrator/data/config/monitoring/prometheus/prometheus.yml +++ b/stack_orchestrator/data/config/monitoring/prometheus/prometheus.yml @@ -28,17 +28,25 @@ scrape_configs: - targets: # - https://github.com relabel_configs: + # Forward the original target URL as the 'target' parameter. - source_labels: [__address__] regex: (.*)(:80)? target_label: __param_target - - source_labels: [__param_target] - regex: (.*) + # Use the custom alias if defined for the 'instance' label. + - source_labels: [alias] target_label: instance - replacement: ${1} - - source_labels: [] - regex: .* - target_label: __address__ + action: replace + # If no alias is set, fall back to the target URL. + - source_labels: [instance] + regex: ^$ + target_label: instance + replacement: ${__param_target} + # Finally, tell Prometheus to scrape the blackbox_exporter. + - target_label: __address__ replacement: blackbox:9115 + # Drop the original alias label as it's now redundant with instance + - action: labeldrop + regex: ^alias$ - job_name: chain_heads scrape_interval: 10s diff --git a/stack_orchestrator/data/stacks/monitoring/monitoring-testnet.md b/stack_orchestrator/data/stacks/monitoring/monitoring-testnet.md index 64399995..7f109307 100644 --- a/stack_orchestrator/data/stacks/monitoring/monitoring-testnet.md +++ b/stack_orchestrator/data/stacks/monitoring/monitoring-testnet.md @@ -44,16 +44,33 @@ laconic-so --stack monitoring deploy create --spec-file monitoring-testnet-spec. - job_name: 'blackbox' ... static_configs: - - targets: - - https://wallet.laconic.com - - https://laconicd-sapo.laconic.com - - https://console-sapo.laconic.com - - https://fixturenet-eth.laconic.com - - https://deploy.laconic.com - - https://deploy-backend.laconic.com/staging/version - - https://container-registry.apps.vaasl.io - - https://webapp-deployer-api.apps.vaasl.io - - https://webapp-deployer-ui.apps.vaasl.io + - targets: ["https://wallet.laconic.com"] + labels: + alias: "Wallet App" + - targets: ["https://laconicd-sapo.laconic.com"] + labels: + alias: "Node (laconicd)" + - targets: ["https://console-sapo.laconic.com"] + labels: + alias: "Console App" + - targets: ["https://fixturenet-eth.laconic.com"] + labels: + alias: "Fixturenet ETH" + - targets: ["https://deploy.laconic.com"] + labels: + alias: "Deploy App" + - targets: ["https://deploy-backend.laconic.com/staging/version"] + labels: + alias: "Deploy Backend" + - targets: ["https://container-registry.apps.vaasl.io"] + labels: + alias: "Container Registry" + - targets: ["https://webapp-deployer-api.apps.vaasl.io"] + labels: + alias: "Webapp Deployer API" + - targets: ["https://webapp-deployer-ui.apps.vaasl.io"] + labels: + alias: "Webapp Deployer UI" ... - job_name: laconicd ... diff --git a/stack_orchestrator/data/stacks/monitoring/monitoring-watchers.md b/stack_orchestrator/data/stacks/monitoring/monitoring-watchers.md index 158da503..bd325a96 100644 --- a/stack_orchestrator/data/stacks/monitoring/monitoring-watchers.md +++ b/stack_orchestrator/data/stacks/monitoring/monitoring-watchers.md @@ -44,9 +44,12 @@ Add the following scrape configs to prometheus config file (`monitoring-watchers - job_name: 'blackbox' ... static_configs: - - targets: - - - - + - targets: [""] + labels: + alias: "Azimuth Watcher" + - targets: [""] + labels: + alias: "Node (laconicd)" ... - job_name: laconicd static_configs: