nginx 로그 방 문 량 통계
4765 단어 nginx로그 방 문 량 통계Linux
awk '{print $1}' access.log|sort | uniq -c |wc -l
2. 방문 URL 통계 PV
awk '{print $7}' access.log|wc -l
3. 가장 자주 방문 하 는 URL 조회
awk '{print $7}' access.log|sort | uniq -c |sort -n -k 1 -r|more
4. 가장 자주 방문 하 는 IP 조회
awk '{print $1}' access.log|sort | uniq -c |sort -n -k 1 -r|more
5. 시간 대별 로 그 를 보기
cat access.log| sed -n '/14\/Mar\/2015:21/,/14\/Mar\/2015:22/p'|more
zabbix 프로필 추가
vim /etc/zabbix/zabbix_server.conf
[html] view plain copy### Option: AlertScriptsPath
Full path to location of custom alert scripts.
Default depends on compilation options.
Mandatory: no
Default:
AlertScriptsPath=${datadir}/zabbix/alertscripts
AlertScriptsPath=/usr/local/zabbix/sbin
vim /usr/local/zabbix/sbin/nginx-status.py [python] view plain copyimport urllib2,base64,sys,getopt,re
def Usage(): print "Usage: Nginx-Status.py -h 127.0.0.1 -p 80 -a [active|accepted|handled|requests|reading|writting|waiting]" sys.exit(2)
def main(): if len(sys.argv) < 6: Usage()
try:
opts,args = getopt.getopt(sys.argv[1:], "h:p:a:")
Dict = dict(opts)
except getopt.GetoptError:
Usage()
Nginx_url = "http://" + Dict['-h'] + ":" + Dict['-p'] + "/nginx_status"
Nginx_req = urllib2.Request(Nginx_url)
Nginx_res = urllib2.urlopen(Nginx_req)
Output_key = re.findall(r'\d{1,8}', Nginx_res.read())
if ( Dict['-a'] == "active"):
print Output_key[0]
elif ( Dict['-a'] == "accepted"):
print Output_key[1]
elif ( Dict['-a'] == "handled"):
print Output_key[2]
elif ( Dict['-a'] == "requests"):
print Output_key[3]
elif ( Dict['-a'] == "reading"):
print Output_key[4]
elif ( Dict['-a'] == "writting"):
print Output_key[5]
elif ( Dict['-a'] == "waiting"):
print Output_key[6]
else:
print "unknown!!"
sys.exit(1)
if name == 'main': main()
nginx_status_templates.xml[html] view plain copy 2.0 2015-11-03T01:37:04Z nginx-status nginx-status nginx-status nginx-status nginx-accepted 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","accepted"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-active 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","active"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-handled 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","handled"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-reading 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","reading"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-requests 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","requests"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-waiting 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","waiting"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-writting 10 0 nginx-status.py["-h","{HOST.IP}","-p","80","-a","writting"] 30 90 365 0 3 0 0 0 0 1 0 0 0 nginx-clients-status 900 200 0.0000 100.0000 1 1 0 1 0 0.0000 0.0000 0 0 0 0 0 0 00C800 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","active"] 1 0 C80000 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","reading"] 2 0 0000C8 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","waiting"] 3 0 C800C8 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","writting"] nginx-socket-status 900 200 0.0000 100.0000 1 1 0 1 0 0.0000 0.0000 0 0 0 0 0 0 00C800 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","handled"] 1 0 0000C8 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","requests"] 2 0 C800C8 0 2 0 nginx-status nginx-status.py["-h","{HOST.IP}","-p","80","-a","accepted"]
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
간단! Certbot을 사용하여 웹 사이트를 SSL(HTTPS)화하는 방법초보자가 인프라 주위를 정돈하는 것은 매우 어렵습니다. 이번은 사이트를 간단하게 SSL화(HTTP에서 HTTPS통신)로 변경하는 방법을 소개합니다! 이번에는 소프트웨어 시스템 Nginx CentOS7 의 환경에서 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.