配置php-fpm
在php-fpm/www.conf文件中添加下面的配置:
pm.status_path= /status
ping.path = /ping
配置nginx
server {
listen 9010;
# outside of the container
#allow 127.0.0.1;
#deny all;
location ~ ^/\(status|ping)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
如果是在docker内部,需要添加一下端口映射
安装exporter
wget https://github.com/bakins/php-fpm-exporter/releases/download/v0.6.1/php-fpm-exporter.linux.amd64 -O /usr/local/src/php-fpm-exporter
# change permission
chmod +x /usr/local/src/php-fpm-exporter
# start php-fpm-exporter
nohup /usr/local/src/php-fpm-exporter --addr 0.0.0.0:9190 --endpoint http://127.0.0.1:9010/status &> /dev/null &
Grafana配置
在Grafana页面中导入相应的dashboard,编号为3901。
参考文献
https://iluoy.com/articles/282#%E7%9B%91%E6%8E%A7php-fpm
https://www.yuque.com/idevops/slhwwz/qrawhi
https://blog.csdn.net/ffzhihua/article/details/88846642
https://easyengine.io/tutorials/php/fpm-status-page/
https://github.com/hipages/php-fpm_exporter
https://github.com/bakins/php-fpm-exporter
https://www.jianshu.com/p/302b6ed4f4e2
https://awesomeopensource.com/project/hipages/php-fpm_exporter
https://awesomeopensource.com/project/Lusitaniae/phpfpm_exporter
网友评论