<?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>Jetpack Flight Log &#187; munin</title>
	<atom:link href="http://jetpackweb.com/blog/tags/munin/feed/" rel="self" type="application/rss+xml" />
	<link>http://jetpackweb.com/blog</link>
	<description>Rock{et}ing the interweb</description>
	<lastBuildDate>Wed, 19 May 2010 22:21:53 +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>Munin Graphs for Phusion Passenger (a.k.a. mod_rails)</title>
		<link>http://jetpackweb.com/blog/2009/09/29/munin-graphs-for-phusion-passenger-a-k-a-mod_rails/</link>
		<comments>http://jetpackweb.com/blog/2009/09/29/munin-graphs-for-phusion-passenger-a-k-a-mod_rails/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:54:05 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=408</guid>
		<description><![CDATA[The goal of this article is to get fairly nice looking graphs of Phusion Passenger&#8217;s performance and memory metrics: This specific setup focuses on CentOS (on cPanel none the less) &#8211; but instructions should apply for most linux distros. It assumes you already have Passenger and Munin successfully setup. See my previous article on getting [...]]]></description>
			<content:encoded><![CDATA[<p>The goal of this article is to get fairly nice looking graphs of <a href="http://www.modrails.com/" target="_blank">Phusion Passenger&#8217;s</a> performance and memory metrics:</p>
<p><img src="http://jetpackweb.com/blog/wp-content/uploads/2009/09/passenger_memory_stats.png" /><br />
<img src="http://jetpackweb.com/blog/wp-content/uploads/2009/09/passenger_status.png" /></p>
<p>This specific setup focuses on CentOS (on cPanel none the less) &#8211; but instructions should apply for most linux distros. It assumes you already have Passenger and Munin successfully setup. See my <a href="http://jetpackweb.com/blog/2009/07/21/install-phusion-passenger-a-k-a-mod_rails-on-cpanel-server/">previous article</a> on getting Phusion Passenger setup if you have not already. </p>
<p>First we need to allow the <strong>munin</strong> user sudo privileges for a few passenger related commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">sudo</span> <span class="sy0">/</span>usr<span class="sy0">/</span>sbin<span class="sy0">/</span>visudo
&nbsp;
<span class="co0"># Add the following line to the file</span>
munin <span class="re2">ALL</span>=<span class="br0">&#40;</span>ALL<span class="br0">&#41;</span> NOPASSWD:<span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>passenger-status, <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>passenger-memory-stats
&nbsp;
<span class="co0"># Depending on your setup, you may also have to comment out the following line:</span>
Defaults requiretty</pre></div></div>

<p>If you see the error <strong>sorry, you must have a tty to run sudo</strong> in <strong>/var/log/munin/munin-node.log</strong>, comment out the final line shown above.</p>
<p>The following two files will glean some performance and memory statistics.</p>
<p><strong>Passenger Status:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco, monospace;"><span class="co1">#!/usr/bin/env ruby</span>
&nbsp;
<span class="kw1">def</span> output_config
  <span class="kw3">puts</span> <span class="sy0">&lt;&lt;-</span><span class="kw1">END</span>
graph_category App
graph_title passenger status
graph_vlabel count
&nbsp;
sessions.<span class="me1">label</span> sessions
max.<span class="me1">label</span> max processes
running.<span class="me1">label</span> running processes
active.<span class="me1">label</span> active processes
<span class="kw1">END</span>
  <span class="kw3">exit</span> <span class="nu0">0</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">def</span> output_values
  status = <span class="st0">`sudo /usr/bin/passenger-status`</span>
  <span class="kw1">unless</span> $?.<span class="me1">success</span>?
    <span class="re0">$stderr</span>.<span class="kw3">puts</span> <span class="st0">&quot;failed executing passenger-status&quot;</span>
    <span class="kw3">exit</span> <span class="nu0">1</span>
  <span class="kw1">end</span>
  status =~ <span class="sy0">/</span>max\s<span class="sy0">+</span>=\s<span class="sy0">+</span><span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;max.value #{$1}&quot;</span>
&nbsp;
  status =~ <span class="sy0">/</span>count\s<span class="sy0">+</span>=\s<span class="sy0">+</span><span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;running.value #{$1}&quot;</span>
&nbsp;
  status =~ <span class="sy0">/</span>active\s<span class="sy0">+</span>=\s<span class="sy0">+</span><span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;active.value #{$1}&quot;</span>
&nbsp;
  total_sessions = <span class="nu0">0</span>
  status.<span class="me1">scan</span><span class="br0">&#40;</span><span class="sy0">/</span>Sessions: <span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span><span class="br0">&#41;</span>.<span class="me1">flatten</span>.<span class="me1">each</span> <span class="br0">&#123;</span> <span class="sy0">|</span>count<span class="sy0">|</span> total_sessions <span class="sy0">+</span>= count.<span class="me1">to_i</span> <span class="br0">&#125;</span>
  <span class="kw3">puts</span> <span class="st0">&quot;sessions.value #{total_sessions}&quot;</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">if</span> ARGV<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> == <span class="st0">&quot;config&quot;</span>
  output_config
<span class="kw1">else</span>
  output_values
<span class="kw1">end</span></pre></div></div>

<p><strong>Memory Stats:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco, monospace;"><span class="co1">#!/usr/bin/env ruby</span>
<span class="co1"># put in /etc/munin/plugins and restart munin-node</span>
<span class="co1"># by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin</span>
<span class="co1"># NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats</span>
&nbsp;
<span class="kw1">def</span> output_config
  <span class="kw3">puts</span> <span class="sy0">&lt;&lt;-</span><span class="kw1">END</span>
graph_category App
graph_title Passenger memory stats
graph_vlabel count
&nbsp;
memory.<span class="me1">label</span> memory
<span class="kw1">END</span>
  <span class="kw3">exit</span> <span class="nu0">0</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">def</span> output_values
  status = <span class="st0">`sudo /usr/bin/passenger-memory-stats | tail -1`</span>
  <span class="kw1">unless</span> $?.<span class="me1">success</span>?
    <span class="re0">$stderr</span>.<span class="kw3">puts</span> <span class="st0">&quot;failed executing passenger-memory-stats&quot;</span>
    <span class="kw3">exit</span> <span class="nu0">1</span>
  <span class="kw1">end</span>
  status =~ <span class="sy0">/</span><span class="br0">&#40;</span>\d<span class="sy0">+</span>\.\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;memory.value #{$1}&quot;</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">if</span> ARGV<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> == <span class="st0">&quot;config&quot;</span>
  output_config
<span class="kw1">else</span>
  output_values
<span class="kw1">end</span></pre></div></div>

<p>Now we will link these to the active plugins, and make them executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">chmod</span> +x <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status
<span class="kw2">sudo</span> <span class="kw2">chmod</span> +x <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status
<span class="kw2">sudo</span> <span class="kw2">ln</span> <span class="re5">-s</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status
<span class="kw2">sudo</span> <span class="kw2">ln</span> <span class="re5">-s</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status</pre></div></div>

<p>Last thing we need to do is make sure those scripts run as the munin user:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugin-conf.d<span class="sy0">/</span>munin-node</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="br0">&#91;</span>passenger_<span class="sy0">*</span><span class="br0">&#93;</span>
user munin
<span class="kw3">command</span> ruby <span class="sy0">%</span>c</pre></div></div>

<p>Restart the munin node, and wait and you should see the graphs start to propagate.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>munin-node restart</pre></div></div>

<p>For even more detailed performance analytics, checkout <a href="http://www.newrelic.com/" target="_blank">NewRelic</a> monitoring. And thanks to <a href="http://www.dcmanges.com/blog/rails-application-visualization-with-munin" target="_blank">Dan Mange</a> for the munin scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/09/29/munin-graphs-for-phusion-passenger-a-k-a-mod_rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to fix Munin&#8217;s Exim Graph on cPanel</title>
		<link>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-exim-graph-on-cpanel/</link>
		<comments>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-exim-graph-on-cpanel/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:57:07 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=113</guid>
		<description><![CDATA[If you notice the Exim graphs on your server have stop updating, you might want to check /var/log/munin/munin-node.log and see if you have lots of these entries: tail /var/log/munin/munin-node.log &#160; ... Plugin &#34;exim_mailstats&#34; exited with status 768. ---- ... You just need to remove the state file, and the graph will start updating again. Don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>If you notice the Exim graphs on your server have stop updating, you might want to check /var/log/munin/munin-node.log and see if you have lots of these entries:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">tail</span> <span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>munin<span class="sy0">/</span>munin-node.log
&nbsp;
...
Plugin <span class="st0">&quot;exim_mailstats&quot;</span> exited with status 768. <span class="re5">----</span>
...</pre></div></div>

<p>You just need to remove the state file, and the graph will start updating again. Don&#8217;t worry about deleting the file, no data should be lost.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">rm</span> <span class="sy0">/</span>var<span class="sy0">/</span>lib<span class="sy0">/</span>munin<span class="sy0">/</span>plugin-state<span class="sy0">/</span>plugin-exim_mailstats.state</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-exim-graph-on-cpanel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to fix Munin&#8217;s MySQL Graph on cPanel</title>
		<link>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-mysql-graph-on-cpanel/</link>
		<comments>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-mysql-graph-on-cpanel/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:54:51 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=105</guid>
		<description><![CDATA[We have a few cPanel servers deployed and to visually monitor performance we use the Munin monitoring tool. We were having issues where the MySQL graphs would stop updating. The bug has to do with one of the perl libraries the script uses, which causes the MySQL plugin to have problems location the mysqladmin program. [...]]]></description>
			<content:encoded><![CDATA[<p>We have a few cPanel servers deployed and to visually monitor performance we use the Munin monitoring tool. We were having issues where the MySQL graphs would stop updating. The bug has to do with one of the perl libraries the script uses, which causes the MySQL plugin to have problems location the <b>mysqladmin</b> program.</p>
<p>To fix these, create or edit the following file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugin-conf.d<span class="sy0">/</span>cpanel.conf</pre></div></div>

<p>It should contain the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="br0">&#91;</span>mysql<span class="sy0">*</span><span class="br0">&#93;</span>
user root
group wheel
env.mysqladmin <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>mysqladmin
env.mysqlopts <span class="re5">--defaults-extra-file</span>=<span class="sy0">/</span>root<span class="sy0">/</span>.my.cnf</pre></div></div>

<p>This would load the username and password from root&#8217;s mysql config. If that file doesn&#8217;t exist you can create it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>root<span class="sy0">/</span>.my.cnf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="br0">&#91;</span>client<span class="br0">&#93;</span>
<span class="re2">user</span>=<span class="st0">&quot;root&quot;</span>
<span class="re2">pass</span>=<span class="st0">&quot;secret!password&quot;</span></pre></div></div>

<p>Now just restart Munin, wait a a little bit, and the graphs should start populating again!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>munin-node restart</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/07/16/how-to-fix-munins-mysql-graph-on-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
