ngxtop是用python開(kāi)發(fā)的一款監(jiān)控nginx訪問(wèn)日志的工具,
它可以實(shí)時(shí)動(dòng)態(tài)地查看訪問(wèn)最多的請(qǐng)求。
centos上安裝ngxtop
yum install python-pip
pip install ngxtop
用ngxtop -h查看其選項(xiàng),其中幾個(gè)選項(xiàng)含義如下:
1)-l 指定訪問(wèn)日志
2) -f 指定日志格式
3) --no-follow 只處理當(dāng)前已經(jīng)寫(xiě)入的日志文件,而不是實(shí)時(shí)處理新增的日志
4) -c 指定nginx.conf路徑
5) -n 指定顯示行號(hào)
內(nèi)容描述.
ngxtop具體用法
1) $ ngxtop
如果報(bào)錯(cuò):Error: Access log file or format was not set and nginx config file cannot be detected. Perhaps nginx is not in your PATH?
這是因?yàn)閚gxtop找不到可執(zhí)行文件nginx,解決辦法是
ln -s /usr/local/nginx/sbin/nginx /sbin/nginx
2)$ ngxtop -c /usr/local/nginx/conf/nginx.conf -n 20 //
指定nginx.conf,顯示20行,結(jié)果如圖
3) $ngxtop -c /usr/local/nginx/conf/nginx.conf print request http_user_agent remote_addr //
使用print打印指定變量
4) $ ssh remote tail -f /var/log/apache2/access.log | ngxtop -f common //
分析遠(yuǎn)程機(jī)器的日志
-
python
+關(guān)注
關(guān)注
56文章
4825瀏覽量
86370 -
nginx
+關(guān)注
關(guān)注
0文章
167瀏覽量
12523 -
CentOS
+關(guān)注
關(guān)注
0文章
83瀏覽量
14181
原文標(biāo)題:如何用ngxtop監(jiān)控nginx訪問(wèn)?
文章出處:【微信號(hào):aming_linux,微信公眾號(hào):阿銘linux】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
請(qǐng)問(wèn)zabbix怎么使用模版監(jiān)控nginx服務(wù)?
主要學(xué)習(xí)下nginx的安裝配置
[Ganglia監(jiān)控擴(kuò)展]監(jiān)控nginx的連接數(shù)
![[Ganglia<b class='flag-5'>監(jiān)控</b>擴(kuò)展]<b class='flag-5'>監(jiān)控</b><b class='flag-5'>nginx</b>的連接數(shù)](https://file.elecfans.com/web2/M00/49/AA/pYYBAGKhvEuAeEvMAABL0z-VcIs478.png)
TensorRT的Python API的基本用法和接口解析
Nginx如何和現(xiàn)有監(jiān)控系統(tǒng)集成
如何安裝Python解釋器
搭建Keepalived+Lvs+Nginx高可用集群負(fù)載均衡

評(píng)論