「Linux/muninインストール」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→nginxのphpfpm_statusにアクセスできいるように) |
(→nginxのstatusにアクセスできいるように) |
||
| 行31: | 行31: | ||
;pm.status_path = /status | ;pm.status_path = /status | ||
pm.status_path = /phpfpm_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 | ||
==参考== | ==参考== | ||
https://tech.basicinc.jp/articles/8 | https://tech.basicinc.jp/articles/8 | ||
nginx + PHP-FPMをmuninでリソース監視する | nginx + PHP-FPMをmuninでリソース監視する | ||
2018年1月24日 (水) 14:24時点における版
目次
muninインストール準備
# yum install munin --enablerepo=epel
apacheのmunin設定
# vi /etc/httpd/conf.d/munin.conf
muninの設定
# vi /etc/munin/munin-node.conf
監視されるサーバの場合は監視元サーバのIPを追加
allow ^192\.168\.0\.2$
監視されるmuninのcron設定
# vi /etc/cron.d/munin
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
参考
https://tech.basicinc.jp/articles/8 nginx + PHP-FPMをmuninでリソース監視する
