On Sunday, 11 December 2022 at 17:50:38 UTC SebV wrote: > what am I missing ? >
Nothing is setting the labels __meta_kubernetes_pod_ip or __meta_kubernetes_pod_container_port_number. Therefore, the target __address__ you are constructing is simply ":" - which is invalid, as the error says. This in turn is because the service discovery mechanism you've chosen to use is static_configs. This only sets the __address__ label to the values you give, and nothing else. I think you first need to be clear about which address to send the scrape to (which is the final value of __address__ after relabeling, and will be the address:port where blackbox_exporter is listening), and the address you want blackbox_exporter to probe (which is __param_target). What are 10.129.100.213, 10.129.100.214, 10.129.100.215? Are these three instances of blackbox_exporter, or three targets that you want blackbox_exporter to probe? If you want the to use the labels __meta_kubernetes_pod_ip and __meta_kubernetes_pod_container_port_number then you need to use kubernetes_sd_configs <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config> instead. You'd need to configure this block to talk to the Kubernetes API, and it will return a list of targets (e.g. pods or services, whatever you ask for) with those meta labels, from which you can construct your scraping targets. This might make sense if what you're trying to do is to scrape or probe each pod. It could also be used to find your blackbox_exporter pod but it would be inefficient, unless you can apply some sort of label to your blackbox_exporter service and tell the API you're only interested in services with that label. It sounds to me, though, that what you want is simply: - target_label: __address__ replacement: my_service_ip:9115 <http://127.0.0.1:9115/> # The blackbox exporter's real hostname:port. That is, create blackbox_exporter in kubernetes with an attached service, and give the service either a static port or a static IP address. Then if the pod is recreated on a different IP, the service IP:port is unchanged. (And: if you have multiple blackbox_exporter pods, the load should be distributed between them) https://kubernetes.io/blog/2022/05/23/service-ip-dynamic-and-static-allocation/ -- 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/79d8d6e4-d487-4a50-8677-f5ce9c4b09d7n%40googlegroups.com.

