How to Install and Setup Monit Ubuntu/Debian and RHEL/CentOS - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Thursday, October 24, 2019

How to Install and Setup Monit Ubuntu/Debian and RHEL/CentOS

How to Install and Setup Monit (Linux Process, Services Monitoring, Easy, proactive monitoring of processes, programs) in Redhat Linux, CentOS, Fedora & Ubuntu, Linux Mint & Debian.


What Monit can do ?

Monit has a ability to start a process if it is not running, restart a process if not responding and stop a process if uses high resources. Additionally you can also use Monit to Monitor files, directories and filesystems for changes, checksum changes, file size changes or timestamp changes. With Monit you can able to monitor remote hosts TCP/IP port, server protocols and ping. Monit keeps its own log file and alerts about any critical error conditions and recovery status.

Installing Monit
Step1 :- yum install monit           --> [RedHat/CentOS/Fedora]
Step2 :- sudo  apt-get install monit --> [Ubuntu/Debian/Linux Mint]

Configuring Monit
Step3 :-  vi /etc/monit.conf      --> [RedHat/CentOS/Fedora]
Step3 :-  sudo vi /etc/monit/monitrc   --> [Ubuntu/Debian/Linux Mint]

Next, uncomment
add the IP address or domain name of your server
set httpd port 2812 and

Start the Monit
Step4 :- sudo /etc/init.d/monit start

http://localhost:2812” or “http://example.com:2812“ or ip address also can use



Adding Monitoring Services
Step5 :-  vi /etc/monit.conf         --> [RedHat/CentOS/Fedora]
Step5 :- sudo vi /etc/monit/monitrc   --> [Ubuntu/Debian/Linux Mint]

Apache
Apache2
Nginx
MySQL
SSHD

Errors :- When you get message like “Control file syntax OK“,

Step6 :- monit -t        --> [RedHat/CentOS/Fedora]
        monit reload
       monit start all
Step6 :- sudo monit -t   --> [Ubuntu/Debian/Linux Mint]

start the monit service.
Step7 :- /etc/init.d/monit restart      --> [RedHat/CentOS/Fedora]
Step7 :- sudo /etc/init.d/monit restart --> [Ubuntu/Debian/Linux Mint]

checking log file
Step8 :- tail -f /var/log/monit          --> [RedHat/CentOS/Fedora]
Step8 :- sudo tail -f /var/log/monit.log --> [Ubuntu/Debian/Linux Mint]