munin プラグインを追加 ApacheとMysql

監視ツール muninのプラグインを追加しました。
今回追加したプラグインは、ApacheとMysqlのグラフです。
デフォルトでプラグインは有効になっていないので、下記の手順で有効にしてみました。

apache_accesses apache_processes apache_volume
Apacheのプラグインはあらかじめ mod_statusを有効にしなければなりません。

Statusを使用可能にするため、以下のコードを追加

[root@centos ~]# vi /etc/httpd/conf/httpd.conf

LoadModule status_module modules/mod_status.so

ExtendedStatus On

<Location /server-status>
   SetHandler server-status
   Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1
   Allow from localhost
</Location>

設定の反映
[root@centos ~]# /etc/rc.d/init.d/httpd restart

プラグインを有効化するためシンボリックリンクを張る。

[root@centos ~]#ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
[root@centos ~]#ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes
[root@centos ~]#ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume

80ポート以外のポートも監視したい場合は[apache*]をmunin-nodeに追加してください。

[root@centos ~]# vi /etc/munin/plugin-conf.d/munin-node
[apache*]
env.ports 80 443

[root@centos ~]# /etc/init.d/munin-node restart ←設定反映

Mysqlのグラフ mysql_bytes mysql_isam_space_ mysql_queries
mysql_slowqueries mysql_threads
プラグインを有効化するためシンボリックリンクを張る。

[root@centos ~]#ln -s /usr/share/munin/plugins/mysql_bytes /etc/munin/plugins/mysql_bytes
[root@centos ~]#ln -s /usr/share/munin/plugins/mysql_isam_space_ /etc/munin/plugins/mysql_isam_space_
[root@centos ~]#ln -s /usr/share/munin/plugins/mysql_queries /etc/munin/plugins/mysql_queries
[root@centos ~]#ln -s /usr/share/munin/plugins/mysql_slowqueries /etc/munin/plugins/mysql_slowqueries
[root@centos ~]#ln -s /usr/share/munin/plugins/mysql_threads /etc/munin/plugins/mysql_threads

Mysqlの情報を所得するには、env.mysqlopts -u root -pパスワード が必要でした。

[root@centos ~]# vi /etc/munin/plugin-conf.d/munin-node
[mysql*]
env.mysqlopts -u root -pパスワード
env.mysqladmin /usr/bin/mysqladmin

[root@centos ~]# /etc/init.d/munin-node restart ←設定反映
Print Friendly, PDF & Email

CentOS5.3centos,munin,mysql

Posted by admin