Hi. I’m looking to probe a simple Iperf3 server with Blackbox Exporter, TCP probe. But as it’s currently configured, I can’t get it to return a query value of “1”, it returns “0” instead.
This is my blackbox.yml
:
modules:
http_2xx:
prober: http
http:
method: GET
http_post_2xx:
prober: http
http:
method: POST
tcp_connect:
prober: tcp
timeout: 5s
pop3s_banner:
prober: tcp
tcp:
query_response:
- expect: "^+OK"
tls: true
tls_config:
insecure_skip_verify: false
ssh_banner:
prober: tcp
tcp:
query_response:
- expect: "^SSH-2.0-"
icmp:
prober: icmp
I’m using the module tcp_connect
, and I imagine I need to add something to this module to get it to return a value of “1”, but I’m not sure how.
Can anyone help with a working module config for a simple TCP probe?
Thanks.
For some very strange reason, I can’t edit my post. So here is some more info:
My Prometheus.yml
: (Blackbox job under scrape configs)
- job_name: 'blackbox-tcp'
scrape_interval: 60s
metrics_path: /probe
params:
module: [tcp_connect] # Look for TCP response
static_configs:
- targets:
- http://10.10.2.2:5201 # Iperf3 server
- http://10.10.2.4:9201 # Portainer agent
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.10.2.4:9095 # The blackbox exporter's real hostname:port.
All my HTTP endpoints are working fine and all endpoints are up. In addition, I can connect to the Iperf3 server on 10.10.2.2:5201
with Telnet to confirm it’s running.
But Blackbox exporter still returns a value of “0” in the query. Any ideas?
Of course the TCP targets should not be prefixed with http://
. When I made this change, everything worked.
- job_name: 'blackbox-tcp'
scrape_interval: 60s
metrics_path: /probe
params:
module: [tcp_connect] # Look for TCP response
static_configs:
- targets:
- 10.10.2.2:5201 # Iperf3 server
- 10.10.2.4:9201 # Portainer agent
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.10.2.4:9095 # The blackbox exporter's real hostname:port.
Hi,
I am facing similar issue, I tried removing http but probe is still returning 0
here is the module definition that I am using:
http_eid_errorcode:
prober: http
timeout: 5s
http:
preferred_ip_protocol: "ip4"
valid_http_versions: ["HTTP/1.1", "HTTP/2"]
ip_protocol_fallback: true
fail_if_not_ssl: true
fail_if_body_not_matches_regexp:
- "[\\S\\s]*(</transid>)[\\S\\s]*?(<errorcode>)(0|62)[\\S\\s]*"
- "[\\S\\s]*(</element>)[\\S\\s]*?(<errorcode>)(0|62)[\\S\\s]*"
tcp:
ip_protocol_fallback: true
dns:
ip_protocol_fallback: true
query_name: "eid_errorcode"
icmp:
ip_protocol_fallback: true