Prometheus监控PHP-FPM

环境

系统:CentOS 7.5
软件:php-fpm-exporter.linux.amd64

准备

PHP-FPM端

  • 下载php-fpm-exporter
    地址:https://github.com/bakins/php-fpm-exporter/releases

  • 安装php-fpm-exporter

    # mkdir -p /usr/local/prometheus/php-fpm-exporter
    # mv php-fpm-exporter.linux.amd64 /usr/local/prometheus/php-fpm-exporter/php-fpm-exporter
    # chmod +x /usr/local/prometheus/php-fpm-exporter/php-fpm-exporter
    
  • 启动php-fpm-exporter

    # nohup /usr/local/prometheus/php-fpm-exporter/php-fpm-exporter --addr 0.0.0.0:9190 --endpoint http://127.0.0.1:9010/status > /usr/local/prometheus/php-fpm-exporter/php-fpm-exporter.log 2>&1 &
    

Prometheus端

  • 配置Prometheus

    # vim /usr/local/prometheus/prometheus.yml
    scrape_configs:
      - job_name: 'PHP-FPM'
        static_configs:
          - targets:
            - yuantong.zjcx-local.com:9190
    
  • 重启Prometheus

    # systemctl restart prometheus
    

Grafana端

  • 添加dashboards
    点击CreateImport,输入dashboards的id(推荐)
    原文作者:袁先生的教程
    原文地址: https://www.jianshu.com/p/302b6ed4f4e2
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞