Monit in docker to monitor Domoticz

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
pgas37
Posts: 99
Joined: Wednesday 06 December 2017 19:44
Target OS: -
Domoticz version:
Contact:

Monit in docker to monitor Domoticz

Post 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
Attachments
Monit service.png
Monit service.png (16.62 KiB) Viewed 386 times
monit error.png
monit error.png (43.38 KiB) Viewed 386 times
User avatar
waltervl
Posts: 5398
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Monit in docker to monitor Domoticz

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Kedi
Posts: 564
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Monit in docker to monitor Domoticz

Post 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.
Logic will get you from A to B. Imagination will take you everywhere.
pgas37
Posts: 99
Joined: Wednesday 06 December 2017 19:44
Target OS: -
Domoticz version:
Contact:

Re: Monit in docker to monitor Domoticz

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest