Quick Nginx Status Script
来源:互联网 发布:阿里云怎么开放端口 编辑:程序博客网 时间:2024/06/01 12:18
Just to share another script that I hacked together to monitor my sites. Nginx is a great web server software and since I last wrote about it more than 2 years ago, I have since pretty much converted all my sites to Nginx (sorry Lighttpd).
Nginx came with this HTTP stub status module that you can get the current server status in a HTML page. However it’s not pretty comparing to Lighttpd’s and Apache’s. Moreover, the information it provides is a bit cryptic.
For example, when you browse to the stub status page (please referto the wiki document linked earlier on how to set it up), all you getis 4 lines of text:
$ curl http://myserver/nginx_status
Active connections: 183
server accepts handled requests
914384 914384 2725561
Reading: 3 Writing: 2 Waiting: 178
Not very meaningful. Instead, I wrote a small Python script (download here: nginxstats.py (2.3kb)) that does something like this:
$ ./nginxstats.py http://myserver/nginx_status
Conn Conn/s Request/s Read Write Wait
-------- ---------- ---------- ----- ----- -----
157 9.57 31.07 0 2 155
140 10.20 36.13 0 1 139
147 9.33 33.60 0 4 143
189 12.60 40.07 1 4 184
164 13.07 41.53 5 2 157
Basically it fetches the data from the stub status page every 30seconds (configurable in the script) and then do some calculation tofind out how many connections have been established within the timeframe, and what’s the average connections/second and requests/second.Similar to tools like vmstat
, it basically runs continuously (until interrupted).
Very useful when you are getting slashdotted :)
- Quick Nginx Status Script
- nginx status
- Unix script 15 - quick reference
- nginx 499 status
- A quick way to get memcached status
- nginx init.d script
- My first GreaseMonkey Script: VeryCD quick search
- nginx开启status模块监控
- nginx status 状态信息查看
- 启用nginx status状态详解
- OpenResty(2)--Nginx script command
- .NET 动态脚本语言Script.NET 入门指南 Quick Start
- Qt的Script、Quick、QML的关系与总结
- Qt的Script、Quick、QML的关系与总结
- .NET 动态脚本语言Script.NET 入门指南 Quick Start
- 开启nginx的status和php-fpm的status页面
- [Script]Check status of all the Concurrent Managers
- subprocess pre-removal script returned error exit status... 处理办法
- ubuntu下交叉编译
- [JS] JavaScript语法集锦
- 文本框样式代码
- J2ME polish使用心得二
- Nagios configuration Tools (Web frontends or GUI)
- Quick Nginx Status Script
- oracle 10g透明网关访问sqlserver2000
- 做人、做事,做架构师
- VC++ 的MFC 和ATL 及COM 是什么?
- c++中__declspec用法总结
- Application, Session, Cookie, Viewstate, Cache对象用法和区别(转)
- Lucene in Action(中文版)
- 服装品牌SPA利器,成就谁的未来?
- Win32调试API原理