一、通过pip工具安装
https://pypi.python.org/pypi/pip#downloads
cd /opt/
tar xzvf pip-1.5.6.tar.gz
cd /opt/pip-1.5.6
python setup.py install
pip install ngxtop
ngxtop -c /usr/local/nginx/conf/nginx.conf
二、手动安装
https://pypi.python.org/pypi/setuptools#downloads
unzip setuptools-5.4.1.zip
cd ./setuptools-5.4.1
python setup.py install
https://github.com/lebinh/ngxtop/
unzip ngxtop-master.zip
cd /opt/ngxtop-master
python setup.py install
ngxtop -h
ngxtop -c /usr/local/nginx/conf/nginx.conf
总结:不管是用什么方式安装,log需要存放在/var/log/nginx下
[root@dm02 ~]# /usr/local/nginx/sbin/ngxtop -c /usr/local/nginx/conf/nginx.conf
running for 594 seconds, 2479 records processed: 4.17 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 2479 | 13953.418 | 2422 | 0 | 57 | 0 |
Detailed:
| request_path | count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|----------------+---------+------------------+-------+-------+-------+-------|
| /index.php | 1466 | 2296.791 | 1458 | 0 | 8 | 0 |
| / | 1013 | 30822.733 | 964 | 0 | 49 | 0 |
原文地址:http://blog.csdn.net/wych1981/article/details/38021345