Skip to content

Simple & minimalistic Prometheus exporter for bash scripts, written in Go

License

Notifications You must be signed in to change notification settings

gnuu-de/bash-exporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus bash exporter

Simple & minimalistic Prometheus exporter for bash scripts.

Go Report Card

Installation

Use Docker image or binary file from releases.

Docker quick start

$ docker run -v $PWD/examples:/scripts -p 9300:9300 greegorey/bash-exporter:2.0.0
$ curl -s 127.1:9300/metrics | grep ^bash
bash{env="",hostname="node-1",job="job-2",verb="get"} 0.003
bash{env="",hostname="node-1",job="job-2",verb="put"} 0.13
bash{env="",hostname="node-1",job="job-2",verb="time"} 0.5
bash{env="dev",hostname="",job="job-1",verb="items"} 21

Usage

Usage of ./bash-exporter:
  -debug
    	Debug log level
  -interval int
    	Interval for metrics collection in seconds (default 300)
  -labels string
    	additioanal labels (default "hostname,env")
  -path string
    	path to directory with bash scripts (default "/scripts")
  -prefix string
    	Prefix for metrics (default "bash")
  -web.listen-address string
    	Address on which to expose metrics (default ":9300")

Just point -path flag to the directory with your bash scripts. Names of the files ((.*).sh) will be used as the job label. Bash scripts should return valid json (see examples).

Example output:

# HELP bash bash exporter metrics
# TYPE bash gauge
bash{job="job-1",verb="items"} 21
bash{job="job-2",verb="get"} 0.003
bash{job="job-2",verb="put"} 0.13
bash{job="job-2",verb="time"} 0.5
...

TODO

  • Docker image
  • Several scripts

About

Simple & minimalistic Prometheus exporter for bash scripts, written in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 88.5%
  • Dockerfile 11.5%