micha37-martins / S.M.A.R.T-disk-monitoring-for-Prometheus

Prometheus node_exporter text_collector for S.M.A.R.T disk values
Apache License 2.0
92 stars 26 forks source link

Systemd configuration instead of using Cron #12

Closed l-ucky closed 1 month ago

l-ucky commented 1 year ago

Arch Linux doesn't use cron by default, so I wrote a systemd timer.

Below is: /etc/systemd/system/smartmonitor.service

[Unit]
Description=S.M.A.R.T Monitor script and textfile_collector for Grafana
After=multi-user.target

[Service]
Type=forking
ExecStart=/usr/bin/env bash /usr/local/bin/smartmon.sh > /var/lib/node_exporter/textfile_collector/smart_metrics.prom
WorkingDirectory=/var/lib/node_exporter/textfile_collector/

[Install]
WantedBy=multi-user.target

Below is: /etc/systemd/system/smartmonitor.timer

[Unit]
Description=Run S.M.A.R.T script and collect data for grafana

[Timer]
OnBootSec=15min
OnUnitActiveSec=240min

[Install]
WantedBy=timers.target
micha37-martins commented 1 month ago

Thanks for your input! I implemented your suggestion in an install script.