VPS & omat palvelimet (verkkohotellihallintakeskus) Ohje

How to Install the Monit Monitoring Tool on CentOS

monit is a utility for managing and monitoring a host of functions of Unix systems, including monitoring processes, programs, files, directories, filesystems and more. I found setting up monit to be pretty straightforward, and it gave me the ability to see what was happening in various corners of my server. Most notably, after setting up monit, I was able to access all of this information via a simple web interface, enabling me to keep an eye on my environment from anywhere (including from my smartphone, using my phone's browser).

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 10 min
RELATED PRODUCTS CentOS-based VPS or dedicated servers

RECIPE

Here is a quick tutorial on how to install Monit on CentOS 6.5.

Install Monit

wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install monit

Enable Monit's Web interface

cd /etc
nano monit.conf

Scroll down and uncomment and update these lines

set httpd port 2812
use address xxx.xxx.xxx.xxx # only accept connection from localhost, replace x's with your ip address
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
allow @monit # allow users of group 'monit' to connect
allow @users readonly # allow users of group 'users' to connect readonly

Save the configuration file and exit.

Now, start Monit by entering:

service monit start

The system should return

Starting monit: monit: generated unique Monit id...

Verify and test your configuration

Bring up a web browser and go to http://your server's URL or IP address:2812

You can log in to the monitoring screen with the username and password you set in the configuration file above.

Monitoring particular processes

You can also monitor particular processes using Monit such as Apache and MySQL. Here is how you can enable monitoring of Apache.

cd /etc
nano monit.conf

Scroll down and uncomment and update these lines in the configuration file

check process apache with pidfile /usr/local/apache/logs/httpd.pid
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"

Restart Monit

service monit restart

You can now check the status of the service using http://your server's URL or IP address:2812

Note: As a courtesy, we provide information about how to use certain third-party products, but we do not endorse or directly support third-party products and we are not responsible for the functions or reliability of such products. Third-party marks and logos are registered trademarks of their respective owners. All rights reserved.


Oliko tästä artikkelista hyötyä?
Thanks for your feedback. To speak with a customer service representative, please use the support phone number or chat option above.
Kiva, että meistä oli apua. Voimmeko tehdä jotain muuta?
Olen pahoillani asiasta. Tell us what was confusing or why the solution didn’t solve your problem.