Zabbix-server:172.21.97.153
Zabbix-agent(Nginx):172.17.27.61
# Nginx日志如下:
# head -3 Syz.access.log
www.qcxin.com 39.67.200.12 [17/Aug/2018:01:20:55 +0800] "GET /pci-doctor/api/verification_code/register?mobile=17686984883 HTTP/1.1" 404 162 "-" "Dalvik/2.1.0 (Linux; U; Android 5.1.1; vivo Xplay5A Build/LMY47V)" 0.000 - 172.17.27.60 www.qcxin.com 58.214.14.250 [17/Aug/2018:01:22:17 +0800] "GET /pci-doctor/api/verification_code/register?mobile=13717177753 HTTP/1.1" 404 162 "-" "Dalvik/2.1.0 (Linux; U; Android 6.0; M5 Build/MRA58K)" 0.000 - 172.17.27.60 www.qcxin.com 120.229.234.239 [17/Aug/2018:01:24:22 +0800] "GET /pci-doctor/api/verification_code/register?mobile=18306648785 HTTP/1.1" 404 162 "-" "Dalvik/2.1.0 (Linux; U; Android 6.0.1; MI 4LTE MIUI/8.2.1)" 0.000 - 172.17.27.60
# 通过日志提取访问信息,脚本如下:
[root@sicknginx1 ~]# cat /kzh/scripts/traffic_statistics_all.sh
#!/bin/bash #==================================================== # Author: kazihuo # Create Date: 2018-08-17 # Description: Traffic statistics with UV and PV. #==================================================== #UV uv(){ cat /logs/www.Syz.com/Syz.access.log |awk '{print $2}'|sort|uniq -c|wc -l } #PV pv(){ cat /logs/www.Syz.com/Syz.access.log |awk '{print $6}'|wc -l } $1
# 添加item;
# 创建Granphs;
# 创建完后在MonitoringàScreensàCreate screen;将创建的Granphs链接进来即可;效果如下:
-------------------------------------------------------------
作者:罗穆瑞
转载请保留此段声明,且在文章页面明显位置给出原文链接,谢谢!
------------------------------------------------------------------------------
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
------------------------------------------------------------------------------