-
-
Notifications
You must be signed in to change notification settings - Fork 1
Seeder
rgaudin edited this page Feb 3, 2025
·
2 revisions
-
Download
node_exporterand move binary to/usr/sbin/ - Add username and Group
useradd -M -U node_exporter -s /bin/nologin - Change ownership of binary
chown node_exporter:node_exporter /usr/sbin/node_exporter - Make sure its executable
chmod +x /usr/sbin/node_exporter - Create data folder
mkdir -p /var/lib/node_exporter/textfile_collector - Change data folder perms
chown -R node_exporter:node_exporter /var/lib/node_exporter/textfile_collector - Add systemd service
/etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Requires=node_exporter.socket
[Service]
User=node_exporter
ExecStart=/usr/sbin/node_exporter --web.systemd-socket --collector.textfile.directory=/var/lib/node_exporter/textfile_collector
[Install]
WantedBy=multi-user.target- Add systemd socket
/etc/systemd/system/node_exporter.socket
[Unit]
Description=Node Exporter
[Socket]
ListenStream=9100
[Install]
WantedBy=sockets.target- Reload systemd
systemctl daemon-reload - Enable and Start it
systemctl enable --now node_exporter.service && systemctl enable --now node_exporter.socket
- Install
jq:apt install jq - Download
smartmon.shscriptcurl -L -O /usr/local/bin/smartmon.sh https://raw.githubusercontent.com/micha37-martins/S.M.A.R.T-disk-monitoring-for-Prometheus/refs/heads/master/src/smartmon.sh - Make it executable
chmod +x /usr/local/bin/smartmon.sh - Install is as a systemd cron
curl -L https://raw.githubusercontent.com/micha37-martins/S.M.A.R.T-disk-monitoring-for-Prometheus/refs/heads/master/install.sh | sh
-
Download Prometheus and move binaries to
/usr/sbin/ - Add username and Group
useradd -M -U prometheus -s /bin/nologin - Change ownership of binaries
chown prometheus:prometheus /usr/sbin/{promtool,prometheus} - Make sure its executable
chmod +x /usr/sbin/{promtool,prometheus} - Create data folder
mkdir -p /var/lib/prometheus/data - Change data folder perms
chown -R prometheus:prometheus /var/lib/prometheus/data - Add
/etc/prometheus.yml
global:
scrape_interval: 60s
scrape_configs:
- job_name: node
static_configs:
- targets: ['localhost:9100']
labels:
instance: kathrin.kiwix.org
remote_write:
- url: 'https://prometheus-prod-24-prod-eu-west-2.grafana.net/api/prom/push'
basic_auth:
username: '1172000'
password: 'glc_xxxxxxxxxxxxxxxxxxxxxxx'The password here must be obtained from Grafana Cloud Add new Connection wizard. You should select Hosted Prometheus Metrics. In the Set the configuration section, choose Create a new token and one will be created (in Cloud Access Policies) and showed to you with the proper encoding (starts with glc_. Just copy that part.
- Add
/etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/usr/sbin/prometheus \
--config.file=/etc/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/data \
--storage.tsdb.retention.time=30d
[Install]
WantedBy=multi-user.target- Reload systemd
systemctl daemon-reload - Enable and Start it
systemctl enable --now prometheus.service