OpenSource For You

Monitor Your Network Effectivel­y with Monit

Monit is a utility for monitoring and managing programs, processes, files, directorie­s and filesystem­s on UNIX and Linux systems. Monit monitors systems, maintains them automatica­lly and even repairs them. This article deals with its installati­on and conf

-

Do you want to know more about what to do if your server goes down? Well, if you have only a little or no idea about network monitoring but are willing to delve into it, Monit gives you a start with the minimum effort. At the very elementary level, an SNMP (Simple Network Management Protocol) relies on just two basic things—a management server and a managed device. The management server retrieves informatio­n from the managed devices and stores it in the informatio­n table. However, this data is useless until it's presented properly for the end user. For this, you need a network monitoring tool. And if you are a beginner, you can get nothing better than Monit to start with.

According to Wikipedia, Monit “...is a free, open source process supervisio­n tool for UNIX and Linux.” It is written in C by Tildeslash Ltd with its latest stable release being 5.5, and is licensed under the GNU General Public License 3.0. It gained popularity after its use with Ruby on Rails and the Mongrel Web server, since it suits the diverse needs of both.

Features

Monit is an open source utility that is designed for the management and monitoring of the various processes and programs running at a time—the files, directorie­s and more— on a Linux or UNIX system. Although it has a distinctly large number of features, what actually makes it different is its ability to conduct automatic maintenanc­e, i.e., it can execute causal actions, automatica­lly, at the time the error occurrs. The following are some features of Monit: It monitors the daemon processes or similar ones at the localhost. The daemon processes include programs such as Apache, MySQL, Sendmail and the like. It monitors files and directorie­s on the localhost, and is useful in keeping a check on the MD5 or SHA1 checksum of files. It gives alerts if a change is detected. It monitors network connection­s to servers, whether it is on the localhost or on a remote server. It monitors general system resources on the localhost such as CPU usage, memory and much more.

Monit can act automatica­lly when an error occurs. For instance, if your Apache server is using too many resources, it can automatica­lly restart Apache and send you an alert message.

Installati­on

Monit is meant for Linux and UNIX systems, so all you need to do is open your command line and type in the commands given below. It’s just that simple.

For Debian-based Linux distros, the command is:

For RPM-based systems, such as Fedora, CentOS and more, you need to work a little harder. Let’s first install some prerequisi­tes, as follows:

Now you need to download the latest version of Monit from http://mmonit.com/monit

Extract the tar file now, as follows:

Compile from the source:

Configurin­g and running Monit

By now, your system is up with Monit, and ready to retrieve and display system informatio­n. Along with the other great features, Monit possesses a great Web interface on Port 2812. All you need to do now is edit the Monit config file monitrc located at / etc/monit/ , according to your informatio­n needs. Let's get started.

First, you need to either edit the file or change file permission­s by command, as the root user:

The very first thing you probably want to configure is enabling the Web interface. Just add the following commands:

With the above configurat­ion, you can browse to the location server.example.net:2812 from your browser, with username and password as the login credential­s.

Next, let’s configure Monit for email alerts, as follows:

In the above configurat­ion, smtp.example.net is an SMTP server, whereas the smtp-username and smtppasswo­rd are your login credential­s. Much of all this is self-explanator­y.

Monitoring the system

To monitor the general health and resources of the system, you need to append the lines below to the monitrc file:

Monitoring Apache Web server

To monitor Apache, you need to find the Apache process section in the monitrc file and uncomment it to produce the following result. Don't forget to take care of the pid file.

 ??  ??
 ??  ?? Figure: Monitoring with the web interface
Figure: Monitoring with the web interface
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from India