1+ # Development
2+
13Setup the development environment on a node with access to the Slurm user
24command-line interface, in particular with the ` sinfo ` , ` squeue ` , and ` sdiag `
35commands.
46
5- ### Install Go from source
7+ ## Install Go from source
68
79``` bash
810export VERSION=1.15 OS=linux ARCH=amd64
@@ -13,51 +15,40 @@ export PATH=$PWD/go/bin:$PATH
1315
1416_ Alternatively install Go using the packaging system of your Linux distribution._
1517
16- Use Git to clone the source code of the exporter, and download all Go dependency
17- modules:
18+ ## Clone this repository and build
19+
20+ Use Git to clone the source code of the exporter, run all the tests and build the binary:
1821
1922``` bash
2023# clone the source code
2124git clone https://github.com/vpenso/prometheus-slurm-exporter.git
2225cd prometheus-slurm-exporter
23- # download dependencies
24- export GOPATH=$PWD /go/modules
25- go mod download
26- ```
27-
28- ### Build
29-
30- Build the exporter:
31-
32- ``` bash
33- go build -o bin/prometheus-slurm-exporter {main,accounts,cpus,gpus,partitions,nodes,queue,scheduler,sshare,users}.go
26+ make
3427```
3528
36- Run all tests included in ` _test.go ` files :
29+ To just run the tests :
3730
3831``` bash
39- go test -v * .go
32+ make test
4033```
4134
4235Start the exporter (foreground), and query all metrics:
4336
4437``` bash
45- bin/prometheus-slurm-exporter
38+ ./ bin/prometheus-slurm-exporter
4639```
4740
4841If you wish to run the exporter on a different port, or the default port (8080) is already in use, run with the following argument:
4942
5043``` bash
51- bin/prometheus-slurm-exporter --listen-address=" 0.0.0.0:<port>"
44+ ./ bin/prometheus-slurm-exporter --listen-address=" 0.0.0.0:<port>"
5245...
5346
5447# query all metrics (default port)
5548curl http://localhost:8080/metrics
5649```
5750
58- ### Development
59-
60- References:
51+ ## References
6152
6253* [ GOlang Package Documentation] ( https://godoc.org/github.com/prometheus/client_golang/prometheus )
6354* [ Metric Types] ( https://prometheus.io/docs/concepts/metric_types/ )
0 commit comments