zabbix监控php

2019-08-07  本文已影响0人  zwb_jianshu

一、开启监控页面

vim /etc/php-fpm.d/www.conf
pm.status_path = /php_status
vim /etc/nginx/nginx.conf
location /php_status { 
  fastcgi_pass 127.0.0.1:9000; 
  fastcgi_index index.php; 
  fastcgi_param SCRIPT_FILENAME html$fastcgi_script_name; 
  include fastcgi_params; 
}
systemctl restart php-fpm.service nginx.service
image.png

二、导入模板

image.png image.png image.png

三、准备zabbix的配置文件,并测试脚本

mkdir /server/scripts
vim /etc/zabbix/zabbix_agentd.d/fpm.conf
UserParameter=php-fpm[*],/bin/bash /server/scripts/fpm.sh "$1" "$2"
sh /server/scripts/fpm.sh "total processes" http://127.0.0.1/php_status
systemctl restart zabbix-agent
systemctl restart  nginx  php-fpm

四、在zabbix-server上zabbix-get测试取值

zabbix_get -s 10.0.0.12 -k php-fpm["total processes",http://127.0.0.1/php_status]

五、链接模板

image.png

六、查看监控

image.png
上一篇下一篇

猜你喜欢

热点阅读