2812 port not work for monit

December 20, 2014 12.3k views

hello i got mysql down problem evrytime i install monit and i open port 2812 but i cant access to my http://ipaddress:2812
i already open 2812 port but not work ? help please
or give me any solution to make mysql restart automaticly when down

 sudo netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      834/dovecot
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      834/dovecot
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1132/apache2
tcp        0      0 188.226.192.232:53      0.0.0.0:*               LISTEN      853/named
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      853/named
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      753/sshd
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1021/master
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      853/named
tcp        0      0 127.0.0.1:2812          0.0.0.0:*               LISTEN      3390/monit
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN      834/dovecot
tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      1021/master
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      893/mysqld
tcp6       0      0 :::21                   :::*                    LISTEN      1076/proftpd: (acce
tcp6       0      0 :::22                   :::*                    LISTEN      753/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      1021/master
udp        0      0 188.226.192.232:53      0.0.0.0:*                           853/named
udp        0      0 127.0.0.1:53            0.0.0.0:*                           853/named
2 Answers

In your netstat output, we can see that port 2812 is listening on localhost (127.0.0.1):

tcp        0      0 127.0.0.1:2812          0.0.0.0:*               LISTEN      3390/monit

In order to make it accessible from the outside, we must edit the file /etc/monit/monitrc and find the section that looks like:

## Monit has an embedded web server which can be used to view status of
## services monitored and manage services from a web interface. See the
## Monit Wiki if you want to enable SSL for the web server.
#
# set httpd port 2812 and
#    use address localhost  # only accept connection from localhost
#    allow localhost              # allow localhost to connect to the server and
#   allow admin:moinit        # require user 'admin' with password 'monit'

and change it to look like:

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

For the changes to take effect, run sudo reload monit

  • thank you asb thats what i do and its work fine now

  • Looks like @kamaln7 beat me to it. Guess I need to refresh the page before posting. Too many open tabs. =)

  • :) thats nice i wish you be the first to answer my seconde question :)
    do you have any idea why i go mysql.stock error every 5 min or less i have droplet with 2 gb and 40 gb disck space only use 8 % from ram why ubuntu mysql everytime down
    Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    ? thx

Hi,

The problem here is that monit is listening on the loopback interface (127.0.0.1) so it's not accessible externally. To fix that, you need to configure it to listen on the public interface (your droplet's public IP address) instead.

Edit /etc/monit/monitrc and replace use address 127.0.0.1 with use address 12.34.56.789 where 12.34.56.789 is your droplet's IP address.

Then, reload monit:

sudo reload monit
  • thank you its fixed now
    do you have any idea why i go mysql.stock error every 5 min or less i have droplet with 2 gb and 40 gb disck space only use 8 % from ram why ubuntu mysql everytime down ? thx

Have another answer? Share your knowledge.