let's begin resource monitoring with munin 2011 1209 zem_distribution
DESCRIPTION
Munin で始めるリソースモニタリング。Munin User Group Japan の紹介、自作プラグイン(迷惑メール数カウントフィルタ)のサンプル、各種リソースモニタのサンプル。おまけでMuninのインストール方法。TRANSCRIPT
Munin でMunin で、今日から始める今日から始めるリソ ス監視リソース監視Munin User Group Japanp phttp://munin.jp/@zembutsu@Dec 9, 2011 at IBM@SHIBUYA MARKCITY
About meAbout me• @zembutsu 前佛雅人
– 活動:クラウド界隈に出没クラウドは人生(キリッ
活動:クラウド界隈に出没• Open Cloud Campus, JEUG(Eucalyptus ユーザ会), JAWS-UG等• Perl 使い、日本酒大好き• 本業はat+link専用サーバサービスの運用サポート等等• 本業はat+link専用サーバサービスの運用サポート等等
– 最近の興味• データマイニング、統計・解析、MongoDB• Last Exile Fam、北米版の日本アニメ鑑賞
– http://www.slideshare.net/zembutsu• G-CLOUDMagazine G-CLOUDMagazine 2011 SummerG CLOUD Magazine G CLOUD Magazine 2011 Summer
2010年8月6日発売 2011年6月29日発売1章~3章AWS入門記事 5章RightScale
http://munin jp/http://munin.jp/Muninユーザ会が出来ました。サイトもオ プンです ( ∀ )ノサイトもオープンですヽ(・∀・)ノ
http://munin jp/http://munin.jp/
とある会社の迷惑メール到達状況をMuninプラグインで視覚化したもの
#!/bin/sh### Plugin to monitor SAPM email detection and reject counter# 2011/11/28
M i プラグインは簡単#%# family=auto#%# capabilities=autoconf
Muninプラグインは簡単迷惑メールカウントは50行のシェルスクリプト
if [ "$1" = "autoconf" ] ; thenif [ -n "$SPAMS" ] ; then
echo "yes"
50行のシ ルスクリプト
yelse
echo "¥$SPAMS not defined."fiexit
fi
if [ "$1" " fi " ] hif [ "$1" = "config" ] ; thenecho "graph_args --base 1000 -r --lower-limit 0";#echo "graph_args --base 1000 -r --lower-limit 0 --units-exponent 3";
h " h titl SPAM E il R j t C t b t "echo "graph_title SPAM E-mails Reject Counter, by type";echo "graph_category sendmail";echo "graph_info This graph shows procmail filter counter.";echo 'graph printf %3 0lf'echo graph_printf %3.0lfecho 'graph_vlabel SPAMs'echo "graph_order $SPAM"
FIRSTSPAM=1;for SPAM in $SPAMS; do
echo "${SPAM}.label $SPAM"echo "${SPAM}.info procmail recipe by $SPAM"echo "${SPAM}.type GAUGE"if [ $FIRSTSPAM -eq 1 ] ; then
h "${SPAM} d AREA" グラフの定義グラフの定義echo "${SPAM}.draw AREA"export FIRSTSPAM=0;
elseecho "${SPAM} dra STACK"
グラフの定義(rrdtool)
echo "${SPAM}.draw STACK"fi
done ;
exitfi
for SPAM in $SPAMS ; do {grep $SPAM /var/lib/munin/plugin-state/SpamFiltered.state
}}
done;値を取得
( Muninが fetch )
4,9,14,19,24,29,34,39,44,49,54,59 * * * * /usr/share/munin/plugins/countSpamFiltered.sh > /var/lib/munin/plugin-t t /S Filt d t tstate/SpamFiltered.state
Cronで情報取得Cronで情報取得(muninユーザ権限ではアクセスできないファイルのため 中間ファイルを作成)中身#!/bin/sh
# by zembutsu@link co jp 2011/11/28
め、中間ファイルを作成)中身
# by [email protected] 2011/11/28# env spam.body spam.from spam.received
for SPAM in body from received x info Subject Body null body Nov class mailerfor SPAM in body from received x-info Subject_Body_null body-Nov class mailer messageid reply return body-DotAsia RegacyAddress Subject-Word X-Mailer-Outlook-Forged body-Decddo
echo -n "${SPAM}.value "grep ^Message- /var/spool/procmail/spam.${SPAM}.log | wc -l
done
http://munin-monitoring.org/
( ムーニン )( ム ニン )
h // l d iki di / iki di / /3/3 /Odi h f jhttp://upload.wikimedia.org/wikipedia/commons/3/3c/Odin_hrafnar.jpg
h // l d iki di / iki di / /3/3 /Odi h f jhttp://upload.wikimedia.org/wikipedia/commons/3/3c/Odin_hrafnar.jpg
http://munin-monitoring.org/
横から見た横から見たワタリガラス
よく見るとiMunin
よくあるトラフ クの視覚化よくあるトラフィックの視覚化
サンプルサンプルhttp://node1.pocketstudio.net/munin/
複数サ バのリソ ス状況を複数サーバのリソース状況をWebブラウザ上に並列表示
NodeNodeが生きてが生きていれば、
LoadAverageg8,000 も!!
秒間アクセス数を表示
Nginxの秒間アクセス数を
表示
MySQLクエリMySQLクエリ毎に視覚化
ピーク約46k ピ ク約query/sec
メールの転送バイト数/sec
HDD温度の推移
総発電量総発電量
電力供給量
電力使用率電力使用率
たまにデ タたまにデータが跳ね上がる事が事が…
長期トレンドでは変に欠損したり(;´Д`)
h // i j /http://munin.jp/http://munin.jp/Munin User Group JapanMunin User Group Japan
まとめまとめ
• Muninを使って、瞬時にボトルネ クを特定1. 瞬時にボトルネックを特定
2 継続的な状況の把握2. 継続的な状況の把握– 障害発生時だけじゃないお障害発生時だけじゃないお
運用管理の効率化に• 運用管理の効率化にもっと時間を有効に使おう!–もっと時間を有効に使おう!
88
Thank you for listening!Thank you for listening!
•最後までおつきあいいただき、ありがとうございました!!ありがとうございました!!
• ContactsContacts– Munin User Group Japan
http://munin jp/• http://munin.jp/– 前佛雅人 (Masahito Zembutsu)
• Twitter: @zembutsu• Twitter: @zembutsu• E-mail: [email protected]
Appendix How to install MuninAppendix - How to install Munin