1. 环境
- php-fpm-exporter.linux.amd64
php-fpm-exporter 用来收集机器的php 指标
 
2. 准备条件
2.1 PHP-FPM端
# vim /etc/php-fpm.d/www.confpm.status_path = /statusping.path = /ping# 重启php-fpmsystemctl restart php-fpm
2.1 Nginx端
# vim /etc/nginx/conf.d/php-fpm-status.confserver {listen 9010;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;}}# 加载配置systemctl reload nginx
2.3 PHP-FPM-exporter端
一般情况下, php-fpm-exporter 与 php-fpm 在同一个机器上
# 下载php-fpm-exporter --> https://github.com/bakins/php-fpm-exporter/releaseswget https://github.com/bakins/php-fpm-exporter/releases/download/v0.6.1/php-fpm-exporter.linux.amd64 -O /usr/local/src/php-fpm-exporterchmod +x /usr/local/src/php-fpm-exporter# 启动 php-fpm-exporternohup /usr/local/src/php-fpm-exporter --addr 0.0.0.0:9190 --endpoint http://127.0.0.1:9010/status &> /dev/null &
2.4 Prometheus端
- job_name: php-fpmstatic_configs:- targets: ['<host>:<port>']labels:instance: PRODUCT-NAME
