If there is data return, the Zabbix communication is normal, if return zbx_notsupported, it indicates that there is a problem with the monitor. Enter the system configuration-> host-> Monitor to see if your client host's monitor is active or not, and you must reboot after configuring Agentd. /usr/local/webserver/zabbix/bin/zabbix_get-s 192.168.0.253-p10050-k "Nginx.accepts"
I have been using Zabbix for a long time to monitor more things, and I am now in the first step to achieve the original plan. It has to be said that its free customization function is really strong. Let's get started.
Implementing monitoring requires three steps:
1. Create or import templates yourself. < accessories >
2, Nginx need to configure status.
This is because of the environment, I put on my bar.
server {Listen 80; server_name xxx.baidu.com; Index index.html login.jsp; Root/www/freetrade; Access_log off; Error_log off; Location/nginx {stub_status on; Access_log off; Allow 127.0.0.1; #服务端IP allow xxx.xxx.xxx.xxx; Deny all; } }
3, change the client configuration file, use the script.
Place the script anywhere on the client machine, but I suggest you put it in one place. I changed it on the basis of the author to suit my needs.
#!/bin/bash # script to fetch nginx statuses for tribily monitoring systems # author: krish@toonheart.com # License: gplv2 # set variables host= "xxx.baidu.com" port= "no" # functions to return nginx stats function Active { /usr/bin/curl-s http ://$HOST: $PORT "| grep ' Active ' | awk ' {print $NF} ' } function reading { /usr/bin/curl-s ' http://$HOST: $PORT ' | grep ' reading ' | awk ' { Print $} ' } function writing { /usr/bin/curl-s ' http://$HOST: $PORT ' | grep ' writing ' | awk ' {print $ 4} ' } function waiting { /usr/bin/curl-s ' http://$HOST: $PORT ' | grep ' waiting ' | awk ' {print $} ' &NB Sp function accepts { /usr/bin/curl-s "http://$HOST: $PORT" | awk nr==3 | awk ' {print} ' } function h andled { /usr/bin/curl -s "http://$HOST: $PORT" | awk nr==3 | awk ' {print $} ' } function requests { /usr/bin/curl-s ' http://$HOST: $PORT ' | awk nr==3 | awk ' {PRINT $} ' } # run the requested function $1
Modify client/etc/zabbix/zabbix_agentd.conf environment, file location is different.
#monitor Nginx Userparameter=nginx.accepts,/etc/zabbix/scripts/nginx_status accepts userparameter=nginx.handled,/ Etc/zabbix/scripts/nginx_status handled Userparameter=nginx.requests,/etc/zabbix/scripts/nginx_status requests Userparameter=nginx.connections.active,/etc/zabbix/scripts/nginx_status Active userparameter= Nginx.connections.reading,/etc/zabbix/scripts/nginx_status Reading userparameter=nginx.connections.writing,/etc/ Zabbix/scripts/nginx_status Writing Userparameter=nginx.connections.waiting,/etc/zabbix/scripts/nginx_status Waiting
There is a picture to the truth. < several free nginx>
Related Accessories Download
free download address in http://linux.linuxidc.com/
username and password are www.linuxidc.com
download Directory in /2012/7/9th/Use Zabbix monitoring nginx/