Monit - Error receiving data -- Connection reset by peer ??

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
Sjonnie2017
Posts: 365
Joined: Wednesday 02 August 2017 19:43
Target OS: Linux
Domoticz version: Latest ß
Location: The Netherlands
Contact:

Monit - Error receiving data -- Connection reset by peer ??

Post by Sjonnie2017 »

Installed Monit as per instructions in the wiki. But somehow I can not get it to work properly.

Running on a Pi 3 connected to a wired network. Installation is done using default settings.

This is my log:

Code: Select all

[CEST Sep 30 15:14:02] info     : Starting Monit 5.20.0 daemon with http interface at [*]:2812
[CEST Sep 30 15:14:02] info     : Monit start delay set to 300s
[CEST Sep 30 15:19:02] info     : 'RPi3' Monit 5.20.0 started
[CEST Sep 30 15:19:04] error    : 'domoticz' failed protocol test [HTTP] at [127.0.0.1]:8080/json.htm?type=command¶m=getversion [TCP/IP] -- Connection refused
[CEST Sep 30 15:19:46] error    : Denied connection from non-authorized client [127.0.0.1]
[CEST Sep 30 15:19:46] error    : Error receiving data -- Connection reset by peer
These are my settings in the /etc/monit/monitrc (snipped to show only the information regarding Domoticz)

Code: Select all

  set daemon 300            # check services at 2-minute intervals
   with start delay 300     # optional: delay the first check by 4-minutes (by
#                           # default Monit check immediately after Monit start)
(snip)
  set mailserver smtp.gmail.com port 587
  username "[email protected]" password "PASSWORD" (of course changed it to the correct values)
  using tlsv1
  without timeout 30 seconds
  set alert [email protected] (of course changed it to the correct values)
(snip)
  set httpd port 2812 and
      use address 0.0.0.0                     # only accept connection from localhost
      allow 0.0.0.0/0.0.0.0                   # allow localhost to connect to the server and
      allow admin: monit                      # require user 'admin' with password 'monit'
(snip)
  check process domoticz with pidfile /var/run/domoticz.pid
  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&param=getversion
         and content = '"status" : "OK"'
     for 2 cycles
     then restart
  if 5 restarts within 5 cycles then exec "/sbin/reboot"
The web interface shows me "connection failed" for Domoticz.

Any help appreciated! :)

Greetz,

Sjonnie

Edit: These are the contents of the email I get from monit (so notification works ;) )

Code: Select all

Connection failed Service domoticz 

	Date:        Sat, 30 Sep 2017 15:29:06
	Action:      restart
	Host:        RPi3
	Description: failed protocol test [HTTP] at [127.0.0.1]:8080/json.htm?type=command&param=getversion [TCP/IP] -- Connection refused

Your faithful employee,
Monit
ConBee II - TRÅDFRI lights + switches, loads of ChingLing dimmers and switches, Heiman and Xiaomi sensors
SolarEdge SE4000H (with active modbus_tcp)
YouLess Energy meter
Shelly 2.5 in roller shutter mode
SweetPants

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by SweetPants »

Is 127.0.0.1 in the list of IP's that can login without username/password Setup->Settings->Local networks?
User avatar
Sjonnie2017
Posts: 365
Joined: Wednesday 02 August 2017 19:43
Target OS: Linux
Domoticz version: Latest ß
Location: The Netherlands
Contact:

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by Sjonnie2017 »

Hi,

Tx for your reply! :)

This is what I have in Local Networks in the settings:
127.0.0.*;192.168.16.*
Thought that would be enough. Is it?

Greetz,

Sjonnie
ConBee II - TRÅDFRI lights + switches, loads of ChingLing dimmers and switches, Heiman and Xiaomi sensors
SolarEdge SE4000H (with active modbus_tcp)
YouLess Energy meter
Shelly 2.5 in roller shutter mode
SweetPants

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by SweetPants »

Yes, should be enough. Can you post your monit config file?
User avatar
Sjonnie2017
Posts: 365
Joined: Wednesday 02 August 2017 19:43
Target OS: Linux
Domoticz version: Latest ß
Location: The Netherlands
Contact:

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by Sjonnie2017 »

Hi,

Tx for your continued support!

Is there another file than this one?

/etc/monit/monitrc

Because I showed the relevant contents of that file in my previous post. If you need the full contents I'll be happy to comply (need to anonimize it first though ;) )

If there is another config file please let me know.

Greetz,

Sjonnie
ConBee II - TRÅDFRI lights + switches, loads of ChingLing dimmers and switches, Heiman and Xiaomi sensors
SolarEdge SE4000H (with active modbus_tcp)
YouLess Energy meter
Shelly 2.5 in roller shutter mode
SweetPants

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by SweetPants »

For every service i use a separate .conf file in /etc/monit/conf.d

For domoticz i only check the PID like:

check process domoticz with pidfile /var/run/domoticz.pid
start program "/etc/init.d/domoticz.sh start"
stop program "/etc/init.d/domoticz.sh stop"
User avatar
Sjonnie2017
Posts: 365
Joined: Wednesday 02 August 2017 19:43
Target OS: Linux
Domoticz version: Latest ß
Location: The Netherlands
Contact:

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by Sjonnie2017 »

Hi,

Removed the "if failed ..." condition and now monit is working.

Tx! Much appreciated!

Verstuurd vanaf mijn YOGA Tablet 2-1050F met Tapatalk

ConBee II - TRÅDFRI lights + switches, loads of ChingLing dimmers and switches, Heiman and Xiaomi sensors
SolarEdge SE4000H (with active modbus_tcp)
YouLess Energy meter
Shelly 2.5 in roller shutter mode
User avatar
rolandtwilt
Posts: 74
Joined: Monday 05 October 2020 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by rolandtwilt »

I have had the same problem as above (connection reset by peer) I did 2 things to fix it:

1. Replace this:

Code: Select all

  check process domoticz with pidfile /var/run/domoticz.pid
  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&param=getversion
         and content = '"status" : "OK"'
     for 2 cycles
     then restart
  if 5 restarts within 5 cycles then exec "/sbin/reboot"
With this:

Code: Select all

check process domoticz with pidfile /var/run/domoticz.pid
start program "/etc/init.d/domoticz.sh start"
stop program "/etc/init.d/domoticz.sh stop"
and
2. this:

Code: Select all

  set httpd port 2812 and
      use address 0.0.0.0                     # only accept connection from localhost
      allow 0.0.0.0/0.0.0.0                   # allow localhost to connect to the server and
      allow admin: monit                      # require user 'admin' with password 'monit'
with:

Code: Select all

  set httpd port 2812 and
      use address <address of pi>                     # only accept connection from localhost
      allow <local network range>/255.255.255.0                   # allow localhost to connect to the server and
      allow admin: monit                      # require user 'admin' with password 'monit'
User avatar
waltervl
Posts: 5842
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by waltervl »

rolandtwilt wrote: Friday 10 September 2021 11:36 I have had the same problem as above (connection reset by peer) I did 2 things to fix it:
As described in section webservice of the wiki: https://www.domoticz.com/wiki/Monitoring_domoticz
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Monit - Error receiving data -- Connection reset by peer ??

Post by AllesVanZelf »

Have you configured Domoticz on port 8080?
Are you running Domoticz in a docker container? In that case use the network ip-address of this server/raspberry. something like 192.168.x.x or 10.x.x.x
instead of 127.0.0.1.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest