Prometheus exporter for custom user defined scripts. Allow user to list multiple command which will be executed via sh
and result will be parsed as float and then exported to prometheus via HTTP end point.
./csr_exporter -config ./csr_exporter.toml
To enable debug output - use -verbose
./csr_exporter -config ./csr_exporter.toml -verbose
update_period_sec = 5
port = 8080
[[metrics]]
name = "system_cpu_temp"
help = "CPU temperature"
cmd = "cat /sys/class/thermal/thermal_zone0/temp | cut -c-2"
[[metrics]]
name = "system_cpu_temp2"
help = "CPU temperature"
cmd = "cat /tmp/temp_test"
- Install dependencies. We use
dep
(https://golang.github.io/dep/docs/installation.html) as dependencies manager for go.
~/go/bin/dep ensure
- Build
go build
If you need to build without external dynamic dependencies (before install musl https://www.musl-libc.org/download.html):
CC=/usr/local/musl/bin/musl-gcc go build --ldflags '-linkmode external -extldflags "-static"'