MuninでMySQLのクエリキャッシュを監視するようにします。
MySQLでクエリキャッシュを有効にする方法は過去の記事を参照してください。
WordPressチューニング(MySQL編1)
プラグインはMuninExchangeからダウンロードしてきます。ちなみに今回使用するプラグインはmysql_qcacheとmysql_qcache_memになります。
まず最初にmysql_qcacheとmysql_qcache_memをMuninのプラグインディレクトリにダウンロードし、実行権限を与えます。
# cd /usr/local/munin/lib/plugins # wget http://muninexchange.projects.linpro.no/download.php?phid=58 # wget http://muninexchange.projects.linpro.no/download.php?phid=59 # chmod 755 mysql_qcache # chmod 755 mysql_qcache_mem
プラグインを有効にするためシンボリックリンクを作成します。
# cd /etc/munin/plugins/ # ln -s /usr/local/munin/lib/plugins/mysql_qcache mysql_qcache # ln -s /usr/local/munin/lib/plugins/mysql_qcache_mem mysql_qcache_mem
mysql_qcacheとmysql_qcache_mem用の設定を追加します。
/etc/munin/plugin-conf.d/plugins.conf
[mysql*] env.mysqladmin /usr/local/mysql/bin/mysqladmin env.mysqlopts -uroot -p<password>
動作確認のため実行してみます。
# /usr/local/munin/sbin/munin-run --servicedir /etc/munin/plugins mysql_qcache queries.value 1139 # /usr/local/munin/sbin/munin-run --servicedir /etc/munin/plugins mysql_qcache_mem free.value 31228136 used.value 2326296
最後にエージェントを再起動して終了になります。
# /sbin/service munin restart Stopping Munin Node agents: [ OK ] Starting Munin Node: [ OK ]
コメント