Setup the development environment on a node with access to the Slurm user
command-line interface, in particular with the sinfo
, squeue
, and sdiag
commands.
export VERSION=1.15 OS=linux ARCH=amd64
wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz
tar -xzvf go$VERSION.$OS-$ARCH.tar.gz
export PATH=$PWD/go/bin:$PATH
Alternatively install Go using the packaging system of your Linux distribution.
Use Git to clone the source code of the exporter, and download all Go dependency modules:
# clone the source code
git clone https://github.com/vpenso/prometheus-slurm-exporter.git
cd prometheus-slurm-exporter
# download dependencies
export GOPATH=$PWD/go/modules
go mod download
Build the exporter:
go build -o bin/prometheus-slurm-exporter {main,accounts,cpus,gpus,partitions,nodes,queue,scheduler,sshare,users}.go
Run all tests included in _test.go
files:
go test -v *.go
Start the exporter (foreground), and query all metrics:
bin/prometheus-slurm-exporter
If you wish to run the exporter on a different port, or the default port (8080) is already in use, run with the following argument:
bin/prometheus-slurm-exporter --listen-address="0.0.0.0:<port>"
...
# query all metrics (default port)
curl http://localhost:8080/metrics
References: