Greetings, 

I'm setting up an http probe on an AWS EKS cluster, and I'm curious if 
there's a better way to set the __address__ label rather than hardcoding a 
POD IP to the prometheus yaml. As per the instructions found here 
<https://github.com/prometheus/blackbox_exporter>, I started here as a 
baseline and that worked fine
- job_name: "blackbox"
    honor_labels: true
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - source_labels: [__meta_kubernetes_pod_container_name]
        regex: 'blackbox-exporter'
        action: keep

- job_name: 'blackbox-healthcheck'
    metrics_path: /probe
    params:
      module: 
      - http_2xx
    static_configs:
      - targets:
        - google.com
        - facebook.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.0.2.43:9115  # The blackbox exporter's real 
hostname:port.


I attempted to do a dynamic replacement of the IP to point to the pod_ip 
that hosts the pod, but that didn't work and it was just probing itself :(. 
Here's what that attempt looked like. Is there a cleaner way to pass in the 
pod IP from one job to another? Should I be taking a different approach? 
Any recommendations would be greatly appreciated 

- job_name: "blackbox"
    honor_labels: true
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - source_labels: [__meta_kubernetes_pod_container_name]
        regex: 'blackbox-exporter'
        action: keep
 
- job_name: 'blackbox-healthcheck'
    metrics_path: /probe
    params:
      module: 
      - http_2xx
    kubernetes_sd_configs:
      - role: pod
    static_configs:
      - targets:
        - google.com
        - facebook.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - source_labels: [__meta_kubernetes_pod_container_name]
        regex: 'blackbox-exporter'
        action: keep
      - action: replace
        source_labels: [__meta_kubernetes_pod_ip]
        target_label: __address__
        replacement: ${1}:9115








-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/f927bdfd-d453-4e35-bb22-3e62bcbd0a83%40googlegroups.com.

Reply via email to