<?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>AnyHosting &#187; monitoring</title>
	<atom:link href="http://anyhosting.com/blog/category/monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://anyhosting.com/blog</link>
	<description>It&#039;s all about the web</description>
	<lastBuildDate>Sat, 10 Apr 2010 03:35:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>monitoring ubuntu web servers with nagios3</title>
		<link>http://anyhosting.com/blog/2009/10/17/monitoring-ubuntu-web-servers-with-nagios3/</link>
		<comments>http://anyhosting.com/blog/2009/10/17/monitoring-ubuntu-web-servers-with-nagios3/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 01:41:28 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[monitoring]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=114</guid>
		<description><![CDATA[I have chosen Nagios to keep track of the anyhosting.com network. There are many alternatives (some I have explored and some not yet), what I like about Nagios: I&#8217;ve been using it for a long time; familiarity very simple/powerful plugin system tons of users, so lots of examples and plugins already available Nagios version 3 [...]]]></description>
			<content:encoded><![CDATA[<p>I have chosen <a href="http://nagios.org">Nagios</a> to keep track of the <a href="http://anyhosting.com">anyhosting.com</a> network. There are <a href="http://www.zabbix.com/">many</a> <a href="http://mmonit.com/monit/">alternatives</a> (some I have explored and some not yet), what I like about Nagios:</p>
<ul>
<li>I&#8217;ve been using it for a long time; familiarity</li>
<li>very simple/powerful plugin system</li>
<li>tons of users, so lots of examples and plugins already available</li>
</ul>
<p>Nagios version 3 is provided in the Ubuntu repositories, and is quite simple to install:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>admin:~<span style="color: #666666; font-style: italic;"># apt-get install nagios3</span></div></div>
<p>The default config comes set up to monitor a set of services on localhost; I don&#8217;t really like the default Ubuntu/Debian setup of having one config file per host/service/etc, so on the master I&#8217;ve replaced the config file structure:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>admin:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #666666; font-style: italic;"># cd /etc/nagios3/conf.d/</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>admin:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #666666; font-style: italic;"># ls</span><br />
contacts.cfg  extinfo.cfg  groups.cfg  hosts.cfg  services.cfg  <br />
timeperiods.cfg</div></div>
<p>groups.conf contains the set of server types that I care about:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># A list of your web servers<br />
define hostgroup {<br />
&nbsp; hostgroup_name  http-servers<br />
&nbsp; alias           HTTP servers<br />
&nbsp; members         localhost<br />
}<br />
<br />
# A list of your mysql servers<br />
define hostgroup {<br />
&nbsp; hostgroup_name  mysql-servers<br />
&nbsp; alias           MySQL servers<br />
}<br />
<br />
# A list of your VHosts<br />
define hostgroup {<br />
&nbsp; hostgroup_name  http-vhosts<br />
&nbsp; alias           Virtual Host HTTP servers<br />
}</div></div>
<p>Note that the &#8220;http-servers&#8221; can define &#8220;members&#8221; (localhost in this case), however in general I do not add members in this file but instead in the hosts.cfg:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">define host {<br />
&nbsp; host_name   anyhosting1<br />
&nbsp; address     1.2.3.4<br />
&nbsp; use         generic-host<br />
&nbsp; hostgroups  http-servers<br />
}<br />
<br />
define host {<br />
&nbsp; host_name   example.com<br />
&nbsp; address     1.2.3.4<br />
&nbsp; use         generic-host<br />
&nbsp; hostgroups  http-vhosts<br />
}</div></div>
<p>Note the &#8220;hostgroups&#8221; line; anyhosting1 is the physical server (this monitor is really checking on the <a href="http://anyhosting.com/blog/2009/10/01/secure-shared-web-hosting-on-ubuntu-server-part-1/">reverse proxy</a>), and example.com is a vhost (which is really proxying to a user running Apache for the &#8220;example.com&#8221; domain). These two checks make sure that the whole system is working and proxying correctly.</p>
<p>Finally, services.cfg brings it all together by defining which groups should run which services:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># check that web services are running<br />
define service {<br />
&nbsp; hostgroup_name &nbsp; &nbsp; &nbsp; &nbsp; http-servers<br />
&nbsp; service_description &nbsp; &nbsp;HTTP<br />
&nbsp; check_command &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;check_http<br />
&nbsp; use &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;generic-service<br />
&nbsp; notification_interval &nbsp;0 # set &gt; 0 if you want to be renotified<br />
}<br />
<br />
define service {<br />
&nbsp; hostgroup_name &nbsp; &nbsp; &nbsp; &nbsp; http-vhosts<br />
&nbsp; service_description &nbsp; &nbsp;Virtual Host HTTP<br />
&nbsp; check_command &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;check_httpname<br />
&nbsp; use &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;generic-service<br />
&nbsp; notification_interval &nbsp;0 # set &gt; 0 if you want to be renotified<br />
}</div></div>
<p>The Ubuntu nagios-plugins package (which by default is installed along with the nagios3 package) contains plugins that can intelligently check MySQL databases, disk space, load average, etc. By default these only work on the local machine, but these can be made to run on remote machines by installing the nagios-nrpe-server package. I will cover this further in a future blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/10/17/monitoring-ubuntu-web-servers-with-nagios3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>centralized logging with syslog-ng</title>
		<link>http://anyhosting.com/blog/2009/10/06/centralized-logging-with-syslog-ng/</link>
		<comments>http://anyhosting.com/blog/2009/10/06/centralized-logging-with-syslog-ng/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 22:29:14 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[monitoring]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=100</guid>
		<description><![CDATA[Just wanted to point out another excellent post from the Blog O&#8217; Matty on centralized logging with syslog-ng. I actually helped to set up real-time web analysis with syslog-ng (using TCP) and a slightly hacked webalizer (it was ignoring multiple hits happening on the same second) from a FreeBSD/Apache web farm ~10 years ago, and [...]]]></description>
			<content:encoded><![CDATA[<p>Just wanted to point out another excellent post from the <a href="http://prefetch.net/blog">Blog O&#8217; Matty</a> on <a href="http://prefetch.net/blog/index.php/2009/10/05/slides-from-syslog-ng-presentation/">centralized logging with syslog-ng</a>.</p>
<p>I actually helped to set up real-time web analysis with syslog-ng (using TCP) and a slightly hacked webalizer (it was ignoring multiple hits happening on the same second) from a FreeBSD/Apache web farm ~10 years ago, and have been looking into it again for my current logging needs.</p>
<p>His blog has <a href="http://prefetch.net/blog/index.php/2009/09/30/how-the-linux-oom-killer-works/">consistently</a> <a href="http://prefetch.net/blog/index.php/2009/08/25/securing-linux-file-systems-that-dont-contain-executables/">awesome</a> <a href="http://prefetch.net/blog/index.php/2009/06/15/migrating-kvm-hosts-with-virsh/">posts</a> (if you&#8217;re interested in systems administration), and as your doctor I highly suggest that you <a href="http://prefetch.net/blog/index.php/feed/">subscribe</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2009/10/06/centralized-logging-with-syslog-ng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring and auto-recovery of services</title>
		<link>http://anyhosting.com/blog/2007/12/26/monitoring-and-auto-recovery-of-services/</link>
		<comments>http://anyhosting.com/blog/2007/12/26/monitoring-and-auto-recovery-of-services/#comments</comments>
		<pubDate>Wed, 26 Dec 2007 04:42:41 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[monitoring]]></category>
		<category><![CDATA[web hosting]]></category>

		<guid isPermaLink="false">http://anyhosting.com/blog/?p=20</guid>
		<description><![CDATA[If you run your own web, email, or other services, you need to be notified if these services are not up and running. There are tons of great choices available; which is right for you depends on your needs (how many operating systems do you support, what is your tolerance for complex configuration, how large [...]]]></description>
			<content:encoded><![CDATA[<p>If you run your own web, email, or other services, you need to be notified if these services are not up and running. There are tons of great choices available; which is right for you depends on your needs (how many operating systems do you support, what is your tolerance for complex configuration, how large of a system are we talking, etc). Two that I&#8217;ve used and can recommend are <a href="http://nagios.org">Nagios</a> and <a href="http://tildeslash.com/monit/">Monit</a>.</p>
<p>I&#8217;ve used Nagios in mixed Unix/Linux/Windows/MacOSX environments, and although it&#8217;s fairly time consuming to configure, it&#8217;s definitely very powerful. The workhorse of a Nagios system are plugins, which are simple Unix commands (they just return an exit code and optionally an informational message to tell Nagios whether the service is OK, in a warning state, or critical).</p>
<p>There are tons of Nagios plugins already written, which can check disk space, load average, monitor a specific TCP port, etc. Custom plugins can be written in any programming language that you like.</p>
<p>Nagios has a bunch of <a href="http://www.nagios.org/about/">features</a> like escalation (e.g. paging an on-call person if the service is down after an initial email), attempting to restart services, a web interface to schedule planned downtime and acknowledge outages, etc.</p>
<p>Nagios is great, but as I said it takes a little while to come up to speed on configuration, and if you only have one host it might be a bit more than you need. A much simpler system that I&#8217;ve been using on standalone hosts lately is Monit, which primarily exists to attempt auto-recovery and alert when service outages happen.</p>
<p>For example, if you want to try restarting your MySQL server before being paged, that&#8217;s really simple to specify in monitrc (the Monit config file):</p>
<pre>check process mysql with pidfile /var/run/mysqld/mysqld.pid
  start program = "/etc/init.d/mysql start"
  stop program  = "/etc/init.d/mysql stop"
  if failed port 3306 then restart
  if 2 restarts within 3 cycles then timeout</pre>
<p>You can also use Monit to restart or stop an application if it uses too much CPU, spawns too many children (as Apache does for each incoming connection), starts taking too much memory, etc. which can help to mitigate bugs and deal with denial of service attacks.</p>
<p>Monit isn&#8217;t a client/server system like Nagios, but this does not necessarily preclude you from configuring it centrally if you use a good deployment system (that&#8217;s a subject for a future blog post, though).</p>
]]></content:encoded>
			<wfw:commentRss>http://anyhosting.com/blog/2007/12/26/monitoring-and-auto-recovery-of-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
