Making TCP Checks Critical based on Response Time.

26 views
Skip to first unread message

yagyans...@gmail.com

unread,
Jul 6, 2020, 1:59:16 PM7/6/20
to Prometheus Users
Hi. On some of my services I have setup some TCP Port Checks using blackbox. Now, I want those checks to be critical based on the Response Time of those TCP Checks. Is it possible to do so?

My TCP job.
  - job_name: 'blackbox_Service-TCPChecks'
    scrape_timeout: 10s
    metrics_path: /probe
    params:
      module: [tcp_connect]
    file_sd_configs:
      - files:
          - /etc/blackbox/HTTP_TCP-Targets/TCP_Targets.yml

This is how I am defining targets.
- targets:
     - x.x.x.x:80
  labels:
     checkname: 'myname'
     cluster: 'C1'
     node: 'N1'

Thanks in advance.

Brian Candler

unread,
Jul 7, 2020, 9:23:48 AM7/7/20
to Prometheus Users
On Monday, 6 July 2020 18:59:16 UTC+1, yagyans...@gmail.com wrote:
Hi. On some of my services I have setup some TCP Port Checks using blackbox. Now, I want those checks to be critical based on the Response Time of those TCP Checks. Is it possible to do so?


Yes.

You didn't show your alerting rules.  Are they using "probe_success" by any chance?  There are other metrics you can use.  Just type "probe_" into the Prometheus web UI and look for the auto-completions.

Here is an example.  blackbox.yml:

modules:
  certificate:
    prober: tcp
    timeout: 5s
    tcp:
      tls: true
      tls_config: {}

curl 'localhost:9115/probe?module=certificate&target=www.google.com:443'
# 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.001341219
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0.375832381
# 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 1.255276657e+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.599661882e+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.599661882e+09
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 1
# HELP probe_tls_version_info Returns the TLS version used, or NaN when unknown
# TYPE probe_tls_version_info gauge
probe_tls_version_info{version="TLS 1.3"} 1

yagyans...@gmail.com

unread,
Jul 7, 2020, 4:27:04 PM7/7/20
to Prometheus Users
Oh yes. Thank you. Yes, I am using probe_success. Totally forgot that probe_duration is there for TCP too.
Reply all
Reply to author
Forward
0 new messages