Hi Brian,

Yes, I want to probe  10.129.100.213, 10.129.100.214, 10.129.100.215, so it 
is not blackbox address.
And I don't want to user a network service, because my scrap must be 
handled by a blackbox exporter on a specific node.
This is why, it try to find a way to set dynamicly the last step :
- target_label: __address__
  replacement: my blackbox pod ip on a specific node

Is there a way to mix the 2 discovery services (kubernetes and static ) ?

Thank you in advance.
On Sunday, December 11, 2022 at 7:20:51 PM UTC+1 Brian Candler wrote:

> 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/d61aecef-c26f-4e65-aa42-baf67939348dn%40googlegroups.com.

Reply via email to