I have setup prometheus and blackbox to check liveliness of my services and it is working fine for http targets but is not working for tcp one.
If i try to probe service using curl http://blackbox:9115/probe?target=mongodb:27017&module=tcp
It gives me output as
probe_http_status_code 200
probe_http_content_length 84
probe_http_redirects 0
probe_http_ssl 0
probe_duration_seconds 0.310101
probe_success 1
but not able to get same result using prometheus job. Prometheus UI shows status as DOWN with error "server returned HTTP status 400 Bad Request"
Job configuration
- job_name: 'mongo-service'
scheme: http
metrics_path: /probe
params:
module: [tcp]
static_configs:
- targets: ['mongo-svc:27017']
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
replacement: ${1}
- source_labels: [__param_target]
regex: (.*)
target_label: instance
replacement: ${1}
- source_labels: [ ]
regex: .*
target_label: __address__
replacement: blackbox:9115