
Beanstalkd Exporter for Prometheus
This is a simple server that scrapes beanstalkd stats and exports them via http
for Prometheus consumption.
Getting Started
To run it:
./beanstalkd_exporter [flags]
Help on flags:
./beanstalkd_exporter --help
Usage
Specify the address of the beanstalkd instance using the --beanstalkd.address
flag. For example,
./beanstalkd_exporter --beanstalkd.address=127.0.0.1:11300
The default address is localhost:11300
.
Example With Beanstalkd
Start a beanstalkd instance with the following docker command.
docker run -d -p 11300:11300 --name beanstalkd dtannock/beanstalkd:latest
Run beanstalkd_exporter. The default flag values should be able to connect to the running beanstalkd instance.
./beanstalkd_exporter
Fetch the metrics for Prometheus.
curl -s http://localhost:8080/metrics
Failed Scrapes
Of the failed scraping strategies described here, the up
variable is used.
You can see this in practice by starting/stopping the docker container, and fetching the metrics,
then find the beanstalkd_up
value.
docker stop beanstalkd
curl -s http://localhost:8080/metrics | grep beanstalkd_up
docker start beanstalkd
curl -s http://localhost:8080/metrics | grep beanstalkd_up
Metrics
Without passing any flags, only the system-level stats will be collected from beanstalkd
(i.e. tube-level stats will not be collected).
To collect tube-level stats, you must use either the --beanstalkd.allTubes
or --beanstalkd.tubes
flag.
--beanstalkd.allTubes
will collect metrics for all tubes.
./beanstalkd_exporter --beanstalkd.allTubes
--beanstalkd.tubes
will collect metrics for one or more specific tubes.
./beanstalkd_exporter --beanstalkd.tubes=default,anotherTube
The metrics collected from beanstalkd can be filtered using the --beanstalkd.systemMetrics
and
--beanstalkd.tubeMetrics
flags. For example,
./beanstalkd_exporter \
--beanstalkd.systemMetrics=current_jobs_urgent_count,current_jobs_ready_count \
--beanstalkd.tubes=default \
--beanstalkd.tubeMetrics=tube_current_jobs_ready_count
Will fetch only 2 system-level metrics, and 1 metric labelled for the default
tube.
The full list of metrics is available on this page.
Development
Dev dependencies
make devtools
Building
make build
Testing
make test
Version 2
Version 2 was an exercise in learning Nix (https://nixos.org/), specifically:
The other changes are mainly related to removing legacy dependencies. The cli command is largely unchanged, and nix is not necessary to build the executable (see Makefile).
License
Apache License 2.0, see LICENSE.