<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Person @ CREATIVEDESK &#187; Monit</title>
	<atom:link href="http://hardik.in/tag/monit/feed/" rel="self" type="application/rss+xml" />
	<link>http://hardik.in</link>
	<description>Hardik Dalwadi</description>
	<lastBuildDate>Mon, 26 Jul 2010 19:47:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Monitor Debian server with monit</title>
		<link>http://hardik.in/2009/06/25/monitor-debian-server-with-monit/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://hardik.in/2009/06/25/monitor-debian-server-with-monit/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 19:13:05 +0000</pubDate>
		<dc:creator>Hardik Dalwadi</dc:creator>
				<category><![CDATA[Archives]]></category>
		<category><![CDATA[GNU / Linux]]></category>
		<category><![CDATA[Public]]></category>
		<category><![CDATA[Time Pass]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Monit]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://hardik.in/?p=56</guid>
		<description><![CDATA[Monit is a system monitoring utility which allows an admin to easily monitor files, processes, directories, or devices on your Debian system. It can also be used for automatic maintenance/repairs &#8211; by executing particular commands when errors arise. To ease of administration monit provide a web based monitoring interface, with SSL support. To install monit [...]]]></description>
			<content:encoded><![CDATA[<p><cite>Monit is a system monitoring utility which allows an admin to easily monitor files, processes, directories, or devices on your Debian system. It can also be used for automatic maintenance/repairs &#8211; by executing particular commands when errors arise. To ease of administration monit provide a web based monitoring interface, with SSL support. To install monit in to your Debian server, Simply use apt-get:</cite></p>
<pre>
#apt-get install monit
</pre>
<p>Once installed, you&#8217;ll find the main configuration file located at /etc/monit/monitrc. Below is sample global configuration file, which will also explain some keywords. for more information do <a href="http://mmonit.com/monit/documentation/monit.html">man monit</a></p>
<pre>
# poll at 2-minute intervals. Monit will wakeup every two minute to
# monitor things. Time must be given in seconds.
set daemon  120

#If port 25 broken for primary SMTP server,
#all alerts will redirect to secondary SMTP server or
#localhost after 15 seconds timeout.
set mailserver mail.bar.com, mail.foo.com port 10025,
    localhost with timeout 15 seconds

# You can define your mail-notification format. Do man monit
mail-format {
   from: foo@bar.com
   subject: $SERVICE $EVENT at $DATE
   message: Monit $ACTION $SERVICE at $DATE on $HOST,

   Yours sincerely,
   Foo Bar.
   }

# Make monit start its web-server. So you can access it from webrowser.
set httpd port 2812 and
use address 192.168.0.1 # or bar.com

##Monit web-server ACL.
allow localhost       # allow localhost to connect to the server and
allow 192.168.1.2     # allow 192.168.1.2 to connect to the server,
                     # You can give only one entry per line.

allow foo:bar     # user name and password for authentication.

allow bar:bar   # set multiple user to access through browser.
</pre>
<p>Below is some of the checks that can monitor the various services on the server.</p>
<pre>
check process apache with pidfile /var/run/apache2.pid
  start program = "/etc/init.d/apache2 start"
  stop  program = "/etc/init.d/apache2 stop"
  if failed host 127.0.0.1 port 80
       protocol http then restart
  if 5 restarts within 5 cycles then timeout

check process mysql with pidfile /var/run/mysqld/mysqld.pid
  group database
  start program = "/etc/init.d/mysql start"
  stop program = "/etc/init.d/mysql stop"
  if failed host 127.0.0.1 port 3306 then restart
  if 5 restarts within 5 cycles then timeout

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 port 22 protocol ssh then restart
  if 5 restarts within 5 cycles then timeout

check process named with pidfile /var/run/named.pid
  start program = "/etc/init.d/bind start"
  stop program = "/etc/init.d/bind stop"
  if failed host 127.0.0.1 port 53 type tcp then alert
  if failed host 127.0.0.1 port 53 type udp then alert
  if 5 restarts within 5 cycles then timeout

check process exim4 with pidfile /var/run/exim4/exim.pid
  start program = "/etc/init.d/exim4 start"
  stop program = "/etc/init.d/exim4 stop"
  if failed host 127.0.0.1 port 25 protocol smtp then alert
  if 5 restarts within 5 cycles then timeout

check process clamavd with pidfile /var/run/clamav/clamd.pid
  start program = "/etc/init.d/clamav-daemon start"
  stop  program = "/etc/init.d/clamav-daemon stop"
  if failed unixsocket /var/run/clamav/clamd.ctl then restart
  if 5 restarts within 5 cycles then timeout
</pre>
<p>You can also include other configuration files via include directives:</p>
<pre>
include /etc/monit/default.monitrc
include /etc/monit/mysql.monitrc
</pre>
<p>After modifying the configuration file you should check for the syntax to make sure they are correct. To do this run:</p>
<pre>
# monit -t
</pre>
<p>Now you can run monit directly:</p>
<pre>
# monit
</pre>
<p>Once monit is running you can check for activity with your web-browser. You can of course use the Debian init script to start the monitoring:</p>
<pre>
/etc/init.d/monit start
</pre>
<p>For this to work you must enable the service by changing the file /etc/default/monit:</p>
<pre>
# You must set this variable to for monit to start
startup=1

# To change the intervals which monit should run uncomment
# and change this variable.
# CHECK_INTERVALS=180
</pre>
<p>For more example of monit check the <a href="http://www.tildeslash.com/monit/">monit homepage</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardik.in/2009/06/25/monitor-debian-server-with-monit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
