On the internet to see a lot of monitoring nginx state, found that most of the configuration is more complex, I also wrote an automatic discovery of the script, welcome to shoot Bricks
Nginx_status specific configuration here is not much to say, here pretend you have been well-equipped!
#coding =utf-8import urllib,urllib2,urllib2import sys,jsonurl= "Http://112.124.32.164/nginx_status" li= ["Activeconnections", "Reading", "Writing", "Waiting"]js=[]if len (SYS.ARGV) < 2:for stat in li:js += [{' {#NGINXSTATUS} ': Stat}]print json.dumps ({' Data ': Js},sort_keys=true, Indent=4,separators= (', ', ': ')) else:arg=sys.argv[1]argm= "%s:" % argrequest = urllib2. Request (URL) response = urllib2.urlopen (request) result=response.readlines () loop=0dic={} For i in result:loop += 1if loop == 1:activeconnections=int (I.split (": ") [1]) dic[' activeconnections: ']=activeconnectionselif loop == 4:status=tuple (I.split (" ")) cloop=0for st in status:cloop += 1if cloop == 2 :d ic["Reading:"]= stelif cloop == 4:dic["Writing:"]=stelif cloop == 6:dic["Waiting:"]=stprint &NBSP;DIC[ARGM]
Zabbix_agent Custom Key-value configuration
Userparameter=nginx.status[*],/usr/bin/python/etc/zabbix/nginx_statu.py $
And then automatically discovers that the key value is
Nginx.status
Project prototype key value is
nginx.status[{#NGINXSTATUS}]
Big God don't squirt!
Zabbix Monitoring Nginx_status Auto Discovery Script