1、配置zabbix监控nginx状态。
开启Nginx状态数据配置,需要在nginx.conf中添加一个虚拟主机,内容如下
[root@zabbix conf.d]# cat test.conf
server {
listen 127.0.0.1:80;
server_name 127.0.0.1;
location /nginxstatus {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
[root@zabbix conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@zabbix conf.d]# nginx -s reload //加载配置
[root@zabbix conf.d]# curl http://127.0.0.1/nginxstatus //访问测试
Active connetctions: 1
server accepts handled requests
2 2 6
Reading: 0 Writing: 1 Waiting: 0