[root@localhost ~]# watch -n 1 "uptime" # 监测系统负载
[root@localhost ~]# watch -n 1 "netstat -tunlp" # 监测网络连接
[root@localhost ~]# watch -n 1 "pstree | grep nginx" # 监测 Nginx 连接数
[root@localhost ~]# watch -n 1 "netstat -n | awk '/^tcp/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c| sort -rn | head" # 监测每个IP的连接数
[root@localhost ~]# watch -n 1 "netstat -an | awk '/^tcp/ {++sta[\$NF]} END {for(key in sta) print key, "\t", sta[key]}'" # 监测每个连接状态的数量
-n # 设置时间间隔,默认每两秒刷新一次
-d # 用于高亮显示发生变化的数据
本文介绍了一系列使用Linux命令行工具进行系统实时监控的方法,包括系统负载、网络连接、Nginx连接数、IP连接数及连接状态的监测,适用于运维人员和技术爱好者。
9347

被折叠的 条评论
为什么被折叠?



