<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>おいぬま日報 &#187; Munin</title>
	<atom:link href="http://tech.lampetty.net/tech/index.php/archives/category/munin/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.lampetty.net/tech</link>
	<description>Apache, MySQL, Perl, Python あたり</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:36:09 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/category/munin/feed" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Tomcatのスレッド数をグラフ化するMunin plugin</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/395?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tomcat%25e3%2581%25ae%25e3%2582%25b9%25e3%2583%25ac%25e3%2583%2583%25e3%2583%2589%25e6%2595%25b0%25e3%2582%2592%25e3%2582%25b0%25e3%2583%25a9%25e3%2583%2595%25e5%258c%2596%25e3%2581%2599%25e3%2582%258bmunin-plugin</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/395#comments</comments>
		<pubDate>Sun, 19 Dec 2010 04:25:05 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Munin]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=395</guid>
		<description><![CDATA[会社で使おうと思っていたTomcatのスレッド数をグラフ化するMunin pluginがあるのですが、XML::Simpleに依存していて「Munin pluginのためにわざわざPerlモジュールインストールするのもな [...]]]></description>
			<content:encoded><![CDATA[<p>会社で使おうと思っていたTomcatのスレッド数をグラフ化するMunin pluginがあるのですが、XML::Simpleに依存していて「Munin pluginのためにわざわざPerlモジュールインストールするのもなぁ」と思ったので、ついかっとなってXMLをパースするところを正規表現で書き直してみました。ついでにmaxThreadsも表示するようにしたり、微調整もしています。プラグインは<a href="https://github.com/oinume/munin-plugins/blob/master/tomcat_threads">github</a>に上げてあります。</p>
<p>なんでXML::Simpleを使っていたかというとTomcatのstatus画面がXMLで出力されているからなのですが、頑張ればこのぐらいのXMLは正規表現でパースできるということが実践できて良かったです。</p>
<p>↓は実際のスレッド数のグラフ。</p>
<p><a class="" rel="lightbox" title="munin_tomcat_threads" href="http://www.flickr.com/photos/8250493@N05/5273139214/"><img src="http://farm6.static.flickr.com/5042/5273139214_0903e10d9a.jpg" alt="munin_tomcat_threads"></a></p>
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/Tomcat%E3%83%8F%E3%83%B3%E3%83%89%E3%83%96%E3%83%83%E3%82%AF-%E7%AC%AC2%E7%89%88-Jason-Brittain/dp/4873113881%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873113881"><img src="http://ecx.images-amazon.com/images/I/51hnxTab2NL._SL160_.jpg" border="0" alt="" /></a></p>
	<p><a href="http://www.amazon.co.jp/Tomcat%E3%83%8F%E3%83%B3%E3%83%89%E3%83%96%E3%83%83%E3%82%AF-%E7%AC%AC2%E7%89%88-Jason-Brittain/dp/4873113881%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873113881">Tomcatハンドブック 第2版</a></p>
	<p><em>著者／訳者：</em>Jason Brittain Ian F. Darwin </p>
	<p><em>出版社：</em>オライリージャパン( 2008-11-21 )</p>
	<p>大型本 ( 560 ページ )</p>
<hr class="tmkm-amazon-clear" /></div>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/395/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/395" />
	</item>
		<item>
		<title>Muninの好きなところ</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/387?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=munin%25e3%2581%25ae%25e3%2581%2584%25e3%2581%2584%25e3%2581%25a8%25e3%2581%2593%25e3%2582%258d</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/387#comments</comments>
		<pubDate>Sat, 18 Sep 2010 17:00:07 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Munin]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=387</guid>
		<description><![CDATA[リソース監視ソフトウェアにMuninというものがありますが、個人でも仕事でも使っていて割りと好きなものの一つです。どういうところがいいかというと インストールが簡単ですぐ動かせる Munin自体は静的なHTMLファイルを [...]]]></description>
			<content:encoded><![CDATA[<p>リソース監視ソフトウェアに<a href="http://munin-monitoring.org/">Munin</a>というものがありますが、個人でも仕事でも使っていて割りと好きなものの一つです。どういうところがいいかというと</p>
<ol>
<li>インストールが簡単ですぐ動かせる</li>
<li>Munin自体は静的なHTMLファイルを生成するだけなので、Webサーバは何でもよい。自分の好きなWebサーバを使えばよい</li>
<li>リソース情報の収集は単に /etc/munin/plugins 配下のコマンドを呼び出しているだけなので、好きな言語でプラグイン(コマンド)を作れる</li>
</ol>
<p>かなぁと。</p>
<p>ただ一方で、管理するサーバの台数が100台規模になってくるとグラフの生成に時間がかかる(ものによっては10分以上)という問題があるので、最近は代替できるソフトウェアを模索中です。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/387/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/387" />
	</item>
		<item>
		<title>MuninでMySQLプラグインのグラフが描画されない時の解決方法</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/369?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=munin%25e3%2581%25a7mysql%25e3%2583%2597%25e3%2583%25a9%25e3%2582%25b0%25e3%2582%25a4%25e3%2583%25b3%25e3%2581%25ae%25e3%2582%25b0%25e3%2583%25a9%25e3%2583%2595%25e3%2581%258c%25e6%258f%258f%25e7%2594%25bb%25e3%2581%2595%25e3%2582%258c%25e3%2581%25aa%25e3%2581%2584%25e6%2599%2582%25e3%2581%25ae%25e8%25a7%25a3%25e6%25b1%25ba</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/369#comments</comments>
		<pubDate>Tue, 09 Mar 2010 14:09:58 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Munin]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=369</guid>
		<description><![CDATA[先日設定したサーバでMuninをインストールして監視していたのですが、どうもMySQL関連のプラグイン(mysql_bytes, mysql_queries, mysql_threadsなど)でグラフが描画されず、どうし [...]]]></description>
			<content:encoded><![CDATA[<p>先日設定したサーバでMuninをインストールして監視していたのですが、どうもMySQL関連のプラグイン(mysql_bytes, mysql_queries, mysql_threadsなど)でグラフが描画されず、どうしたものかと思ってぐぐってみたところ、<a href="http://www.mydigitallife.info/2007/08/25/fix-for-munin-mysql-monitoring-plugin-graph-not-showing-or-blank/">このエントリ</a>を見つけました。まさにビンゴで /etc/munin/plugin-conf.d/munin-node に以下の行を足してmunin-nodeをrestartしたところ、うまくグラフが描画されるようになりました。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">env.mysqladmin <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysqladmin</pre></div></div>

<p>Muninの問題なのか何なのか、自分のケースでは mysql 関連のコマンドを /usr/local/bin/ 配下にインストールしてたので、ここにPATHが通っていなかったのが問題のようです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-umunin</span> munin-run mysql_bytes</pre></div></div>

<p>と実行してもうまく数値が出てきたのでどうしたものかと悩んでいたのですが、解決してすっきりしました。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/369/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/369" />
	</item>
		<item>
		<title>Muninでサーバのリソース監視</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/308?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=munin%25e3%2581%25a7%25e3%2582%25b5%25e3%2583%25bc%25e3%2583%2590%25e3%2581%25ae%25e3%2583%25aa%25e3%2582%25bd%25e3%2583%25bc%25e3%2582%25b9%25e7%259b%25a3%25e8%25a6%2596</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/308#comments</comments>
		<pubDate>Wed, 06 May 2009 12:10:05 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Munin]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=308</guid>
		<description><![CDATA[サーバのリソース監視＆グラフ化を行なうソフトウェアは色々ありますが、今日は導入が簡単と言われているMuninを紹介したいと思います。 個人的に感じているMuninの良い点としては インストール＆初期設定が簡単 デフォルト [...]]]></description>
			<content:encoded><![CDATA[<p>サーバのリソース監視＆グラフ化を行なうソフトウェアは色々ありますが、今日は導入が簡単と言われている<a href="http://munin.projects.linpro.no/">Munin</a>を紹介したいと思います。</p>
<p>個人的に感じているMuninの良い点としては</p>
<ul>
<li>インストール＆初期設定が簡単</li>
<li>デフォルトで監視できる対象が多い</li>
<li>プラグイン機構があり、任意のリソースのグラフ化が可能</li>
</ul>
<p>が挙げられます。仕事で使うのは Cacti とかがいいと思いますが、個人利用としては Munin はとてもお手軽でおすすめです。</p>
<h3>インストール</h3>
<p>Ubuntu Linuxだとdebパッケージがあるのでaptitudeでインストールするだけです(Fedore CoreやCentOSにもRPMがあります)。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> munin</pre></div></div>

<p>インストールしたら、munin-nodeというプログラムが起動しているかどうかを調べます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ps</span> auxww <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> munin-node</pre></div></div>

<p>もし起動していない場合は下記の要領で起動しておきましょう。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>munin-node start</pre></div></div>

<h3>設定</h3>
<p>Muninは munin-node というサーバに常駐してリソースの情報を集めるエージェントと、そのエージェントから情報を集約してリソースの状況をグラフ化する munin 本体の2つがあります。今回は1台のサーバを監視するので特に意識する必要はありませんが、サーバが複数台になった場合は、munin-node を監視したいサーバにインストールする必要があります。</p>
<p>なお、Munin自体はデフォルトのままでも使用できますが、 Muninが /var/www/munin/ に生成したグラフのファイルをブラウザから見れるように、Apacheに以下の設定を追加します。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">Alias /munin/ /var/www/munin/
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Directory</span> <span style="color: #ff0000;">&quot;/var/www/munin&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    Options Indexes +SymLinksIfOwnerMatch MultiViews ExecCGI
    AllowOverride FileInfo AuthConfig Limit Indexes
    Order allow,deny
    Allow from all
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>設定したら Apache を再起動します。5分ぐらい待ってから http://yourhost/munin/ をブラウザで開くと下記のような画面が表示されるかと思います。待てないせっかちな人は下記を実行してみてください(muninのHTMLが生成されます)。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> munin munin-cron</pre></div></div>

<p style="text-align:center"><a class="" rel="lightbox" title="Munin Top" href="http://www.flickr.com/photos/8250493@N05/3507438018/"><img src="http://static.flickr.com/3406/3507438018_93c8410b6c.jpg" alt="Munin Top"></a></p>
<h3>監視したいリソースの追加</h3>
<p>デフォルトでは Munin にはApacheやMySQLなどの状況をグラフ化するプラグインが付属しているので、これを有効にしてみましょう。例えば Apache 関連のものは</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>munin<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>apache_<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>munin<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>のように、/etc/munin/plugins/の下にpluginのシンボリックリンクを貼るだけで監視対象とすることができます。あ、ただ munin-node の再起動が必要ですが&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>munin-node restart</pre></div></div>

<p>なお、グラフが更新されるのは５分に1回なので、監視対象を追加した場合反映されるのは5分後になります。以下は apache_accesses の状況です。</p>
<p style="text-align: center;"><a class="" rel="lightbox" title="MuninでApacheのリソース監視" href="http://www.flickr.com/photos/8250493@N05/3507441158/"><img class="alignnone" src="http://static.flickr.com/3634/3507441158_2c01a99061.jpg" alt="MuninでApacheのリソース監視"></a></p>
<h3>プラグインのダウンロード</h3>
<p>デフォルトでもかなりの数のプラグインが揃っていますが、memcachedなどのリソース監視を行うプラグインもあります。そのような野良プラグインは<a href="http://muninexchange.projects.linpro.no/">MuninExchange</a>にアップされているので、使えそうなものがないかチェックしておくと良いでしょう。</p>
<h3>まとめ</h3>
<p>Muninのお手軽さが少しは伝わったでしょうか？日本語の情報はあまりありませんが、Munin自体はとてもシンプルかつ導入が簡単なので、「試しに入れてみよう」というとっかかりになれば幸いです。プラグインで任意のリソースをグラフ化することができるのも大きなメリットなので、時間があったらプラグインの書き方でも説明したいと思います。</p>
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/%E3%83%97%E3%83%AD%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE-Linux%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E6%A7%8B%E7%AF%89%E3%83%BB%E9%81%8B%E7%94%A8%E6%8A%80%E8%A1%93-Software-Design-plus/dp/4774145017%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4774145017"><img src="http://ecx.images-amazon.com/images/I/61JA5nOamIL._SL160_.jpg" border="0" alt="" /></a></p>
	<p><a href="http://www.amazon.co.jp/%E3%83%97%E3%83%AD%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE-Linux%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E6%A7%8B%E7%AF%89%E3%83%BB%E9%81%8B%E7%94%A8%E6%8A%80%E8%A1%93-Software-Design-plus/dp/4774145017%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4774145017">プロのための Linuxシステム構築・運用技術 (Software Design plus)</a></p>
	<p><em>著者／訳者：</em>中井 悦司</p>
	<p><em>出版社：</em>技術評論社( 2010-12-22 )</p>
	<p>大型本 ( 264 ページ )</p>
<hr class="tmkm-amazon-clear" /></div>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/308/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/308" />
	</item>
	</channel>
</rss>

