munin 配置php-fpm监控

修改php-fpm配置

vim /data/local/webserver/php/etc/php-fpm.conf

把前面注释去掉     
pm.status_path = /status     

重启php
ps -aux | grep php
kill xxxx
/data/local/webserver/php/sbin/php-fpm -c /data/local/webserver/php/etc/php.ini

编辑nginx配置文件
vim /data/local/webserver/nginx/conf/nginx.conf

增加配置
location ~ ^/(status|ping)$
{
	fastcgi_pass  unix:/tmp/php-cgi.sock;
	include fastcgi.conf;
}

查看php-fpm status 监控是否成功
http://XX.XX.XX.XX/status

进入插件目录
cd /usr/share/munin/plugins

下载munin php-fpm插件
https://github.com/tjstein/php5-fpm-munin-plugins

增加执行权限
chmod +x php5-fpm-munin-plugins/phpfpm_*

#给插件软连到/etc/下
ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_average /etc/munin/plugins/phpfpm_average
ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_connections /etc/munin/plugins/phpfpm_connections
ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_memory /etc/munin/plugins/phpfpm_memory
ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_status /etc/munin/plugins/phpfpm_status
ln -s /usr/share/munin/plugins/php5-fpm-munin-plugins/phpfpm_processes /etc/munin/plugins/phpfpm_processes

重启munin
service munin-node restart

查看插件是否运行
munin-run phpfpm_memory
ram.value 277811200


你可能感兴趣的:(PHP,Munin)