「Linux/muninインストール」の版間の差分
提供: 初心者エンジニアの簡易メモ
| 行1: | 行1: | ||
| − | = | + | =監視する側のmunin設定= |
| + | |||
==muninインストール準備== | ==muninインストール準備== | ||
# yum install munin --enablerepo=epel | # yum install munin --enablerepo=epel | ||
| 行25: | 行26: | ||
==muninの設定== | ==muninの設定== | ||
# vi /etc/munin/munin-node.conf | # vi /etc/munin/munin-node.conf | ||
| − | |||
| − | |||
| − | |||
==munin起動== | ==munin起動== | ||
| 行37: | 行35: | ||
sudo -u munin munin-cron | sudo -u munin munin-cron | ||
| − | == | + | ==muninのcron設定== |
# vi /etc/cron.d/munin | # vi /etc/cron.d/munin | ||
| − | == | + | =監視される側のmunin設定= |
| + | |||
| + | ==muninインストール準備== | ||
| + | # yum install munin --enablerepo=epel | ||
| + | |||
| + | ==監視されるサーバの場合は監視元サーバのIPを追加== | ||
| + | # vi /etc/cron.d/munin | ||
| + | allow ^192\.168\.0\.2$ | ||
| + | |||
| + | ==nginx監視== | ||
php-fpmで使えるように | php-fpmで使えるように | ||
cd /usr/share/munin/plugins | cd /usr/share/munin/plugins | ||
| 行52: | 行59: | ||
ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_status phpfpm_status | ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_status phpfpm_status | ||
| − | ==nginxのstatusにアクセスできるように== | + | ===nginxのstatusにアクセスできるように=== |
# vi /etc/php-fpm.d/www.conf | # vi /etc/php-fpm.d/www.conf | ||
;pm.status_path = /status | ;pm.status_path = /status | ||
| 行86: | 行93: | ||
env.phpbin php-fpm | env.phpbin php-fpm | ||
| − | ==監視稼働確認== | + | ==監視稼働確認(phpfpmの場合)== |
/usr/sbin/munin-run phpfpm_average | /usr/sbin/munin-run phpfpm_average | ||
2018年4月19日 (木) 11:05時点における版
目次
監視する側のmunin設定
muninインストール準備
# yum install munin --enablerepo=epel
munin管理画面を表示
apacheの場合
# vi /etc/httpd/conf.d/munin.conf
ngxinの場合
# vi /etc/nginx/conf.d/munin.localhost.conf
server {
listen 80;
server_name munin.localhost;
location / {
alias /var/www/munin/;
}
location /nginx_status {
stub_status on;
access_log off;
}
location = /50x.html {
root /usr/share/nginx/html;
}
}
muninの設定
# vi /etc/munin/munin-node.conf
munin起動
service munin-node start
5分すると/var/www/muninにhtmlファイルが追加さmunin.localhostが表示できるようになる
5分待てなければ以下を実行
sudo -u munin munin-cron
muninのcron設定
# vi /etc/cron.d/munin
監視される側のmunin設定
muninインストール準備
# yum install munin --enablerepo=epel
監視されるサーバの場合は監視元サーバのIPを追加
# vi /etc/cron.d/munin allow ^192\.168\.0\.2$
nginx監視
php-fpmで使えるように
cd /usr/share/munin/plugins sudo git clone git://github.com/tjstein/php5-fpm-munin-plugins.git sudo chmod +x php5-fpm-munin-plugins/phpfpm_* cd /etc/munin/plugins/ ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_average phpfpm_average ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_connections phpfpm_connections ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_memory phpfpm_memory ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_processes phpfpm_processes ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_status phpfpm_status
nginxのstatusにアクセスできるように
# vi /etc/php-fpm.d/www.conf ;pm.status_path = /status pm.status_path = /phpfpm_status
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location /phpfpm_status {
include fastcgi_params;
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
allow 127.0.0.1;
deny all;
}
}
以下で動作確認
wget http://localhost/phpfpm_status
監視対象サービス追加
vi /etc/munin/plugin-conf.d/munin-node [nginx*] env.url http://localhost/nginx_status [phpfpm*] env.url http://localhost/phpfpm_status env.phpbin php-fpm
監視稼働確認(phpfpmの場合)
/usr/sbin/munin-run phpfpm_average
監視サーバ追加
vi /etc/munin/munin.conf
[localhost] address 127.0.0.1 use_node_name yes [test1.example.com] address 192.168.xxx.xxx use_node_name yes
参考
https://tech.basicinc.jp/articles/8 nginx + PHP-FPMをmuninでリソース監視する
