7

after installing monit when i do monit status myproc i get "error connecting to the monit daemon"

I read somewhere that

The status command won't work in the case that monit is running indaemon mode without its http support - the command 'monit status' in such case tries to get the status from the daemon via http/tcp. To start the http interface you need to add the 'set httpd ...' statement to theconfiguration.

is that still correct? that post was from 2005

7 Answers 7

14

I was struggling to setup monit on my ubuntu server and here are a few things to check:

  • Make sure that you set startup=1 in /etc/default/monit
  • Make sure to un-comment the httpd parameters in /etc/monit/monitrc

One last "gotcha" in /etc/monit/monitrc:

set daemon  120           # check services at 2-minute intervals
#  with start delay 240  # optional: delay the first check by 4-minutes (by
#                           # default Monit check immediately after Monit start)

I had the "with start delay 240" line un-commented at first. It appears that the httpd server will not start immediately if you use this option. It took me awhile to realize why monit was running but the httpd server was not.

2
  • Note - the http parameters must be uncommented even to view a summary from the command line using i.e. sudo monit summary
    – Troy
    Feb 12, 2013 at 5:35
  • Yeah, but the annoying part is that is says Starting Monit 5.9 daemon with http interface at at var/log/monit.log right after monit is started, this is misleading.
    – TCB13
    May 24, 2015 at 18:55
12
 set httpd port 2812 and
  use address 0.0.0.0
  allow 0.0.0.0/0.0.0.0
  allow admin:monit

I think this is better,it will add a web page to see the monit result,and the user name and password is admin and monit.

3

In order to make this work, you have to set the monit httpd process to allow connections from localhost.

In your config file, you should uncomment the line that says allow localhost and restart monit.

2

I'v added this lines my conf file

set httpd port 2812 and
use address localhost
allow localhost
1

Make sure you have enabled the HTTP daemon and added allow localhost. There's a write up on how to correctly configure monit to avoid this error here.

1

I got: Cannot create socket to [localhost]:2812 -- Connection refused

until I rebooted the VM.. as in windows: reboot is good after installing monit

1
  • There's got to be a better way.
    – chicks
    May 25, 2017 at 15:27
0

I got: Cannot create socket to [localhost]:2812 -- Connection refused

On ubuntu 20.04... until I udated the monitrc file to set the httpd settings and then ran:

sudo systemctl restart monit.service

This last part was key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .