tengine监控,


tengine监控

连接数监控

server {
        listen 80;
        server_name  localhost;
        
        location /status{
                #开启监控
                stub_status on;
                #关闭access日志
                access_log off;
                #允许哪台机器访问
                #allow 127.0.0.1;
                #拒绝哪台机器访问
                #deny all;
            }
}        

负载均衡监控

server {
        listen 80;
        server_name  localhost;
        
        location /upstream{
            #用check_status模块监控
            check_status;
            #关闭access日志
            access_log off;
        }
}        

并发请求数监控

每秒并发数请求(只能用同天数据)

[root@tengine logs]# awk '{print $4}' access.log | sort -r | uniq -c | head -10
      2 [28/Feb/2022:21:24:29
      5 [28/Feb/2022:15:24:29

访问ip最多

[root@tengine logs]# awk '{print $1}' access.log | uniq -c | sort -nr | head -10
      2 192.168.188.136
      2 192.168.188.135
      2 192.168.188.134
      1 192.168.188.133

状态码统计

[root@tengine logs]# awk '{print $9}' access.log | uniq -c | sort -nr | head -10
      7 404

相关内容