GICT knowledge base
How to Install Monit on CentOS 7?
Published
How to Install Monit on CentOS 7?
Monit is an open source process tool for Linux operating system which helps you to monitor system process using a web browser and also whenever requires it automatically do the maintenance or repair of the particular process in such a way that it can be brought back online. Monit can also be used for managing and monitoring of programs, files directories, and devices for timestamps changes, checksum changes, or size changes. The main advantage of Monit is it conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. In this let’s have a look at the installation of Monit.
1) Always it is a good practice to follow before any new installations make sure that the currently installed packages are up to date.
# yum update all
2) Before the installation of Monit, clear the dependencies by installing the following.
# yum install epel-release -y
3) Now let’s install Monit.
# yum install monit -y
4) After the installation, edit the Monit configuration file with your favorite text editor which resides at “/etc/monit.conf”. In this file, you have to enter the preferred Monit username and password and also make the necessary tweaks you prefer which will be like the following.
set httpd port 2812 and # set the listening port to your desire. The default is 2812 (if setting custom port, make sure it does not overlap with some other service’s listening port)
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
allow user:’password’ # require user ‘user’ with password ‘password’
allow @monit # allow users of group ‘monit’ to connect (rw)
#allow @users readonly # allow users of group ‘users’ to connect readonly
The default port number of Monit will be 2812. Either you can use it or change according to your needs.
5) After the initial configuration, you can configure some of your services you want to monitor. To configure the services you have to create separate files of every service located within the destination /etc/monit.d/. For example, I will show you how to configure the web server. Create a file inside the directory /etc/monit.d/ with your favorite text editor.
# vi /etc/monit.d/http
check process webserver with pid file /var/run/httpd/httpd.pid
group apache
start program= “/etc/init.d/httpd start”
stop program= “/etc/init.d/httpd stop”
if failed host 0.0.0.0 port 80 then restart
6) If you have finished with the desired services configuration, then test the control file for syntax errors by executing the below-mentioned command.
# monit -t
7) Then start the Monit by executing the following command.
# monit
8) Now open your web browser and access the Monit by the URL: IP address:2812. Enter the username and password which you have entered in the file monit.conf. After login, it will display the Monit monitoring page.
If you need any further help please do reach our support department.
Related guides
How to Install and Uninstall Imunify360?
In this tutorial, we can check how to install Imunify360. Imunify360 is an automated security solution with multi-layer defense architecture for Linux
CentOSInstall and Configure mod_evasive on CentOS
How to Install and Configure mod_evasive Apache on CentOS? The mod_evasive module for Apache that takes evasive action to protect Apache during the time
CentOSHow to Install Laravel on CentOS 6/7
How to Install Laravel on CentOS 6/7Laravel is a free, open-source MVC PHP web framework intended for the development of full-featured web applications.
CentOSHow to Setup and Install FirewallD on CentOS 7
How to Setup and Install FirewallD on CentOS 7. Many Linux distributions have a firewalld as their firewall management solution, and it acts as a front-end
