目录
5.设置nginx ,设置代理php,和php-fpm的状态页面匹配
3.创建一个模板,在模板上创建4个item监控项,使用定义的用户参数
[root@localhost ~]#yum -y install php-fpm
vim /etc/php-fpm.d/www.conf
user = nginx
group = nginx
pm.status_path = /php-fpm-status #php-fpm 的状态监测页面
ping.path = /ping #ping 接口,存活状态是否ok
ping.response = pong #响应内容pong
[root@localhost ~]# systemctl start php-fpm
参考博主博客?Nginx介绍与安装-CSDN博客
vim /etc/nginx/conf.d/php.conf
server {
listen 80;
server_name localhost;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* /(php-fpm-status|ping) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
include fastcgi_params;
allow 127.0.0.1; #因为这个页面很重要,所有需加访问控制
deny all;
access_log off; #访问这个页面就不用记录日志了
}
}
[root@localhost ~]# systemctl restart nginx
[root@localhost ~]# curl 10.12.153.189/php-fpm-status
[root@localhost ~]# vim? /etc/zabbix/zabbix_agentd.d/php-fpm.conf
UserParameter=php-fpm.stats[*],curl -s 127.0.0.1/php-fpm-status | awk '/^$1/{print $$NF}'
[root@localhost ~]# systemctl restart zabbix-agent
[root@localhost ~]# yum -y install zabbix-get
安装zabbix-server参考博主博客配置zabbix监控平台-CSDN博客
[root@localhost ~]# zabbix_get -s 192.168.30.7 -p 10050 -k "php-fpm.stats[idle]"
4
[root@localhost ~]# zabbix_get -s 192.168.30.7 -p 10050 -k "php-fpm.stats[active]"
1
[root@localhost ~]# zabbix_get -s 192.168.30.7 -p 10050 -k "php-fpm.stats[max active]"
1
?