2020-08-01 00:19:28 +00:00
# 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
2020-08-03 16:03:07 +00:00
apt install monit
nano -w /etc/monit/monitrc
2020-08-01 00:19:28 +00:00
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
2020-08-03 16:03:07 +00:00
cat > /etc/monit/conf.d/rootfs < < EOF
2020-08-01 00:19:28 +00:00
check filesystem rootfs with path /
if space usage > 80% then alert
EOF
2020-08-03 16:03:07 +00:00
cat > /etc/monit/conf.d/tankfs < < EOF
2020-08-01 00:19:28 +00:00
check filesystem tankfs with path /tank
if space usage > 80% then alert
EOF
2020-08-03 16:03:07 +00:00
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"
2020-08-01 00:19:28 +00:00
if does not exist then alert
if does not exist for 2 cycles then restart
EOF
systemctl enable --now monit
2020-08-03 16:03:07 +00:00
systemctl restart monit
2020-08-01 00:19:28 +00:00
firewall-cmd --zone=public --permanent --add-port=2812/tcp
firewall-cmd --reload
```