Page 1 of 1

Monit in docker to monitor Domoticz

Posted: Wednesday 27 November 2024 16:05
by pgas37
Hi,

I run Domoticz outside a docker-container.

i installed Monit (see Domoticz wiki) in a docker-container.

I used a small monitrc-file
cd /init.dset daemon 60
set log syslog
set httpd port 2812 and
allow admin:monit

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=com ... getversion
and content = '"status" : "OK"'
for 2 cycles
then restart
if 5 restarts within 5 cycles then exec "/sbin/reboot"
Monit works but the monitoring of Domoticz failed with status error " Execution failed | Does not exist "
Image

The docker-logs of Monit show several errors of files that does not exist, but checking the directories they DO EXIST.
a part of the log-file:
'domoticz' trying to restart
'domoticz' start: '/etc/init.d/domoticz.sh start'
'domoticz' process is not running
'domoticz' failed to start (exit status -1) -- Program /etc/init.d/domoticz.sh failed: File '/etc/init.d/domoticz.sh' does not exist
'domoticz' trying to restart
'domoticz' start: '/etc/init.d/domoticz.sh start'
'domoticz' process is not running
'domoticz' failed to start (exit status -1) -- Program /etc/init.d/domoticz.sh failed: File '/etc/init.d/domoticz.sh' does not exist
'domoticz' trying to restart
'domoticz' start: '/etc/init.d/domoticz.sh start'
'domoticz' service restarted 5 times within 5 cycles(s) - exec
Error: Could not execute /sbin/reboot
'domoticz' process is not running
Image

Is monit this way only monitoring docker-containers and not looking further?

Can anyone help?

thanks

Re: Monit in docker to monitor Domoticz

Posted: Wednesday 27 November 2024 19:06
by waltervl
IP 127.0.0.1 in the check url is a localhost IP. For the monit in the Docker container this is the localhost IP in the Docker container, not the Domoticz environment/server.

So use the real IP of the Domoticz server eg 192.168.1.67 or something similar.

Re: Monit in docker to monitor Domoticz

Posted: Thursday 28 November 2024 9:44
by Kedi
Beter run Monit standalone. Then all paths are functional.
If you use Monit in a container all paths in the config are local to the container.
A workaround is really complicated in such a case.

Re: Monit in docker to monitor Domoticz

Posted: Sunday 01 December 2024 16:26
by pgas37
Both thanks for the answer..

Change of the ip-adress did not work, Monit did not worked at all! Maybe a reinstall of monit on docker and see if it will work.

Maybe a standalone installation is THE solution here.

regards