piframe/docs/monit.md

1.2 KiB

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.


pacman -S monit
mkdir /etc/monit.d
nano -w /etc/monitrc
    include /etc/monit.d/*
    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.d/rootfs <<EOF
check filesystem rootfs with path /
    if space usage > 80% then alert
EOF
cat > /etc/monit.d/tankfs <<EOF
check filesystem tankfs with path /tank
    if space usage > 80% then alert
EOF
cat > /etc/monit.d/feh <<EOF
check process feh matching /usr/bin/feh
    start program = "/usr/bin/systemctl start greetd"
    stop program = "/usr/bin/systemctl stop greetd"
    if does not exist then alert
    if does not exist for 2 cycles then restart
EOF
systemctl enable --now monit
firewall-cmd --zone=public --permanent --add-port=2812/tcp
firewall-cmd --reload