<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Chris Brentano's Blog</title>
    <link>http://openmanagement.org/blogs/chris.brentano</link>
    <description>I can haz open source?</description>
    <pubDate>Mon, 31 Dec 2007 18:02:34 GMT</pubDate>
    <generator>Clearspace 2.0.2 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2007-12-31T18:02:34Z</dc:date>
    <item>
      <title>One of my favorite little monitoring apps: Monit</title>
      <link>http://openmanagement.org/blogs/chris.brentano/2007/12/31/one-of-my-favorite-little-monitoring-apps-monit</link>
      <description>&lt;div class='jive-rendered-content'&gt;&lt;p&gt;Monit is a great little monitoring tool that I really like for it's simplicity and flexibility in monitoring local services like sshd, Apache, MySQL and others. It's quick to setup and use as well.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Requires gcc, flex, &amp;amp; bison, so if the configure script bitches about flex, yacc or not finding a C compiler, then just install those via yum/apt/etc.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;1. Download the latest source: &lt;/span&gt;&lt;a class="jive-link-external-small" dynsrc="#" href="http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz" lowsrc="#" src="#"&gt;http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz&lt;/a&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;2. Extract the archive&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;3. ./configure&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;4. make&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;5. sudo make install&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;By default it installs the binary in &lt;strong&gt;/usr/local/bin/monit&lt;/strong&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It won't run without a config file. The default location is &lt;strong&gt;/etc/monitrc&lt;/strong&gt; -- here's a sample config:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code"&gt;# Monit control file

set daemon 120
set logfile syslog facility log_daemon
set mailserver mail.host.com
set alert you@host.com

set httpd port 3024 address server.host.com
allow 10.56.201.0/255.255.254.0
allow username:password

# sshd checking
check process sshd with pidfile /var/run/sshd.pid
start = "/etc/init.d/sshd start"
stop = "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout

# mysqld checking
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
start = "/etc/init.d/mysqld start"
stop = "/etc/init.d/mysqld stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout
&lt;/code&gt;&lt;/pre&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So these settings do the following:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Checks sshd and mysqld every 120 seconds, and will attempt to restart them if they aren't responding&lt;/p&gt;&lt;/li&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Logs to syslog&lt;/p&gt;&lt;/li&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;&lt;span&gt;Alerts &lt;/span&gt;&lt;a class="jive-link-email-small" dynsrc="#" href="mailto:you@host.com" lowsrc="#" src="#"&gt;you@host.com&lt;/a&gt;&lt;span&gt; if anything is amiss&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Runs a httpd process on port 3024, using simple authentication (User: username, Pass: password)&lt;/p&gt;&lt;/li&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Only allows hosts in the 10.56.201/23 network to connect (you'd change this to your network).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Note: &lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Make sure to change the hostname here to match the machine it's running on.&lt;/p&gt;&lt;/li&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;The http server is purely optional. It allows you to easily check on monitored services from your browser and restart them if necessary.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This file needs to be owned by root and chmod'ed 700 -- monit will complain if it isn't.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;You can find more info on checking specific processes at &lt;/span&gt;&lt;a class="jive-link-external-small" dynsrc="#" href="http://www.tildeslash.com/monit/index.php" lowsrc="#" src="#"&gt;http://www.tildeslash.com/monit/index.php&lt;/a&gt;&lt;span&gt; -- and there's lots of stuff on teh Google.&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In the monit-4.10.1/contrib folder is a file named rc.monit -- you can copy this to /etc/init.d and then install it as a service (on Fedora/RHEL/CentOS) with:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code"&gt;
chkconfig --add monit
chkconfig --level 3 monit on
service monit start
&lt;/code&gt;&lt;/pre&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Just edit the file to point to the correct monit binary (/usr/local/bin/monit), resave it as "&lt;strong&gt;monit&lt;/strong&gt;", copy it to /etc/init.d, and then chown root, chmod 755.&lt;/p&gt;&lt;/div&gt;</description>
      <category domain="http://openmanagement.org/blogs/chris.brentano/tags">monit</category>
      <category domain="http://openmanagement.org/blogs/chris.brentano/tags">logging</category>
      <category domain="http://openmanagement.org/blogs/chris.brentano/tags">tildeslash</category>
      <pubDate>Mon, 31 Dec 2007 18:09:48 GMT</pubDate>
      <author>chris.brentano</author>
      <guid>http://openmanagement.org/blogs/chris.brentano/2007/12/31/one-of-my-favorite-little-monitoring-apps-monit</guid>
      <dc:date>2007-12-31T18:09:48Z</dc:date>
      <clearspace:dateToText>10 months, 3 weeks ago</clearspace:dateToText>
      <wfw:comment>http://openmanagement.org/blogs/chris.brentano/comment/one-of-my-favorite-little-monitoring-apps-monit</wfw:comment>
      <wfw:commentRss>http://openmanagement.org/blogs/chris.brentano/feeds/comments?blogPost=1048</wfw:commentRss>
    </item>
  </channel>
</rss>

