Systems metrics

tested on slackware current (oct 2020)

binaries

wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
tar xzf node_exporter-1.0.1.linux-amd64.tar.gz
cp node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/bin/

grep ^node /etc/group
grep ^node /etc/passwd

groupadd -g 32760 nodeusr
useradd -u 32760 -g nodeusr --system -d /var/tmp -M -s /sbin/nologin nodeusr

from source

make sure you’ve got a GO compiler in place

slackpkg install gcc-go

switch all gcc packages from v9 to v10 (testing)

slackpkg update
slackpkg upgrade ...

proceed

go get github.com/godbus/dbus
go get github.com/prometheus/node_exporter

cd /root/go/src/github.com/prometheus/node_exporter/
make

Ready to go

enable at startup

vi /etc/rc.d/rc.local

echo -n node_exporter...
chsh -s /bin/ksh nodeusr >/dev/null 2>&1
su -c "nohup /usr/local/bin/node_exporter --web.listen-address=127.0.0.1:9100 >> /var/tmp/nodeusr.log 2>&1 &" - nodeusr && echo done || echo FAIL
chsh -s /sbin/nologin nodeusr >/dev/null 2>&1
echo

status

ps auxww | grep node_exporter

stop

pkill node_exporter

Reverse-proxy

cd /etc/nginx/conf.d/
vi nodeusr.conf

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name VHOST.nethence.com;
    #without includeSubDomains
    add_header Strict-Transport-Security "max-age=31536000" always;

    ssl_certificate     /etc/dehydrated/certs/nethence_com/fullchain.pem;
    ssl_certificate_key /etc/dehydrated/certs/nethence_com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:9100;
        #proxy_set_header Host $http_host;
        #proxy_set_header X-Forwarded-Proto https;

        auth_basic "Restricted area";
        auth_basic_user_file htpasswd;
    }

    location = /robots.txt          { access_log off; log_not_found off; }
    location = /favicon.ico         { access_log off; log_not_found off; }
    location ~ /apple-touch-icon    { access_log off; log_not_found off; }
}

Acceptance

curl -i .../metrics

Tuning

sysctl kernel.perf_event_paranoid
sysctl -w kernel.perf_event_paranoid=0

Resources

https://github.com/lovoo/xenstats_exporter

https://blog.debugo.fr/tuto-monitoring-prometheus-partie-2-node-exporter/

https://docs.gitlab.com/ee/administration/monitoring/prometheus/node_exporter.html

https://prometheus.io/docs/guides/node-exporter/

https://prometheus.io/download/#node_exporter

https://github.com/prometheus/node_exporter/blob/master/https/README.md

https://github.com/prometheus/node_exporter


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun