根据中间件类型设置 Munin 插件的步骤
各种中间件的munin插件设置步骤
由于中间件的不同,munin插件的安装方法也会有所不同,因此我会将备忘录中的方法记录下来。关于munin的安装(服务器、客户端),请参考《在AWS EC2中轻松监控munin资源!》并随时查阅,我计划进行轻微的随时更新。
)任務以外加 (小組的)合作任務,可增進團隊合作能力,提高效率。
履行個人責任,並積極參與小組任務,有助於團隊合作和工作效率的提升。
删除默认创建的监控项目。
cd /etc/munin/plugins
unlink sendmail_mailqueue
unlink sendmail_mailstats
unlink sendmail_mailtraffic
unlink users
unlink threads
unlink proc_pri
unlink entropy
unlink irqstats
unlink forks
unlink interrupts
根据不同的中间件,插件的设置方法会有所不同。
MySQL是一种开源的关系型数据库管理系统。
- perl モジュールのインストール
yum install --enablerepo=epel perl-IPC-ShareLite perl-Cache-Cache perl-Cache perl-DBD-MySQL
- プラグインのインストール
cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/mysql_ mysql_commands
ln -s /usr/share/munin/plugins/mysql_ mysql_innodb_bpool
ln -s /usr/share/munin/plugins/mysql_ mysql_innodb_io
ln -s /usr/share/munin/plugins/mysql_ mysql_innodb_log
ln -s /usr/share/munin/plugins/mysql_ mysql_innodb_tnx
ln -s /usr/share/munin/plugins/mysql_ mysql_select_types
ln -s /usr/share/munin/plugins/mysql_ mysql_table_locks
ln -s /usr/share/munin/plugins/mysql_ mysql_connections
ln -s /usr/share/munin/plugins/mysql_ mysql_slow
ln -s /usr/share/munin/plugins/mysql_ mysql_myisam_indexes
ln -s /usr/share/munin/plugins/mysql_ mysql_network_traffic
ln -s /usr/share/munin/plugins/mysql_ mysql_qcache
ln -s /usr/share/munin/plugins/mysql_ mysql_qcache_mem
- MySQL の接続設定
_mysql_userid=ユーザーID
_mysql_passwd=パスワード
cat << _EOT_ >> /etc/munin/plugin-conf.d/munin-node
[mysql*]
env.mysqlopts -u ${_mysql_userid} -p${_mysql_passwd}
env.mysqladmin /usr/bin/mysqladmin
env.mysqlconnection DBI:mysql:mysql;host=127.0.0.1;port=3306
env.mysqluser ${_mysql_userid}
env.mysqlpassword ${_mysql_passwd}
_EOT_
- 動作確認
/usr/sbin/munin-run mysql_commands
--------------
Com_delete.value 52
Com_insert.value 1624
Com_insert_select.value 0
Com_load.value 0
Com_replace.value 0
Com_replace_select.value 0
Com_select.value 4
Com_update.value 4330
Com_update_multi.value 0
由于Mariadb的原因,可能会出现以下错误…
Unknown section: INDIVIDUAL BUFFER POOL INFO at /etc/munin/plugins/mysql_commands line 1098.
'INDIVIDUAL BUFFER POOL INFO' => \&skip,
请在以下位置添加如下行:
vi /usr/share/munin/plugins/mysql_
---------------------------------
my %section_map = (
'BUFFER POOL AND MEMORY' => \&parse_buffer_pool_and_memory,
'FILE I/O' => \&parse_file_io,
'INSERT BUFFER AND ADAPTIVE HASH INDEX'
=> \&parse_insert_buffer_and_adaptive_hash_index,
'LATEST DETECTED DEADLOCK' => \&skip,
'LATEST FOREIGN KEY ERROR' => \&skip,
'LOG' => \&parse_log,
'ROW OPERATIONS' => \&skip,
'SEMAPHORES' => \&parse_semaphores,
'TRANSACTIONS' => \&parse_transactions,
'BACKGROUND THREAD' => \&skip,
'INDIVIDUAL BUFFER POOL INFO' => \&skip, # → これを追記
);
---------------------------------
Apache
阿帕奇
- プラグインのインストール
cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/
ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/
ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/
ln -s /usr/share/munin/plugins/ps_ /etc/munin/plugins/ps_httpd
- apacheの計測用サブディレクトリ設定
cat << '_EOT_' > /etc/httpd/conf.d/status.conf
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
</IfModule>
_EOT_
- configのチェック
/etc/init.d/httpd configtest
- 設定の反映
/etc/init.d/httpd graceful
- ステータス確認
curl http://127.0.0.1/server-status/?auto
- リバースプロキシなど設定している場合は・・・
请将“ProxyPass /server-status !”这句话用中文进行本地化改写,并确保不对 server-status 进行代理设置!
<IfModule mod_proxy.c>
SSLProxyEngine on
ProxyRequests Off
ProxyPass /server-status !
.
.
Redis 是一个开源的高性能键值对存储系统。
- プラグインのインストール
cd /usr/share/munin/plugins/
wget https://raw.github.com/bpineau/redis-munin/master/redis_
chmod 755 redis_
cd /etc/munin/plugins/
ln -s /usr/share/munin/plugins/redis_ redis_127.0.0.1_6379
- redisにパスワードを指定している場合は、下記コンフィグファイルを追加し、パスワードを設定する
cat << '_EOT_' > /etc/munin/plugin-conf.d/redis
[redis_*]
env.password passswwwword
_EOT_
* 動作確認
```bash
munin-run redis_127.0.0.1_6379
-----
multigraph redis_clients_6379
clients.value 1
multigraph redis_blocked_clients_6379
blocked.value 0
multigraph redis_memory_6379
memory.value 1777184
multigraph redis_fragmentation_6379
frag.value 2.01
multigraph redis_total_connections_6379
connections.value 48221
multigraph redis_expired_keys_6379
expired.value 0
multigraph redis_evicted_keys_6379
evicted.value 0
multigraph redis_pubsub_channels_6379
channels.value 0
multigraph redis_commands_6379
commands.value 317025
hits.value 44456
misses.value 957
multigraph redis_dbs_6379
db0keys.value 729
db0expires.value 291
-----