piframe/docs/monit.md

36 lines
1.2 KiB
Markdown

# System Monitoring
The below commands will setup ```monit``` to track key elements of the PiFrame hardware and software. ```monit``` is a very light weight monitoring solution and is used to ensure key parts of the system are in a reasonable state and working.
``` sh
apt install monit
nano -w /etc/monit/monitrc
set httpd port 2812 and
use address 0.0.0.0
allow admin:monit
set mailserver domain.tld port 587
username "piframe@domain.tld" password "apassword"
using tls
cat > /etc/monit/conf.d/rootfs <<EOF
check filesystem rootfs with path /
if space usage > 80% then alert
EOF
cat > /etc/monit/conf.d/tankfs <<EOF
check filesystem tankfs with path /tank
if space usage > 80% then alert
EOF
cat > /etc/monit/conf.d/fim <<EOF
check process fim matching /usr/bin/fim
start program = "/usr/bin/systemctl start fim"
stop program = "/usr/bin/systemctl stop fim"
if does not exist then alert
if does not exist for 2 cycles then restart
EOF
systemctl enable --now monit
systemctl restart monit
firewall-cmd --zone=public --permanent --add-port=2812/tcp
firewall-cmd --reload
```