Monit is a small Open Source utility for managing and monitoring Unix systems. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. Monit package is easily available for all Unix/Linux/OpenBSD/OSX/FreeBSD distributions. You can use Monit to monitor daemon processes or similar programs running on localhost i.e. on your Kali Linux machine.
Monit is particularly useful for monitoring daemon processes, such as those started at system boot time from /etc/init/ For instance sendmail, sshd, apache and mysql etc. You can also use Monit to monitor files/directories/filesystems/timestamps changes/checksum changes/size changes etc.
You can easily set the Alert system while using Monit tool. Finally, Monit can be used to monitor general system resources on localhost such as overall CPU usage, Memory and Load Average.
Installation of Monit –
You can easily install Monit from the repository itself by typing “apt-get install monit” in your Linux machine terminal.
To check the status of monit tool, please type “service monit status“, which it will show the output something like this:
After that, the config file of this tool is located at /etc/monit/monitrc which you can easily edit via any text editor. Here we are trying to edit this file via Gedit by typing “gedit /etc/monit/monitrc“.
Now next step is to activate the web interface section for this monit tool so that you can easily monitor all the activities through web interface. To activate web interface, you need to edit same config file (/etc/monit/monitrc) and find the line “set httpd port 2812 and” and “allow admin:monit“, both lines are commented by default, you just need to remove the (#) sign in front of these two lines and save it.
The web interface allows you to check Monit reports from browser. This is useful when setting up and testing monit. Now access http://localhost:2812/ and the Monit web interface should open up with default username – admin and password – monit.
The whole idea behind monit is to get alerted whenever something unexpected occurs. Monit can automatically send out emails. Find the line “set alert” and specify the email where you want the reports to be delivered.
Monit by default sends out emails for every thing it does or everything that happens. For example when monit starts. However we want only the alert specific emails. Modify the configuration as follows
To simply check the status of monit, you can type “monit status” in your terminal.
Furthermore, there are alot of things which you can do with monit tool like monitoring http service on port 80, monitoring logs, monitor any website status, monitor Apache web server and monitor ports, all these services you can easily enabled through configuration file which we edited above.