Zabbix监控nginx
跳到导航
跳到搜索
office
nginx -V 2>&1 | grep -o with-http_stub_status_module. Example configuration of Nginx: 直接加在 nginx.conf location = /basic_status { stub_status; allow 127.0.0.1; allow ::1; deny all; } 一般我放的位置 参数不一致 不过官方用过了 爽 可用 server { listen 80 default_server; listen [::]:80 default_server; server_name _; #charset koi8-r; #access_log logs/host.access.log main; #evan location /nginx_stat { stub_status on; access_log off; allow 127.0.0.1; deny all; } #evan 官方模板有 4个图 只有一个 Nginx: Connections by state Nginx: Connections by state 900 200 正常 Nginx: Connections per second 900 200 正常 Nginx: Memory usage 900 200 正常 Nginx: Requests per second 还有报警的要改 可以用 666 告警信息: Nginx: Failed to fetch stub status page (or no data for 30m) 告警项目:web.page.get["localhost","basic_status","80"] 最后添加官方模板 Template App Nginx by Zabbix agent
3rd_party
官方推荐
https://github.com/mjwtc0722/zabbix-nginx-status
#隐私问题 目录不全 openresty/nginx/sbin/nginx -V 2>&1 | grep -o with-http_stub_status_module with-http_stub_status_module 脚本 chmod +x /etc/zabbix/scripts/nginx_status.sh vi /etc/zabbix/zabbix_agentd.d/userparameter_nginx.conf server { listen 80 default_server; listen [::]:80 default_server; server_name _; #charset koi8-r; #access_log logs/host.access.log main; #evan location /nginx_stat { stub_status on; access_log off; allow 127.0.0.1; deny all; } #evan location / { root html; index index.ht curl http://127.0.0.1/nginx_stat Active connections: 4 server accepts handled requests 126582804 126582804 126582907 Reading: 0 Writing: 4 Waiting: 0 不能放在最后呀 虽然没语法错误 server { listen 80; location /nginx_stat { stub_status on; access_log off; allow 127.0.0.1; deny all; } } template 下的 Template App Nginx 好像也不对 下午再看一下是哪个 template 但看起来有数据了 就他吧 openresty -t openresty -s reload 最后要重启 zabbix agent