Skip to content

An alternative promethus exporter to json_exporter using gojq.

License

Notifications You must be signed in to change notification settings

johejo/prometheus-jq-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prometheus-jq-exporter

An alternative promethus exporter to json_exporter using gojq.

Features

  • jq expression
  • file transport (target=file://...)
  • unix socket transport (target=http:///path/to/target.sock)

Install

go install github.com/johejo/prometheus-jq-exporter@latest

Usage

$ prometheus-jq-exporter -h
Usage of prometheus-jq-exporter:
  -addr string
        listen addr (default ":9999")
  -config string
        config file path (default "config.yaml")
  -enable-file-transport
        enable file transport
  -enable-unix-socket-transport
        enable unix socket transport
  -expand-env
        expand environment variable in config file
  -expose-metadata
        expose metric metadata (default true)
  -log-level string
        log level (default "info")

Example

$ prometheus-jq-exporter --config ./testdata/config.yaml
$ python3 -m http.server ./testdata
$ curl 'localhost:9999/probe?module=tailscale&target=http://localhost:8000/tailscale-status.json'
# HELP tailscale_status_peer_rx_bytes
# TYPE tailscale_status_peer_rx_bytes gauge
tailscale_status_peer_rx_bytes{machine_name="testhostname"} 168365416
tailscale_status_peer_rx_bytes{machine_name="testhostname2"} 0
# HELP tailscale_status_peer_tx_bytes
# TYPE tailscale_status_peer_tx_bytes gauge
tailscale_status_peer_tx_bytes{machine_name="testhostname"} 363769796
tailscale_status_peer_tx_bytes{machine_name="testhostname2"} 0
# HELP tailscale_status_peer
# TYPE tailscale_status_peer gauge
tailscale_status_peer{created="2122-01-14T13:30:18.170320276Z",dns_name="testhostname.tailc2865.ts.net.",exit_node="false",exit_node_option="false",ipv4="100.12.34.56",ipv6="fd7a:115c:a1e0::ac99:b03d",key_expiry="2125-01-08T02:03:11Z",machine_name="testhostname",os="macOS",relay="tok"} 1
tailscale_status_peer{created="2124-06-14T14:17:04.079089567Z",dns_name="testhostname2.tailc2865.ts.net.",exit_node="false",exit_node_option="false",ipv4="100.123.4.56",ipv6="fd7a:115c:a1e0::ac01:b66c",key_expiry="2124-12-11T14:17:04Z",machine_name="testhostname2",os="android",relay="tok"} 1

License

BSD 3-Clause

Author

Mitsuo HEIJO

About

An alternative promethus exporter to json_exporter using gojq.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages