Skip to content

wf1314/network_exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus Exporter

Prometheus Configuration

scrape_configs:
  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      status_code: [200, ]  # Look for a HTTP 200 response.eg:[301,302,303]
      ic_code: [yaicn]  # any
      proxy: [http://wangfan:[email protected]:19000]
      headers: ['{}']  # eg: ['{"Content-Type":"application/x-www-form-urlencoded"}']
      request_data: ['{}']  # eg: ['{"abc":123}']
      request_method: [GET]  # GET POST
      response_body: []  # 根据相应内容判断是否请求成功
      response_coding: [utf8]
      timeout: [10]
      name: []  # any
      chart: []  # 1 or '' 为1时返回图表
    static_configs:
      - targets:
        - https://www.baidu.com    # Target to
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9116  # The network exporter's real hostname:port.

Local Run

make build
make start

Checking the results chart

curl http://localhost:9116/probe?target=www.baidu.com&proxy=http://wangfan:[email protected]:19000&chart=1
          DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
        [     1ms    |       8ms      |      0ms      |       13ms        |        8ms       ]
                     |                |               |                   |                  |
            namelookup:1ms            |               |                   |                  |
                                connect:9ms           |                   |                  |
                                            pretransfer:9ms               |                  |
                                                              starttransfer:23ms             |
                                                                                         total:31ms

Checking the results text

curl http://localhost:9116/probe?target=www.baidu.com&proxy=http://wangfan:[email protected]:19000
# 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.023714772
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0.106005898
# 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_http_content_length Length of http content response
# TYPE probe_http_content_length gauge
probe_http_content_length -1
# HELP probe_http_duration_seconds Duration of http request by phase, summed over all redirects
# TYPE probe_http_duration_seconds gauge
probe_http_duration_seconds{phase="connect"} 0.006734189
probe_http_duration_seconds{phase="processing"} 0.066601639
probe_http_duration_seconds{phase="resolve"} 0.023714772
probe_http_duration_seconds{phase="tls"} 0
probe_http_duration_seconds{phase="transfer"} 0.008547172
# HELP probe_http_redirects The number of redirects
# TYPE probe_http_redirects gauge
probe_http_redirects 0
# HELP probe_http_ssl Indicates if SSL was used for the final redirect
# TYPE probe_http_ssl gauge
probe_http_ssl 0
# HELP probe_http_status_code Response HTTP status code
# TYPE probe_http_status_code gauge
probe_http_status_code 200
# HELP probe_http_version Returns the version of HTTP of the probe response
# TYPE probe_http_version gauge
probe_http_version 1.1
# 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 1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published