You Are Here: Home » How-To » Tech

How To Enable Monit Web Interface From All IPs and Change Port?

By on January 2nd, 2013 
Advertisement

Monit is a nifty tool for Linux platforms that lets you manage and monitor processes, programs, services and a whole lot of parameters on a Linux server and lets you set alerts  using which stay up-to-date about your server's functioning when you are not around. Using, Monit you can also set failed or crashed processes to re-start automatically.

In this article we will talk about three things which you should to after installing and setting up Monit on your system in order to get access to your system / server's monitoring status from any remote location when you are away.

Monit config file detail

Monit config file detail

Enable And Start Monit Web Interface

Step 1: Open the Monit configuration file /etc/monit/monitrc

Step 2: Scroll down to around line number 118 where it reads:

set httpd port 2812 and

Step 3: Un-Comment the line below that line, the line which you need to un-comment is (line 119):

use address localhost

Step 4: Now save the file and restart monit. You will now be able to access the web interface of monit via http://localhost:2812. However, this configuration only lets you access Monit from the same computer where Monit is currently running.

Access Monit From Any External Host or IP Address

In the last step we showed you that Monit web interface is currently running only from the localhost. In order to access it from any external computer network or to allow access to the web interface from all IPs , you need to do the following:

Step 1: Update the line  set httpd port 2812 andchange it to set httpd port 2812 

Step 2: Un-comment the following line:

allow admin:monit

Save your settings and Restart Monit. You will now be able to access monit from any where in the world using your server's IP address. For eg. http://xx.yy.zz.cc:2812

Change Monit Default Port

By Default the Monit web interface is served on port number 2812. Since this is a well known fact, you should probably change it to a more uncommon port which cannot be easily guessed by others. But, when you change the port number, make sure you do not choose the following: 80, 443, 22, 21, 8080 and some other already in use port number.

In order to change the default port, you have to change the number 2812 in line number 118 in the file /etc/monit/monitrc to some number other than 2812 and the ones mentioned above.

set httpd port 2812 and

Make sure you save your changes and restart monit.

Set Username & Password for Monit Web Interface

An additional security measure to take while using the Monit Web Interface is to enable the username / password based login. You can set an username and a password so that the access to this portal is not available to anyone except the ones who know these credentials.

In around line 121 in the monit config file, un-comment the following line:

 #    allow admin:monit

Here, admin is the username and monit is the password. You need to change these to any username and password of your choice. After which, you can save the Monit configuration file and restart Monit.

Advertisement



Related Posts by Tags: , , , , ,





How To Enable Monit Web Interface From All IPs and Change Port? was originally published on Digitizor.com on January 2, 2013 - 12:11 pm (Indian Standard Time)