Skip to content

Commit 903630b

Browse files
authored
Merge pull request #2 from cea-hpc/rebase_020
Rebase on v0.20
2 parents 4b7ac9f + b909964 commit 903630b

File tree

581 files changed

+1429
-302702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

581 files changed

+1429
-302702
lines changed

.github/workflows/go.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
bin/
2+
go/
3+
*.snap

CHANGELOG.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Changelog
2+
3+
Full commit history per tag: https://github.com/vpenso/prometheus-slurm-exporter/commits/{tag number}
4+
5+
* **0.19**
6+
- Merge PR#50
7+
8+
* **0.18**
9+
- Add CPU/Memory info per node (see PR#47)
10+
11+
* **0.17**
12+
- Add fair share collector
13+
14+
* **0.16**
15+
- Export more data per account/partition, fix squeue for pending jobs
16+
- Merge PR#34
17+
18+
* **0.15**
19+
- CPU allocation status per partition
20+
21+
* **0.14**
22+
- add stats about jobs per account/per user
23+
24+
* **0.13**
25+
- Merge pull request #32 from pdtpartners/faster-node-metrics
26+
27+
* **0.12**
28+
- Merge pull request #30 from omnivector-solutions/add_snap_packaging
29+
30+
* **0.11**
31+
- Merge PR#29
32+
- Add more backfill stats (see PR#27)
33+
34+
* **0.10**
35+
- Scheduler: keep track of the DBD agent queue size
36+
37+
* **0.9**
38+
- README: update to fix build problem raised with issue #26
39+
40+
* **0.8**
41+
- Merge pull request #21 from cleargray/command-paths
42+
43+
* **0.7**
44+
- Update scheduler.go (fix issue #18)
45+
46+
* **0.6**
47+
- Merge pull request #13 from rug-cit-hpc/master
48+
49+
* **0.5**
50+
- [BUG]: count all job states (issue #9)
51+
52+
* **0.4**
53+
- Merge pull request #8 from MatMaul/pending-dep
54+
55+
* **0.3**
56+
- Fix issue #4
57+
58+
* **0.2**
59+
- Fix issue #3
60+
61+
* **0.1**
62+
- Basic prototype
63+
- Merge PR#2
64+
- Add Grafana dashboard

CONTRIBUTORS.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

DEVELOPMENT.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Development
2+
3+
Setup the development environment on a node with access to the Slurm user
4+
command-line interface, in particular with the `sinfo`, `squeue`, and `sdiag`
5+
commands.
6+
7+
## Install Go from source
8+
9+
```bash
10+
export VERSION=1.15 OS=linux ARCH=amd64
11+
wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz
12+
tar -xzvf go$VERSION.$OS-$ARCH.tar.gz
13+
export PATH=$PWD/go/bin:$PATH
14+
```
15+
16+
_Alternatively install Go using the packaging system of your Linux distribution._
17+
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:
21+
22+
```bash
23+
# clone the source code
24+
git clone https://github.com/vpenso/prometheus-slurm-exporter.git
25+
cd prometheus-slurm-exporter
26+
make
27+
```
28+
29+
To just run the tests:
30+
31+
```bash
32+
make test
33+
```
34+
35+
Start the exporter (foreground), and query all metrics:
36+
37+
```bash
38+
./bin/prometheus-slurm-exporter
39+
```
40+
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:
42+
43+
```bash
44+
./bin/prometheus-slurm-exporter --listen-address="0.0.0.0:<port>"
45+
...
46+
47+
# query all metrics (default port)
48+
curl http://localhost:8080/metrics
49+
```
50+
51+
## References
52+
53+
* [GOlang Package Documentation](https://godoc.org/github.com/prometheus/client_golang/prometheus)
54+
* [Metric Types](https://prometheus.io/docs/concepts/metric_types/)
55+
* [Writing Exporters](https://prometheus.io/docs/instrumenting/writing_exporters/)
56+
* [Available Exporters](https://prometheus.io/docs/instrumenting/exporters/)

Makefile

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
PROJECT_NAME = prometheus-slurm-exporter
2-
ifndef GOPATH
3-
GOPATH=$(shell pwd):/usr/share/gocode
4-
endif
5-
GOFILES=cpus.go main.go nodes.go queue.go scheduler.go
6-
GOBIN=bin/$(PROJECT_NAME)
2+
SHELL := $(shell which bash) -eu -o pipefail
73

8-
build:
9-
mkdir -p $(shell pwd)/bin
10-
@echo "Build $(GOFILES) to $(GOBIN)"
11-
@GOPATH=$(GOPATH) go build -o $(GOBIN) $(GOFILES)
4+
GOPATH := $(shell pwd)/go/modules
5+
GOBIN := bin/$(PROJECT_NAME)
6+
GOFILES := $(shell ls *.go)
127

13-
test:
14-
@GOPATH=$(GOPATH) go test -v *.go
8+
.PHONY: build
9+
build: test $(GOBIN)
1510

16-
run:
17-
@GOPATH=$(GOPATH) go run $(GOFILES)
11+
$(GOBIN): go/modules/pkg/mod $(GOFILES)
12+
mkdir -p bin
13+
@echo "Building $(GOBIN)"
14+
go build -v -o $(GOBIN)
15+
16+
go/modules/pkg/mod: go.mod
17+
go mod download
18+
19+
.PHONY: test
20+
test: go/modules/pkg/mod $(GOFILES)
21+
go test -v
22+
23+
run: $(GOBIN)
24+
$(GOBIN)
1825

1926
clean:
20-
if [ -f ${GOBIN} ] ; then rm -f ${GOBIN} ; fi
27+
go clean -modcache
28+
rm -fr bin/ go/

0 commit comments

Comments
 (0)