| ?1、下载php的export,命令如下:
 地址:https://github.com/bakins/php-fpm-exporter/releases
 
 注意:不要下载zip文件,需要自己手动用go环境编译。对于go语言不熟悉的人,会编译失败。
 
  ? 安装php-fpm-export mkdir -p /usr/local/php-fpm-exporter
mv php-fpm-exporter.linux.amd64 ? /usr/local/php-fpm-exporter/php-fpm-exporter
chmod +x /usr/local/php-fpm-exporter/php-fpm-exporter
 启动php-fpm-export cd ?/usr/local/php-fpm-exporter
nohup ./php-fpm-exporter --addr 0.0.0.0:9190 --endpoint http://127.0.0.1/fpm_status ?> /usr/local/php-fpm-exporter/php-fpm-exporter.log 2>&1 &
 配置prometheus的配置文件
 # vim /usr/local/prometheus/prometheus.yml
scrape_configs:
? - job_name: 'PHP-FPM'
? ? static_configs:
? ? ? - targets:
? ? ? ? - 192.168.202.131:9190
 重启prometheus服务
 systemctl restart prometheus
 prometheus主机查看php-fpm的监控数据 http://IP:9090
 下载grafana模板
 dashboards.id 推荐3901
 模板地址:https://grafana.com/dashboards/3901
 安装grafana
 wget https://dl.grafana.com/oss/release/grafana-8.1.1-1.x86_64.rpm
sudo yum install grafana-8.1.1-1.x86_64.rpm
 启动grafana?
 systemctl start grafana-server
 把下载好的模板导入到grafana中?
 |