LSX-blog

Feed Rss

【收录】Nginx 状态监控

03.17.2013, 监控, by .

通过查看Nginx的并发连接,我们可以更清楚的知道网站的负载情况。Nginx并发查看有两种方法(之所以这么说,是因为笔者只知道两种),一种是通过web界面,一种是通过命令,web查看要比命令查看显示的结果精确一些。下面介绍这两种查看方法

No1、通过浏览器查看

通过web界面查看时Nginx需要开启status模块,也就是安装Nginx时加上

–with-http_stub_status_module

然后配置Nginx.conf,在server点里面加入如下内容

location /nginx_status { stub_status on;allow 192.168.1.100; deny all; }

配置完后重新启动Nginx后

我们可以通过浏览器访问http://localhost/status 查看,如下样式

 

Active connections:1 server accepts handled requests 8 8 500 Reading:0 Writing:1 Waiting:0

解析:
Active connections    //当前 Nginx 正处理的活动连接数。
server accepts handledrequests //总共处理了8 个连接 , 成功创建 8 次握手,

总共处理了500个请求。
Reading //nginx 读取到客户端的 Header 信息数。
Writing //nginx 返回给客户端的 Header 信息数。
Waiting //开启 keep-alive 的情况下,这个值等于 active – (reading + writing),

意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接


No2、通过命令查看
#netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

TIME_WAIT 17
ESTABLISHED 3254
LAST_ACK 236
FIN_WAIT_1 648
FIN_WAIT_2 581
CLOSING 7
CLOSE_WAIT 4916

解析:
CLOSED  //无连接是活动的或正在进行
LISTEN  //服务器在等待进入呼叫
SYN_RECV  //一个连接请求已经到达,等待确认
SYN_SENT  //应用已经开始,打开一个连接
ESTABLISHED  //正常数据传输状态/当前并发连接数
FIN_WAIT1  //应用说它已经完成
FIN_WAIT2  //另一边已同意释放
ITMED_WAIT  //等待所有分组死掉
CLOSING  //两边同时尝试关闭
TIME_WAIT  //另一边已初始化一个释放
LAST_ACK  //等待所有分组死掉

【收录】Nginx 状态监控 有 29 条回应

  1. Please let me know if you’re looking for a writer for your blog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d really like to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Regards!| а

    回复
  2. I really like what you guys are usually up too. This type of clever work and exposure!

    Keep up the superb works guys I’ve added you guys
    to blogroll.

    回复
  3. We’re a group of volunteers and starting a new scheme in our
    community. Your website provided us with valuable info to
    work on. You have done a formidable job and our entire community will be thankful to
    you.

    回复
  4. You could definitely see your expertise in the work you write.
    The arena hopes for more passionate writers such as
    you who are not afraid to mention how they believe. All the time follow your heart.

    回复
  5. Very good blog! Do you have any hints for aspiring writers?
    I’m planning to start my own blog soon but I’m a little lost on everything.
    Would you suggest starting with a free platform like WordPress or
    go for a paid option? There are so many choices out there that I’m completely confused ..
    Any tips? Bless you!

    回复
  6. Howdy, i read your blog from time to time and
    i own a similar one and i was just curious
    if you get a lot of spam feedback? If so how do you protect against it, any plugin or anything
    you can advise? I get so much lately it’s driving me mad so any support is very much appreciated.

    回复
  7. This excellent website truly has all of the information and facts I wanted about
    this subject and didn’t know who to ask.

    回复
  8. Hi, i feel that i saw you visited my site thus i got here to go back the want?.I am attempting to find things to enhance my website!I guess
    its good enough to make use of some of your ideas!!

    回复
  9. Sweet blog! I found it while surfing around on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while
    but I never seem to get there! Cheers

    回复
  10. I am extremely impressed with your writing skills as well as
    with the layout on your weblog. Is this a paid theme or did you customize it yourself?
    Anyway keep up the nice quality writing, it’s rare to see a nice blog like this one today.

    回复
  11. You actually make it seem so easy with your presentation but I
    find this topic to be actually something that I think
    I would never understand. It seems too complex and very broad for me.
    I’m looking forward for your next post, I will try to get the hang of it!

    回复
  12. At this moment I am going away to do my breakfast, after having my breakfast coming over again to read further
    news.

    回复
  13. My partner and I stumbled over here from a different page and thought
    I might check things out. I like what I see so i am just following you.
    Look forward to finding out about your web page for a second time.

    回复
  14. Bom dia tudo joia? adorei do seu comentário, bem curioso se pensamos da maneira como você relatou. É verdade que vinga uma hora em que devemos cortar as asas e deixar. É penoso mas será bom para a criatura que vai aprender com seus desacertos e acertos. Um grande abraço companheiro.

    回复
  15. Wow! This blog looks just like my old one! It’s on a completely different subject but it
    has pretty much the same page layout and design. Superb choice of colors!

    回复
  16. Very nice article, just what I wanted to find.

    回复
  17. I loved as much as you will receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get got an edginess over that you wish be delivering the following.
    unwell unquestionably come further formerly again since exactly the same nearly a lot often inside case
    you shield this hike.

    回复
  18. You really make it seem really easy with your presentation but I to find this topic to be really one
    thing that I believe I would by no means understand.
    It kind of feels too complex and extremely wide for me.
    I am taking a look forward on your next post, I will try to get the dangle of it!

    回复
  19. Hello just wanted to give you a quick heads up and let you know a
    few of the pictures aren’t loading properly. I’m not sure why but
    I think its a linking issue. I’ve tried it in two different browsers and
    both show the same results.

    回复
  20. Marvelous, what a web site it is! This web site presents helpful data to us, keep
    it up.

    回复
  21. Very good info. Lucky me I ran across your website by chance (stumbleupon).
    I have saved as a favorite for later!

    回复
  22. Thank you for the auspicious writeup. It in fact was a amusement account it.
    Look advanced to far added agreeable from you!
    By the way, how can we communicate?

    回复
  23. I don’t even know how I ended up here, but I thought this post was great.
    I don’t know who you are but certainly you’re going to a famous blogger
    if you are not already 😉 Cheers!

    回复
  24. It is not my first time to pay a quick visit this site, i am browsing this site dailly and obtain pleasant
    information from here everyday.

    回复
  25. Wow, incredible blog layout! How long have you been blogging
    for? you make blogging look easy. The overall look of your site is wonderful, let alone the content!

    回复
  26. I’ve been browsing online more than 2 hours
    today, yet I never found any interesting article like
    yours. It is pretty worth enough for me. In my view, if all web owners
    and bloggers made good content as you did, the net will
    be a lot more useful than ever before.

    回复
  27. Spot on with this write-up, I honestly believe that this site needs a
    lot more attention. I’ll probably be returning to read through more, thanks for the advice!

    回复
  28. What i don’t realize is if truth be told how you are not
    really a lot more neatly-appreciated than you might be now.
    You are so intelligent. You realize therefore significantly in terms of this subject, made me for my part believe it from a
    lot of numerous angles. Its like men and women aren’t fascinated
    except it is one thing to do with Lady gaga! Your individual
    stuffs nice. All the time care for it up!

    回复
  29. Have you ever considered writing an e-book or guest authoring on other sites?
    I have a blog based upon on the same information you discuss and would love to
    have you share some stories/information. I know my audience would value your
    work. If you are even remotely interested, feel free to send me an e mail.

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注