forked from ports/contrib
prometheus-node-exporter: initial commit, version 1.4.0
This commit is contained in:
parent
b165efef1e
commit
31859e6e93
11
prometheus-node-exporter/.footprint
Normal file
11
prometheus-node-exporter/.footprint
Normal file
@ -0,0 +1,11 @@
|
||||
drwxr-xr-x root/root etc/
|
||||
drwxr-xr-x root/root etc/node-exporter/
|
||||
-rw-r--r-- root/root etc/node-exporter/config.yml
|
||||
drwxr-xr-x root/root etc/rc.d/
|
||||
-rwxr-xr-x root/root etc/rc.d/prometheus-node-exporter
|
||||
drwxr-xr-x root/root usr/
|
||||
drwxr-xr-x root/root usr/bin/
|
||||
-rwxr-xr-x root/root usr/bin/node_exporter
|
||||
drwxr-xr-x root/root usr/lib/
|
||||
drwxr-xr-x root/root usr/lib/prometheus-node-exporter/
|
||||
-rw-r--r-- root/root usr/lib/prometheus-node-exporter/gen-pass.py
|
8
prometheus-node-exporter/.signature
Normal file
8
prometheus-node-exporter/.signature
Normal file
@ -0,0 +1,8 @@
|
||||
untrusted comment: verify with /etc/ports/contrib.pub
|
||||
RWSagIOpLGJF3/0Q7j97nMYblzGYPpkkfrUb4o4MntlMBLwu24me+zF2WsVZxMSFkCVOiS0Kp95HYuPveseRD9FB/lc1crTZfAE=
|
||||
SHA256 (Pkgfile) = 491b6374718e3f303c1b4150f0c854ad0b75d7a4810a4d0174026dc556109647
|
||||
SHA256 (.footprint) = 63690ec8add40f9e66418b342db5acb1d5bfd54da5d27a5cb9fd36d4b51f0463
|
||||
SHA256 (prometheus-node-exporter-1.4.0.tar.gz) = 96f749928e3d6c952221aaca852d4c38545eaae03adc6bb925745bc3f2f827ca
|
||||
SHA256 (prometheus-node-exporter.service) = 3a1afd70a728ec9c84e5bf63378fb10583672daf5e064f2561961f5fdad302bb
|
||||
SHA256 (config.yml) = 7b660cee741de85009a5e1fbd0900bb70c8bea30f83131d74ea2442546546571
|
||||
SHA256 (gen-pass.py) = bc6d1e03893cc50ef9fd7491c66f66d6d0b26b7178e95016ec7c8f87cb6f2f19
|
36
prometheus-node-exporter/Pkgfile
Normal file
36
prometheus-node-exporter/Pkgfile
Normal file
@ -0,0 +1,36 @@
|
||||
# Description: Exporter for machine metrics
|
||||
# URL: https://github.com/prometheus/node_exporter
|
||||
# Maintainer: Tim Biermann, tbier at posteo dot de
|
||||
# Depends on: go
|
||||
# Optional: python3-bcrypt
|
||||
|
||||
name=prometheus-node-exporter
|
||||
version=1.4.0
|
||||
release=1
|
||||
source=(https://github.com/prometheus/node_exporter/archive/v$version/$name-$version.tar.gz
|
||||
prometheus-node-exporter.service config.yml
|
||||
gen-pass.py)
|
||||
|
||||
build() {
|
||||
cd node_exporter-$version
|
||||
export CGO_CPPFLAGS="${CPPFLAGS}"
|
||||
export CGO_CFLAGS="${CFLAGS}"
|
||||
export CGO_CXXFLAGS="${CXXFLAGS}"
|
||||
export CGO_LDFLAGS="${LDFLAGS}"
|
||||
|
||||
mkdir "$PKGMK_SOURCE_DIR/gopath" || true
|
||||
export GOPATH="$PKGMK_SOURCE_DIR/gopath"
|
||||
|
||||
go build \
|
||||
-trimpath \
|
||||
-buildmode=pie \
|
||||
-mod=readonly \
|
||||
-modcacherw \
|
||||
-o node_exporter .
|
||||
|
||||
install -Dm755 node_exporter $PKG/usr/bin/node_exporter
|
||||
|
||||
install -Dm755 $SRC/prometheus-node-exporter.service $PKG/etc/rc.d/$name
|
||||
install -Dm644 $SRC/gen-pass.py $PKG/usr/lib/$name/gen-pass.py
|
||||
install -Dm644 $SRC/config.yml $PKG/etc/node-exporter/config.yml
|
||||
}
|
16
prometheus-node-exporter/README.md
Normal file
16
prometheus-node-exporter/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
prometheus-node-exporter README
|
||||
===============================
|
||||
|
||||
## Generating a password
|
||||
|
||||
For generating a password you either need opt/apache installed to be able
|
||||
to use `htpasswd -nBC 10 "" | tr -d ':\'; echo` or use install
|
||||
`contrib/python3-bcrypt` and use
|
||||
`/usr/lib/prometheus-node-exporter/gen-pass.py`. Use the generated password
|
||||
hash to fill in the skeleton under `/etc/node-exporter/config.yml`.
|
||||
|
||||
## Using tls
|
||||
|
||||
Generate a valid certificate according to the `config.yml` or use a proper one.
|
||||
If you use a self signed certificate you will make your prometheus scraper
|
||||
trust it.
|
9
prometheus-node-exporter/config.yml
Normal file
9
prometheus-node-exporter/config.yml
Normal file
@ -0,0 +1,9 @@
|
||||
# openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout node_exporter.key -out node_exporter.crt -subj "/C=ZA/ST=CT/L=SA/O=VPN/CN=localhost" -addext "subjectAltName = DNS:localhost"
|
||||
#tls_server_config:
|
||||
# cert_file: node_exporter.crt
|
||||
# key_file: node_exporter.key
|
||||
#
|
||||
#basic_auth_users:
|
||||
# prometheus: encrypted_password
|
||||
#
|
||||
# End of file
|
7
prometheus-node-exporter/gen-pass.py
Executable file
7
prometheus-node-exporter/gen-pass.py
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/python3
|
||||
import getpass
|
||||
import bcrypt
|
||||
|
||||
password = getpass.getpass("password: ")
|
||||
hashed_password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt())
|
||||
print(hashed_password.decode())
|
33
prometheus-node-exporter/prometheus-node-exporter.service
Executable file
33
prometheus-node-exporter/prometheus-node-exporter.service
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.d/prometheus-node-exporter: start/stop prometheus-node-exporter daemon
|
||||
#
|
||||
|
||||
SSD=/sbin/start-stop-daemon
|
||||
PROG=/usr/bin/node_exporter
|
||||
PORT=9100
|
||||
OPTS="--collector.processes --web.listen-address=":${PORT}" --web.config=/etc/node-exporter/config.yml"
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
$SSD --start -b --exec $PROG -- $OPTS ;;
|
||||
stop)
|
||||
$SSD --stop --retry 10 --exec $PROG ;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
$SSD --status --exec $PROG
|
||||
case $? in
|
||||
0) echo "$PROG is running with pid $(pidof $PROG)" ;;
|
||||
1) echo "$PROG is not running but the pid file $PID exists" ;;
|
||||
3) echo "$PROG is not running" ;;
|
||||
4) echo "Unable to determine the program status" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 [start|stop|restart|status]" ;;
|
||||
esac
|
||||
|
||||
# End of file
|
Loading…
x
Reference in New Issue
Block a user