Skip to main content

Node Exporter

Installation

apt install prometheus-node-exporter

Basis Config

Implementierung von Self-Signed SSL with Snakeoil cert and basic user auth.

mkdir -p /etc/prometheus-node-exporter
password=`openssl rand -base64 32`
passwordHashed=`echo ${password} | htpasswd -inBC 10 "" | tr -d ':\n'`
echo "Clear password to keep for Prometheus Server: ${password}"

adduser prometheus ssl-cert
cat << "EOF" > /etc/default/prometheus-node-exporter
# Set the command-line arguments to pass to the server.  
# Due to shell escaping, to pass backslashes for regexes, you need to double  
# them (\\d for \d). If running under systemd, you need to double them again  
# (\\\\d to mean \d), and escape newlines too.  
ARGS="--web.config.file="/etc/prometheus-node-exporter/configuration.yml""
EOF

cat << EOF > /etc/prometheus-node-exporter/configuration.yml
tls_server_config:  
  cert_file: /etc/ssl/certs/ssl-cert-snakeoil.pem
  key_file: /etc/ssl/private/ssl-cert-snakeoil.key
basic_auth_users:
  prometheus: ${passwordHashed}

EOF

restart service: systemctl restart prometheus-node-exporter