Environment: Centos 6.6
Configuration N Ginx:
[[email protected] ~]# grep -v ' # ' /etc/nginx/conf.d/default.conf|grep -v ^ $server { listen 80; server_name 172.24.17.131; include /etc/nginx/default.d/*. conf; root /var/www/html; location / { index index.html index.htm; } location /status { stub_status on; access_log on; allow 172.24.17.131; deny all; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; }}[[ email protected] ~]#
Note: The/status under Allow is important, related to whether the latter zabbix_get can get the value, if the acquisition does not show to the
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7F/78/wKiom1cfdymD0tFMAABBgRe3e6M835.png "title=" 1.png " alt= "Wkiom1cfdymd0tfmaabbgre3e6m835.png"/>
[Email protected] ~]# chmod a+x/usr/local/zabbix/bin/nginx_status.sh[[email protected] etc]# pwd/usr/local/zabbix/ Etc[[email protected] etc]# tail-2 zabbix_agentd.conf# Monitor nginxuserparameter=nginx.status[*],/bin/sh/usr/local/ zabbix/scripts/nginx_status.sh $1[[email protected] etc]#[[email protected] ~]# grep unsafeuserparameters/usr/local/ zabbix/etc/zabbix_agentd.conf### Option:unsafeuserparametersunsafeuserparameters=1//Turn on the custom script function, this can not open [[Emai L Protected] ~]#
Manual test to see if data can be obtained (Zabbix_get):
[Email protected] ~]# zabbix_get-s 172.24.17.131-k nginx.status[active]1[[email protected] ~]# zabbix_get-s 172.24.17. 131-k Nginx.status[accepts]163800[[email protected] ~]# zabbix_get-s 172.24.17.131-k nginx.status[handled]163801[[ Email protected] ~]# zabbix_get-s 172.24.17.131-k nginx.status[requests]163802[[email protected] ~]# zabbix_get-s 172.2 4.17.131-k Nginx.status[reading]0[[email protected] ~]# zabbix_get-s 172.24.17.131-k nginx.status[writing]1[[email Protected] ~]# zabbix_get-s 172.24.17.131-k nginx.status[waiting]0[[email protected] ~]#
Create a new template (or import a template) on the Zabbix GUI below:
Configuration--templates--create Template/import
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/78/wKiom1cfeEGiRM3ZAABSIAqwKMQ163.png "style=" float: none; "title=" 1.png "alt=" Wkiom1cfeegirm3zaabsiaqwkmq163.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/75/wKioL1cfeQuiHrdPAABdElqtWiE155.png "style=" float: none; "title=" 2.png "alt=" Wkiol1cfequihrdpaabdelqtwie155.png "/>
Then, on the Nginx status (Template), create a new items/graphs
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/75/wKioL1cfegnxPVaTAACV9QYVKcU919.png "style=" float: none; "title=" 1.png "alt=" Wkiol1cfegnxpvataacv9qyvkcu919.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/78/wKiom1cfeUHxLuu-AABxb-UYPDw774.png "style=" float: none; "title=" 2.png "alt=" Wkiom1cfeuhxluu-aabxb-uypdw774.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/78/wKiom1cfeUWjf8XOAACrU1i5Jyo235.png "style=" float: none; "title=" 3.png "alt=" Wkiom1cfeuwjf8xoaacru1i5jyo235.png "/>
Then link the template on the host.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/76/wKioL1cfeoWQRui7AAA9tKW4ZJo907.png "title=" 1.png " alt= "Wkiol1cfeowqrui7aaa9tkw4zjo907.png"/> final:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/78/wKiom1cfednSu-HWAAB-OoQSNTk661.png "title=" 1.png " alt= "Wkiom1cfednsu-hwaab-ooqsntk661.png"/>650) this.width=650; src= http://s5.51cto.com/wyfs02/M00/7F/76/ Wkiol1cfexmzq1ryaad7kxwkuf0044.png "title=" 1.png "alt=" Wkiol1cfexmzq1ryaad7kxwkuf0044.png "/>
This article from "Pengcheng-soy sauce bottle" blog, declined reprint!
Zabbix monitoring Nginx