745653 ランダム
 ホーム | 日記 | プロフィール 【フォローする】 【ログイン】

読書と技術となんか色々のログ

読書と技術となんか色々のログ

【毎日開催】
15記事にいいね!で1ポイント
10秒滞在
いいね! --/--
おめでとうございます!
ミッションを達成しました。
※「ポイントを獲得する」ボタンを押すと広告が表示されます。
x

PR

カレンダー

カテゴリ

2010年05月12日
XML
カテゴリ:[DB] MySQL
自宅サーバー構築メモ(その8) tritonn(MySQL)をmuninで監視する(その1、失敗篇)

用意されているmysqlプラグインの種類を確認します。
# ls -laF /usr/share/munin/plugins/mysql*
-rwxr-xr-x 1 root root 32238 Jan 25 08:11 /usr/share/munin/plugins/mysql_*
-rwxr-xr-x 1 root root 1762 Jan 25 08:11 /usr/share/munin/plugins/mysql_bytes*
-rwxr-xr-x 1 root root 5482 Jan 25 08:11 /usr/share/munin/plugins/mysql_innodb*
-rwxr-xr-x 1 root root 5816 Jan 25 08:11 /usr/share/munin/plugins/mysql_isam_space_*
-rwxr-xr-x 1 root root 2577 Jan 25 08:11 /usr/share/munin/plugins/mysql_queries*
-rwxr-xr-x 1 root root 1538 Jan 25 08:11 /usr/share/munin/plugins/mysql_slowqueries*
-rwxr-xr-x 1 root root 1653 Jan 25 08:11 /usr/share/munin/plugins/mysql_threads*

プラグインを有効にします。
# cd /etc/munin/plugins

# ln -s /usr/share/munin/plugins/mysql_bytes mysql_bytes
# ln -s /usr/share/munin/plugins/mysql_innodb mysql_innodb
# ln -s /usr/share/munin/plugins/mysql_isam_space_ mysql_isam_space_sampleRepo
# ln -s /usr/share/munin/plugins/mysql_queries mysql_queries
# ln -s /usr/share/munin/plugins/mysql_slowqueries mysql_slowqueries
# ln -s /usr/share/munin/plugins/mysql_threads mysql_threads
*mysql_isam_space_プラグインを有効にする場合は、スクリプト名の末尾にデータベース名を付加するようです。
今回は、sampleRepoという名前のデータベースを作成し、そこへjusho_masterというMyIsam型のテーブルを作成しました。

プラグインの設定を行います。
# vi /etc/munin/plugin-conf.d/munin-node

[mysql*]
env.mysqlopts -u root -p"rootのパスワード"

[mysql_isam_space_sampleRepo]
env.mysqlopts -u root -p"rootのパスワード"
env.statefile /var/lib/munin/plugin-state/plugin-mysql_isam_space_sampleRepo.state

munin-nodeを再起動します。
# service munin-node restart
Stopping Munin Node agents:                                [  OK  ]
Starting Munin Node:                                       [  OK  ]

これで図1のようにmysql関連のグラフが表示されたのですが、いくつか気になる点がありました。

1つ目は、mysql_isam_spaceプラグインが出力するグラフです。
図1の一番上のグラフがそれですが、値がずっと0のままでグラフが描画されません。
サンプルデータとしてjusho_masterというテーブルに日本郵便からダウンロードできる郵便番号データを取り込んでいます。

2つ目は、図2のメッセージがmysql_innodbプラグイン以外のプラグインで表示されていることです。
メッセージは「that this is a old plugin which is no longer installed by default. it is retained for compatibility with old installations.」です。
どうやら、今回設定したプラグインは古いバージョンで、別に新しいプラグインがあるようです。

3つ目は、mysql_innodbプラグインです。グラフは描画されているのですが、グラフの内容がおかしいようです。(図1の2番目のグラフ)
そこで、mysql_innodbプラグインのスクリプトを確認したところ下記の記述がありました。
このスクリプトは共有のデータファイルの一番最後に追加されたファイルの空き領域をグラフ化する
もので、my.cnfにinnodb_file_per_tableを設定した場合、正確なグラフが描画できません。記述にもあるとおり、innodb_file_per_tableを有効にした場合はdfプラグインを使用するほうが良いみたいです。
=head1 ABOUT

Munin plugin to monitor free space in the InnoDB tablespace of MySQL.
Mostly useful if you use InnoDB on a block device, or if you have
created files for InnoDB storage, and do not want to autoextend the
last file.

If you have set innodb_file_per_table, you do not need to worry about
free tablespace, and you should use the "df" plugin instead.



図1.
munin-mysql-01.png

図2.
munin-mysql-02.png

ということで、mysql_isam_spaceプラグインのグラフが正常に表示されない原因が、古いプラグインを使っていることなのか、設定方法にミスがあるのか分かりませんでしたが、とりあえずmysqlプラグインに新しいバージョンがあるようなので、そちらでもう一度試してみようとおもいます。

その2、リベンジ篇へ続く





お気に入りの記事を「いいね!」で応援しよう

最終更新日  2010年05月17日 07時26分10秒
コメント(0) | コメントを書く



© Rakuten Group, Inc.