ngxtop实时监控nginx

1. 安装ngxtop

yum install python python-pip -y

yum install ngxtop  -y

2 配置 nginx 日志

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                         '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
    
    access_log  logs/access.log  main;

3监控

1 [root@hadoop1 logs]# ngxtop -c /usr/local/nginx/conf/nginx.conf 
Error: access log file "logs/access.log" does not exist
有问题 没有找到  "logs/access.log"

2 ngxtop -c /usr/local/nginx/conf/nginx.conf  -l /usr/local/nginx/logs/access.log 

起动成功

结果:

访问量前十的IP

ngxtop -c /usr/local/nginx/conf/nginx.conf top remote_addr -l /usr/local/nginx/logs/access.log 

注意 :空格

结果:

posted on 2021-01-07 15:01  shumeigang  阅读(173)  评论(0编辑  收藏  举报

导航