monit: error connecting to the monit daemon

10
7864

monit: error connecting to the monit daemon We’re rolling out monit on our new platform at the request of a vendor to manage their new service. I’ve always been dead against these kinds of automated failure recovery tools as they often require human intervention after the fact anyway and all the platforms I’ve managed will have failed the server anyway so why not restart the services after the root cause analysis is done? My tune is slowly changing though and I’m coming to appreciate this method of systems recovery a lot more.

Whilst playing with it though I got the following error


root@newshiny:~# monit summary
monit: error connecting to the monit daemon

What what? The daemon’s definitely running, why can’t I pole it’s status?


root@newshiny:~# ps aux | grep monit
root 325293 0.0 0.0 16440 1276 ? Sl Mar27 0:10 /usr/bin/monit
root 496627 0.0 0.0 105348 832 pts/0 S+ 11:43 0:00 grep monit
root@newshiny:~# service monit status
monit (pid 325293) is running...

After reading the documentation this monit: error connecting to the monit daemon seemed to be an epic case of rushing in to things, skimming the documentation and PEBCAK!

Solving monit: error connecting to the monit daemon

Monit can present an HTTP interface which I didn’t enable as I thought it was just for me, it turns out it’s also for the command line tools!

It’s really easy to enable, in /etc/monit.conf or wherever your conf file is located just add


set httpd port 2812 and
use address localhost
allow localhost

and restart monit with


service monit restart

and Bob’s your mother’s brother.


root@newshiny:~# netstat -lpn | grep 2812
tcp 0 0 127.0.0.1:2812 0.0.0.0:* LISTEN 325293/monit


root@newshiny:~# monit summary
The Monit daemon 5.2.5 uptime: 19h 18m

Process 'shiny_manager' running
Process 'shiny_proxy' running
Process 'shiny_server' running
System 'system_newshiny' running

Problem solved!

SHARE
Previous articleOdd Occurrences In Apache Access Logs
Next articleInstalling Magento
Hi, I'm Rus and after 10 years of Linux administration and software development, in September 2014 I quit my day job, sold all my stuff and moved to Thailand to live the good life. My new website, http://www.ruspow.com shows how I'm making money online as well as what life can be like when you're not sat behind a desk and are free to make your own decisions!
  • Hello,

    At first, I thought the same as you: the monit web interface would be useless if I don’t want to check for monit status… Now, thanks to your solution I’m able to connect to monit.

    Thanks a lot!

  • Sergio

    Thanks for sharing that tip

  • Danny

    Funny how they don’t mention that command line tools need this…along the same lines, I believe you can add another ‘allow’ line that specifies your computer’s ip address so you can access the web interface. Is that how the web interface works or no? Just remember to leave in ‘allow localhost’

  • Thanks Rus, worked a treat!

    • No problem dude. Your music sounds awesome by the way!

  • Isaac Gonzalez

    Thanks man!

  • DG

    Thank you! (Clearly I’m also too lazy to read the docs, and just bunged the error message into google…)

  • Thanks for this!

  • Bravo!

  • jonaslomholdt

    Awesome. Thanks! This worked very well.