Skip to content

Commit b63ca8b

Browse files
committed
🚧 monitor
1 parent 15abc30 commit b63ca8b

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

markdown-file/monitor.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,12 @@ eth0 1500 10903437 0 0 0 10847867 0 0 0 BMRU
682682
lo 65536 453650 0 0 0 453650 0 0 0 LRU
683683
```
684684

685-
- 接收:
685+
- 接收(该值是历史累加数据,不是瞬间数据,要计算时间内的差值需要自己减)
686686
- RX-OK 已接收字节数
687687
- RX-ERR 已接收错误字节数(数据值大说明网络存在问题)
688688
- RX-DRP 已丢失字节数(数据值大说明网络存在问题)
689689
- RX-OVR 由于误差而遗失字节数(数据值大说明网络存在问题)
690-
- 发送:
690+
- 发送(该值是历史累加数据,不是瞬间数据,要计算时间内的差值需要自己减)
691691
- TX-OK 已发送字节数
692692
- TX-ERR 已发送错误字节数(数据值大说明网络存在问题)
693693
- TX-DRP 已丢失字节数(数据值大说明网络存在问题)
@@ -777,6 +777,33 @@ Out of memory: Kill process 19452 (java) score 264 or sacrifice child
777777

778778
## 服务器故障排查顺序
779779

780+
#### 请求时好时坏
781+
782+
- 系统层面
783+
- 查看负载、CPU、内存、上线时间、高资源进程 PID:`htop`
784+
- 查看网络丢失情况:`netstat -i 3`,关注:RX-DRP、TX-DRP,如果两个任何一个有值,或者都有值,肯定是网络出了问题(该值是历史累加数据,不是瞬间数据)。
785+
- 应用层面
786+
- 临时修改 nginx log 输出格式,输出完整信息,包括请求头
787+
788+
```
789+
$request_body 请求体(含POST数据)
790+
$http_XXX 指定某个请求头(XXX为字段名,全小写)
791+
$cookie_XXX 指定某个cookie值(XXX为字段名,全小写)
792+
793+
794+
类似用法:
795+
log_format special_main '$remote_addr - $remote_user [$time_local] "$request" '
796+
'$status $body_bytes_sent "$request_body" "$http_referer" '
797+
'"$http_user_agent" $http_x_forwarded_for "appid=$http_appid,appver=$http_appver,vuser=$http_vuser" '
798+
'"phpsessid=$cookie_phpsessid,vuser_cookie=$cookie___vuser" ';
799+
800+
801+
access_log /home/wwwlogs/hicrew.log special_main;
802+
803+
```
804+
805+
806+
780807
#### CPU 高,负载高,访问慢(没有数据库)
781808

782809
- **记录负载开始升高的时间**
@@ -899,6 +926,7 @@ S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
899926
- <https://www.jianshu.com/p/3991c0dba094>
900927
- <https://www.jianshu.com/p/3667157d63bb>
901928
- <https://www.cnblogs.com/yjd_hycf_space/p/7755633.html>
929+
- <http://silverd.cn/2016/05/27/nginx-access-log.html>
902930

903931

904932

0 commit comments

Comments
 (0)