command module
Version: v0.0.3 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 16 Imported by: 0


Shell exit status Exporter


Prometheus exporter written to execute and collect metrics on script exit status and duration. Designed to allow the execution of probes where support for the probe type wasn't easily configured with the Prometheus blackbox exporter.

Minimum supported Go Version: 1.11.0

Sample Configuration

  - name: success
    script: sleep 5

  - name: failure
    script: sleep 2 && exit 255

  - name: timeout
    script: sleep 5
    timeout: 1


You can run via docker with:

docker run -d -p 9062:9062 --name shell-exit-status-exporter \
  -v `pwd`/config.yml:/etc/shell-exit-status-exporter/config.yml:ro \
  -web.listen-address=":9062" \
  -web.telemetry-path="/metrics" \"/bin/sh" \

You'll need to customize the docker image or use the binary on the host system to install tools such as curl for certain scenarios.


To return the shell exit status exporter internal metrics exposed by the default Prometheus handler:

$ curl http://localhost:9062/metrics

To execute a script, use the name parameter to the /probe endpoint:

$ curl http://localhost:9062/probe?name=failure

shell_exit_status_duration_seconds{script="failure"} 2.008337
shell_exit_status_status{script="failure"} 255
shell_exit_status_finished{script="failure"} 1

A regular expression may be specified with the pattern paremeter:

$ curl http://localhost:9062/probe?pattern=.*

shell_exit_status_duration_seconds{script="timeout"} 1.005727
shell_exit_status_status{script="timeout"} 1
shell_exit_status_finished{script="timeout"} 0
shell_exit_status_duration_seconds{script="failure"} 2.015021
shell_exit_status_status{script="failure"} 255
shell_exit_status_finished{script="failure"} 1
shell_exit_status_duration_seconds{script="success"} 5.013670
shell_exit_status_status{script="success"} 0
shell_exit_status_finished{script="success"} 1


YMMV if you're attempting to execute a large number of scripts, and you'd be better off creating an exporter that can handle your protocol without launching shell processes for each scrape.


The Go Gopher

There is no documentation for this package.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL