Hit blackbox_exporter with curl, and add &debug=true to see what's happening.
*curl -g 'http://prometheus-blackbox-exporter:9115/probe?module=smtp_starttls&target=127.0.0.1&debug=true'* My guess is that the target mailserver doesn't have a valid TLS certificate. This is almost certainly true if you are connecting to it as "127.0.0.1" instead of using its real hostname. On Thursday, 19 May 2022 at 15:40:06 UTC+1 [email protected] wrote: > Thank you Brian. > > If I only want to test if SMTP connection can be setup or not, like Nagios > check_smtp, can I use smtp_starttls module? I got failed status of > smtp_starttls, and from the log of blackbox exporter, I even cannot see the > output of "smtp_starttls" module. I curled, the response returned all the > HTLM info without useful information. > > On Wednesday, May 18, 2022 at 11:00:50 PM UTC+8 Brian Candler wrote: > >> On Wednesday, 18 May 2022 at 13:41:37 UTC+1 [email protected] wrote: >> >>> static_configs: >>> - targets: >>> - 127.0.0.1 >>> relabel_configs: >>> - source_labels: [__address__] >>> target_label: __param_target >>> - source_labels: [__param_target] >>> target_label: instance >>> - target_label: __address__ >>> replacement: prometheus-blackbox-exporter:9115 >>> >>> >> This is saying that you are talking to blackbox_exporter running on host >> "prometheus-blackbox-exporter", but blackbox_exporter will be testing the >> SMTP server on 127.0.0.1, i.e. the mail server that you are testing is >> running on the same server as blackbox_exporter. >> >> If that's what you want, then it looks OK to me. If you test it and it >> doesn't do what you expect, then you can start debugging it. >> >> > - which module can be used to implement Nagios check_ldap_startTLS? >> >> LDAP is a binary protocol. You won't be able to test this using >> blackbox_exporter, except for checking that a connection is accepted on >> port 389. >> >> You could look for a specific LDAP exporter. Or you could write a script >> which performs the check (e.g. by shelling out to "ldapsearch") and returns >> prometheus metrics. You can then run this script from cron and get it to >> write a file to be picked up by node_exporter's textfile collector; or you >> can run it under exporter_exporter; or you can write your own exporter >> <https://prometheus.io/docs/instrumenting/writing_exporters/> (basically >> just a small webserver which listens for scrapes). >> >> Alternatively, if you already have a Nagios check module which does what >> you want, you can run it under nrpe_exporter. >> >> > - Is there a way to know what does smtp_startTLS module exactly do? >> >> It negotiates a TLS connection on the TCP stream. If it's successful, >> all the subsequent communication on this stream is TLS-encrypted. I'm not >> sure what else to say about it! >> > -- 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/42bddc4f-ada4-4def-b211-83b39d81ac56n%40googlegroups.com.

