Tuesday, September 18, 2012

Utility for automatic management and monitoring of Information Technology Systems

Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You can use Monit to monitor files, directories and filesystems for changes, such as timestamps changes, check-sum changes or size changes. You can also monitor remote hosts; Monit can ping a remote host and can check TCP/IP port connections and server protocols. Monit is controlled via an easy to use control file based on a free-format, token-oriented syntax. Monit logs to syslog or to its own log file and notifies you about error conditions and recovery status via customizable alert.

Monit Features
 * Daemon mode - poll programs at a specified interval
 * Monitoring modes - active, passive or manual
 * Start, stop and restart of programs
 * Group and manage groups of programs
 * Process dependency definition
 * Logging to syslog or own log file
 * Configuration - comprehensive control file
 * Run-time and TCP/IP port checking (tcp and udp)
 * SSL support for port checking
 * Unix domain socket checking
 * Process status and process timeout
 * Process cpu usage
 * Process memory usage
 * Process zombie check
 * Check the systems load average
 * Check a file or directory timestamp
 * Alert, stop or restart a process based on its characteristics
 * MD5 checksum for programs started and stopped by monit
 * Alert notification for program timeout, restart, checksum, stop resource and timestamp error
 * Flexible and customizable email alert messages
 * Protocol verification. HTTP, FTP, SMTP, POP, IMAP, NNTP, SSH, DWP,LDAPv2 and LDAPv3
 * An http interface with optional SSL support to make monit accessible from a web browser

Monit Installation:
Open the terminal and type following command to install Monit 
sudo apt-get install monit
Configuring Monit:
Default configuration file located at /etc/monit/monitrc you need to edit this file to configure your systems and services. The default /etc/monit/monitrc has lots of examples, and you can find more configuration examples on http://www.tildeslash.com/monit/doc/examples.php.

Here is the sample for controlling sshd server
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/ssh start"
stop program "/etc/init.d/ssh stop"
if failed host 127.0.0.1 port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
here, you also need to set monit as daemon, un-comment the following line in monit configuration file:
set daemon 120
After making all the necessary in the monit configuration file you should check for the syntax to make sure they are correct. To do this run:
sudo monit -t
Monit provides a built-in HTTP(S) interface (port number 2812) and you can use a browser to access the Monit server. Now point your browser to http://yourserverip:2812/ (make sure port 2812 isn’t blocked by your firewall), log in with username: admin and password: monit and you should see something like ...



Read more: http://linuxpoison.blogspot.com/2011/06/utility-for-automatic-management-and.html#ixzz26ojprZm0

0 comments: