
Install Monit
Monit is een open-source programmatje om je processen automatisch in de gaten te houden.
Installatie
Open Putty of connect naar je pi op een andere mannier:
sudo apt update
sudo apt install -y monit
Kijk of de installatie gelukt is met
monit -V
sudo service monit status
sudo service monit stop
sudo service monit start
sudo service monit restart
sudo nano /etc/monit/monitrc
Vind in het bestand
set httpd port 2812
and use address [jouw intern IPadres]
# only accept connection from localhost (drop if you use M/Monit)
allow localhost
allow 0.0.0.0/0.0.0.0
# allow localhost to connect to the server and
allow admin:monit
Verander het standaard gebruikersnaam en wachtwoord.
Om de veranderingen te activeren moeten we monit herstart.
sudo service monit restart
Kijk of je IPadres/2812 werkt!
Processen in de gaten houden
Deze moet je ook in het sudo nano /etc/monit/monitrc
toevoegen (onderaan)
Domoticz
DOMOTICZ##
check process domoticz with pidfile /var/run/domoticz.pid
start program = "/usr/bin/sudo /bin/systemctl start domoticz.service"
stop program = "/usr/bin/sudo /bin/systemctl stop domoticz.service"
# use below start/stop command for older systems not using systemctl
# start program = "/etc/init.d/domoticz.sh start"
# stop program = "/etc/init.d/domoticz.sh stop"
if failed
url http://127.0.0.1:8080/json.htm?type=command¶m=getversion
and content = '"status" : "OK"'
for 2 cycles
then restart
if 5 restarts within 5 cycles then exec "/sbin/reboot"
Mosquitto en Zigbee2MQTT
##########################
# Mosquitto MQTT message broker
##########################
check process Mosquitto-Broker with match mosquitto
start program = "/bin/systemctl restart mosquitto"
stop program = "/bin/systemctl stop mosquitto"
if 5 restart within 5 cycles then exec "/sbin/reboot"
##########################
# Zigbee2MQTT
##########################
check process Zigbee2MQTT with match npm
start program = "/bin/systemctl restart zigbee2mqtt"
stop program = "/bin/systemctl stop zigbee2mqtt"
Heb je nog andere processen lopen? deze kun je ook toevoegen!