1
+ # Development
2
+
1
3
Setup the development environment on a node with access to the Slurm user
2
4
command-line interface, in particular with the ` sinfo ` , ` squeue ` , and ` sdiag `
3
5
commands.
4
6
5
- ### Install Go from source
7
+ ## Install Go from source
6
8
7
9
``` bash
8
10
export VERSION=1.15 OS=linux ARCH=amd64
@@ -13,51 +15,40 @@ export PATH=$PWD/go/bin:$PATH
13
15
14
16
_ Alternatively install Go using the packaging system of your Linux distribution._
15
17
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:
18
21
19
22
``` bash
20
23
# clone the source code
21
24
git clone https://github.com/vpenso/prometheus-slurm-exporter.git
22
25
cd 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,node,nodes,queue,scheduler,sshare,users}.go
26
+ make
34
27
```
35
28
36
- Run all tests included in ` _test.go ` files :
29
+ To just run the tests :
37
30
38
31
``` bash
39
- go test -v * .go
32
+ make test
40
33
```
41
34
42
35
Start the exporter (foreground), and query all metrics:
43
36
44
37
``` bash
45
- bin/prometheus-slurm-exporter
38
+ ./ bin/prometheus-slurm-exporter
46
39
```
47
40
48
41
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:
49
42
50
43
``` 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>"
52
45
...
53
46
54
47
# query all metrics (default port)
55
48
curl http://localhost:8080/metrics
56
49
```
57
50
58
- ### Development
59
-
60
- References:
51
+ ## References
61
52
62
53
* [ GOlang Package Documentation] ( https://godoc.org/github.com/prometheus/client_golang/prometheus )
63
54
* [ Metric Types] ( https://prometheus.io/docs/concepts/metric_types/ )
0 commit comments