And if you try it with Google's mail server?
*curl -g 
'localhost:9115/probe?module=smtp_starttls&target=aspmx.l.google.com:25&debug=true'*

On Monday, 4 July 2022 at 12:50:47 UTC+1 [email protected] wrote:

> Still received the same error msg:
>
> curl -g '
> http://0.0.0.0:9115/probe?module=smtp_starttls&target=1.1.1.1:25&debug=true
> '
> Logs for the probe:
> ts=2022-07-04T11:47:59.071097704Z caller=main.go:320 module=smtp_starttls 
> target= 1.1.1.1  :25 level=info msg="Beginning probe" probe=tcp 
> timeout_seconds=5
> ts=2022-07-04T11:47:59.071251831Z caller=tcp.go:40 module=smtp_starttls 
> target=1 1.1.1.1  :25 level=info msg="Resolving target address" 
> ip_protocol=ip6
> ts=2022-07-04T11:47:59.071292289Z caller=tcp.go:40 module=smtp_starttls 
> target= 1.1.1.1  :25 level=info msg="Resolving target address" 
> ip_protocol=ip4
> ts=2022-07-04T11:47:59.071327224Z caller=tcp.go:40 module=smtp_starttls 
> target= 1.1.1.1  :25 level=info msg="Resolved target address" ip= 1.1.1.1
> ts=2022-07-04T11:47:59.071354819Z caller=tcp.go:121 module=smtp_starttls 
> target= 1.1.1.1  :25 level=info msg="Dialing TCP without TLS"
> ts=2022-07-04T11:47:59.072469713Z caller=main.go:130 module=smtp_starttls 
> target= 1.1.1.1  :25 level=info msg="Successfully dialed"
> ts=2022-07-04T11:47:59.072508076Z caller=main.go:130 module=smtp_starttls 
> target= 1.1.1.1  :25 level=info msg="Processing query response entry" 
> entry_number=0
> ts=2022-07-04T11:47:59.073453639Z caller=main.go:130 module=smtp_starttls 
> target= 1.1.1.1  :25 level=debug msg="Read line" line="220  ESMTP"
> ts=2022-07-04T11:48:04.072081695Z caller=main.go:130 module=smtp_starttls 
> target= 1.1.1.1  :25 level=error msg="Error reading from connection" 
> err="read tcp4 0.0.0.0:53872->1.1.1.1:25: i/o timeout"
> ts=2022-07-04T11:48:04.072269643Z caller=main.go:320 module=smtp_starttls 
> target= 1.1.1.1  :25 level=error msg="Probe failed" 
> duration_seconds=5.00106792
>
>
>
> Metrics that would have been returned:
> # HELP probe_dns_lookup_time_seconds Returns the time taken for probe dns 
> lookup in seconds
> # TYPE probe_dns_lookup_time_seconds gauge
> probe_dns_lookup_time_seconds 0.000101683
> # HELP probe_duration_seconds Returns how long the probe took to complete 
> in seconds
> # TYPE probe_duration_seconds gauge
> probe_duration_seconds 5.00106792
> # HELP probe_failed_due_to_regex Indicates if probe failed due to regex
> # TYPE probe_failed_due_to_regex gauge
> probe_failed_due_to_regex 0
> # HELP probe_ip_addr_hash Specifies the hash of IP address. It's useful to 
> detect if the IP address changes.
> # TYPE probe_ip_addr_hash gauge
> probe_ip_addr_hash 2.493392506e+09
> # HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or IP6
> # TYPE probe_ip_protocol gauge
> probe_ip_protocol 4
> # HELP probe_success Displays whether or not the probe was a success
> # TYPE probe_success gauge
> probe_success 0
>
>
>
> Module configuration:
> prober: tcp
> timeout: 5s
> http:
>     ip_protocol_fallback: true
>     follow_redirects: true
> tcp:
>     ip_protocol_fallback: true
>     query_response:
>         - expect: ^220 ([^ ]+) ESMTP (.+)$
>           send: EHLO prober
>         - expect: ^250-STARTTLS
>         - expect: ^250 .*$
>           send: STARTTLS
>         - expect: ^220
>           starttls: true
>         - send: EHLO prober
>         - expect: ^250 .*$
>           send: QUIT
> icmp:
>     ip_protocol_fallback: true
> dns:
>     ip_protocol_fallback: true
>
> On Monday, July 4, 2022 at 7:22:08 PM UTC+8 Brian Candler wrote:
>
>> Could you first just try copy-pasting the working config I gave you, and 
>> see if it gives a different result to yours?
>>
>> I doubt a mail server would take more than 5 seconds to give a banner, 
>> but it's possible.  Simply doing "telnet x.x.x.x 25" will show you how your 
>> mail server behaves.
>>
>> On Monday, 4 July 2022 at 11:14:23 UTC+1 [email protected] wrote:
>>
>>>
>>> Yes in my code the first expect is quoted.
>>>
>>> smtp_starttls:
>>>         prober: tcp
>>>         timeout: 5s
>>>         tcp:
>>>           query_response:
>>>             - expect: "^220 ([^ ]+) ESMTP (.+)$"
>>>             - send: "EHLO prober\r"
>>>             - expect: "^250-STARTTLS"
>>>             - send: "STARTTLS\r"
>>>             - expect: "^220"
>>>             - starttls: true
>>>             - send: "EHLO prober\r"
>>>             - expect: "^250-AUTH"
>>>             - send: "QUIT\r"
>>>
>>> Probably due to the "timeout" is too less? Should I adjust 5s to 15s or 
>>> 60s?
>>> On Monday, July 4, 2022 at 5:55:09 PM UTC+8 Brian Candler wrote:
>>>
>>>> The following works for me with blackbox_exporter 0.21.0 (maybe your 
>>>> first 'expect' regexp needs to be quoted?)
>>>>
>>>> modules:
>>>>   smtp_starttls:
>>>>       prober: tcp
>>>>       timeout: 5s
>>>>       tcp:
>>>>         query_response:
>>>>           - expect: "^220 ([^ ]+) ESMTP (.+)$"
>>>>             send: "EHLO prober"
>>>>           - expect: "^250-STARTTLS"
>>>>           - expect: "^250 .*$"
>>>>             send: "STARTTLS"
>>>>           - expect: "^220"
>>>>
>>>>             starttls: true
>>>>           - send: "EHLO prober"
>>>>           - expect: "^250 .*$"
>>>>             send: "QUIT"
>>>>
>>>> Result:
>>>>
>>>> # *curl -g 
>>>> 'localhost:9115/probe?module=smtp_starttls&target=aspmx.l.google.com:25&debug=true'*
>>>> Logs for the probe:
>>>> ts=2022-07-04T09:50:46.764604425Z caller=main.go:351 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Beginning probe" probe=tcp timeout_seconds=5
>>>> ts=2022-07-04T09:50:46.764875668Z caller=tcp.go:40 module=smtp_starttls 
>>>> target=aspmx.l.google.com:25 level=info msg="Resolving target address" 
>>>> target=aspmx.l.google.com ip_protocol=ip6
>>>> ts=2022-07-04T09:50:46.765954096Z caller=tcp.go:40 module=smtp_starttls 
>>>> target=aspmx.l.google.com:25 level=info msg="Resolved target address" 
>>>> target=aspmx.l.google.com ip=2a00:1450:400c:c07::1b
>>>> ts=2022-07-04T09:50:46.766011111Z caller=tcp.go:121 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Dialing TCP without TLS"
>>>> ts=2022-07-04T09:50:46.776962616Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Successfully dialed"
>>>> ts=2022-07-04T09:50:46.77708032Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Processing query response entry" entry_number=0
>>>> ts=2022-07-04T09:50:46.788075017Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="220 mx.google.com ESMTP 
>>>> u1-20020a056000038100b0021bbcef3a69si36572085wrf.542 - gsmtp"
>>>> ts=2022-07-04T09:50:46.788168204Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Regexp matched" regexp="^220 ([^ ]+) ESMTP (.+)$" line="220 
>>>> mx.google.com ESMTP 
>>>> u1-20020a056000038100b0021bbcef3a69si36572085wrf.542 - gsmtp"
>>>> ts=2022-07-04T09:50:46.788223914Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Sending line" line="EHLO prober"
>>>> ts=2022-07-04T09:50:46.788362926Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Processing query response entry" entry_number=1
>>>> ts=2022-07-04T09:50:46.801755535Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="250-mx.google.com at your service, 
>>>> [xx:xx:xx:xx::33]"
>>>> ts=2022-07-04T09:50:46.801856147Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="250-SIZE 157286400"
>>>> ts=2022-07-04T09:50:46.801889927Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-8BITMIME
>>>> ts=2022-07-04T09:50:46.801922312Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-STARTTLS
>>>> ts=2022-07-04T09:50:46.801955499Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Regexp matched" regexp=^250-STARTTLS line=250-STARTTLS
>>>> ts=2022-07-04T09:50:46.801989646Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Processing query response entry" entry_number=2
>>>> ts=2022-07-04T09:50:46.802029066Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-ENHANCEDSTATUSCODES
>>>> ts=2022-07-04T09:50:46.802063318Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-PIPELINING
>>>> ts=2022-07-04T09:50:46.802094713Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-CHUNKING
>>>> ts=2022-07-04T09:50:46.802126198Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="250 SMTPUTF8"
>>>> ts=2022-07-04T09:50:46.802159858Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Regexp matched" regexp="^250 .*$" line="250 SMTPUTF8"
>>>> ts=2022-07-04T09:50:46.802191065Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Sending line" line=STARTTLS
>>>> ts=2022-07-04T09:50:46.802271697Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Processing query response entry" entry_number=3
>>>> ts=2022-07-04T09:50:46.812211682Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="220 2.0.0 Ready to start TLS"
>>>> ts=2022-07-04T09:50:46.812279339Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Regexp matched" regexp=^220 line="220 2.0.0 Ready to start TLS"
>>>> ts=2022-07-04T09:50:46.833573801Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info msg="TLS 
>>>> Handshake (client) succeeded."
>>>> ts=2022-07-04T09:50:46.833793385Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Processing query response entry" entry_number=4
>>>> ts=2022-07-04T09:50:46.833838422Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Sending line" line="EHLO prober"
>>>> ts=2022-07-04T09:50:46.833960852Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Processing query response entry" entry_number=5
>>>> ts=2022-07-04T09:50:46.84464181Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="250-mx.google.com at your service, 
>>>> [xx:xx:xx:xx::33]"
>>>> ts=2022-07-04T09:50:46.844771942Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="250-SIZE 157286400"
>>>> ts=2022-07-04T09:50:46.844839074Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-8BITMIME
>>>> ts=2022-07-04T09:50:46.844910271Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-ENHANCEDSTATUSCODES
>>>> ts=2022-07-04T09:50:46.844974538Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-PIPELINING
>>>> ts=2022-07-04T09:50:46.845061058Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line=250-CHUNKING
>>>> ts=2022-07-04T09:50:46.84512579Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Read line" line="250 SMTPUTF8"
>>>> ts=2022-07-04T09:50:46.845193403Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Regexp matched" regexp="^250 .*$" line="250 SMTPUTF8"
>>>> ts=2022-07-04T09:50:46.84525809Z caller=main.go:144 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=debug 
>>>> msg="Sending line" line=QUIT
>>>> ts=2022-07-04T09:50:46.845583228Z caller=main.go:351 
>>>> module=smtp_starttls target=aspmx.l.google.com:25 level=info 
>>>> msg="Probe succeeded" duration_seconds=0.080912196
>>>>
>>>>
>>>>
>>>>
>>>> Metrics that would have been returned:
>>>> # HELP probe_dns_lookup_time_seconds Returns the time taken for probe 
>>>> dns lookup in seconds
>>>> # TYPE probe_dns_lookup_time_seconds gauge
>>>> probe_dns_lookup_time_seconds 0.001103057
>>>>
>>>> # HELP probe_duration_seconds Returns how long the probe took to 
>>>> complete in seconds
>>>> # TYPE probe_duration_seconds gauge
>>>> probe_duration_seconds 0.080912196
>>>>
>>>> # HELP probe_failed_due_to_regex Indicates if probe failed due to regex
>>>> # TYPE probe_failed_due_to_regex gauge
>>>> probe_failed_due_to_regex 0
>>>> # HELP probe_ip_addr_hash Specifies the hash of IP address. It's useful 
>>>> to detect if the IP address changes.
>>>> # TYPE probe_ip_addr_hash gauge
>>>> probe_ip_addr_hash 2.766777767e+09
>>>>
>>>> # HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or 
>>>> IP6
>>>> # TYPE probe_ip_protocol gauge
>>>> probe_ip_protocol 6
>>>> # HELP probe_ssl_earliest_cert_expiry Returns earliest SSL cert expiry 
>>>> date
>>>> # TYPE probe_ssl_earliest_cert_expiry gauge
>>>> probe_ssl_earliest_cert_expiry 1.661764429e+09
>>>> # HELP probe_ssl_last_chain_expiry_timestamp_seconds Returns last SSL 
>>>> chain expiry in unixtime
>>>> # TYPE probe_ssl_last_chain_expiry_timestamp_seconds gauge
>>>> probe_ssl_last_chain_expiry_timestamp_seconds 1.661764429e+09
>>>>
>>>> # HELP probe_success Displays whether or not the probe was a success
>>>> # TYPE probe_success gauge
>>>> probe_success 1
>>>>
>>>>
>>>>
>>>>
>>>> Module configuration:
>>>> prober: tcp
>>>> timeout: 5s
>>>> http:
>>>>     ip_protocol_fallback: true
>>>>     follow_redirects: true
>>>>     enable_http2: true
>>>>
>>>> tcp:
>>>>     ip_protocol_fallback: true
>>>>     query_response:
>>>>         - expect: ^220 ([^ ]+) ESMTP (.+)$
>>>>           send: EHLO prober
>>>>         - expect: ^250-STARTTLS
>>>>         - expect: ^250 .*$
>>>>           send: STARTTLS
>>>>         - expect: ^220
>>>>
>>>>           starttls: true
>>>>         - send: EHLO prober
>>>>         - expect: ^250 .*$
>>>>           send: QUIT
>>>>
>>>> icmp:
>>>>     ip_protocol_fallback: true
>>>> dns:
>>>>     ip_protocol_fallback: true
>>>>     recursion_desired: true
>>>>
>>>

-- 
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/f2bcf364-d9e1-44c3-81a5-20221b4e9080n%40googlegroups.com.

Reply via email to