2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-13 03:05:34 +00:00

contrib/init-scripts: example config for monit

git-svn-id: https://svn.fhem.de/fhem/trunk@16538 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2018-04-02 20:06:41 +00:00
parent 3b58d35b11
commit 7fd25a0306

View File

@ -0,0 +1,24 @@
# Example /etc/monitrc for FHEM
#
# REQUIRED PREPARATION:
#
# mkdir -p /var/run/fhem
# chown fhem:fhem /var/run/fhem
# echo "attr global pidfilename /var/run/fhem/fhem.pid" >> /opt/fhem/fhem.cfg
# echo "define cmd_knock cmdalias knock AS { \"hello.\" }" >> /opt/fhem/fhem.cfg
# echo "attr cmd_knock comment Monit process monitoring" >> /opt/fhem/fhem.cfg
# /usr/local/bin/perl fhem.pl 7072 shutdown restart
set daemon 60
set log syslog
set httpd port 2812 and
allow localhost
allow admin:monit
check process fhem.pl with pidfile /var/run/fhem/fhem.pid
start = "/bin/sh -c 'cd /opt/fhem; /usr/local/bin/perl fhem.pl fhem.cfg'" as uid "fhem" and gid "fhem"
stop = "/bin/sh -c 'cd /opt/fhem; /usr/local/bin/perl fhem.pl 7072 shutdown || kill -9 `cat /var/run/fhem/fhem.pid`'" as uid "fhem" and gid "fhem"
if failed host 127.0.0.1 port 7072 with send "knock\n" expect "hello." timeout 20 seconds then restart
if cpu usage > 90% for 10 cycles then restart
if 5 restarts with 5 cycles then timeout