Skip to content
Collect Prometheus metrics with Sensu!
Branch: master
Clone or download
portertech Merge pull request #14 from apaskulin/bonsai
Update filter syntax to use single quotes around os and arch
Latest commit 3cd4534 Mar 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.goreleaser.yml automate asset builds with goreleaser and travis ciii Dec 10, 2018
LICENSE fixed authorization header and readme edits Feb 7, 2018
main.go put the influx segment count validation catch-all back in Dec 11, 2018

Sensu Prometheus Collector

The Sensu Prometheus Collector is a Sensu Check Plugin that collects metrics from a Prometheus exporter or the Prometheus query API. The collected metrics are outputted to STDOUT in one of three formats, Influx (the default), Graphite, or JSON.

The Sensu Prometheus Collector turns Sensu into a SUPER POWERED Prometheus metric poller, leveraging Sensu's pubsub design and client auto-registration (discovery). Sensu can deliver collected metrics to one or more time-series databases, for example InfluxDB and/or Graphite! Instrument your applications with the Prometheus libraries and immediately begin collecting your metrics with Sensu!


Download the latest version of the sensu-prometheus-collector binary from Releases.


Example Sensu 1.x check definition:

  "checks": {
    "prometheus_metrics": {
      "type": "metric",
      "command": "sensu-prometheus-collector -exporter-url http://localhost:8080/metrics",
      "subscribers": ["app_tier"],
      "interval": 10,
      "handler": "influx"

Example Sensu 1.x handler definition:

  "handlers": {
    "influx": {
      "type": "udp",
      "mutator": "only_check_output",
      "socket": {
        "host": "",
        "port": 8189

Usage Examples


$ sensu-prometheus-collector -h
Usage of ./sensu-prometheus-collector:
  -exporter-authorization string
        Prometheus exporter Authorization header.
  -exporter-password string
        Prometheus exporter basic auth password.
  -exporter-url string
        Prometheus exporter URL to pull metrics from.
  -exporter-user string
        Prometheus exporter basic auth user.
  -metric-prefix string
        Metric name prefix, only supported by line protocol output formats.
  -output-format string
        The check output format to use for metrics {influx|graphite|json}. (default "influx")
  -prom-query string
        Prometheus API query string. (default "up")
  -prom-url string
        Prometheus API URL. (default "http://localhost:9090")

Application instrumentation:

$ sensu-prometheus-collector -exporter-url http://localhost:8080/metrics
go_memstats_last_gc_time_seconds value=0 1506991233
go_memstats_mspan_sys_bytes value=32768 1506991233
$ sensu-prometheus-collector -exporter-url http://localhost:8080/metrics -exporter-user admin -exporter-password secretpassword -output-format graphite -metric-prefix 294912 1506991405 6375 1506991405

Exporter basic auth credentials can also be set via environment vars EXPORTER_USER and EXPORTER_PASSWORD.

Prometheus query API:

$ sensu-prometheus-collector -prom-url http://localhost:9090 -prom-query up
up,instance=localhost:9090,job=prometheus value=1 1506991495
You can’t perform that action at this time.