这些工具是系统管理员最常用的,用来发现系统瓶颈、存储瓶颈、CPU和内存瓶颈以及网络瓶颈。
- top——进程管理。查看最占有CPU资源的进程运行的情况,每五秒钟更新一次。在top的界面出现后可以用以下热键查看
| Hot Key |
Usage |
| t |
显示综合进程信息 |
| m |
显示内存使用信息 |
| A |
分类显示各种系统资源占有的情况,确认等待处理的任务 |
| f |
定制top让它更符合自己的需要 |
| o |
重新对top的信息排序Enables you to interactively select the ordering wop. |
| r |
对进程重新确定优先级 |
| k |
发出kill进程的命令 |
| z |
选择单色和彩色 |
- vmstat——命令报告进程、内存、分页、块设备的IO、进程的陷入和CPU活动,例如vmstat -m查看内存交换空间工作的情况;vmstat -a查看内存页等等 procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 2540988 522188 5130400 0 0 2 32 4 2 4 1 96 0 0
1 0 0 2540988 522188 5130400 0 0 0 720 1199 665 1 0 99 0 0
0 0 0 2540956 522188 5130400 0 0 0 0 1151 1569 4 1 95 0 0
0 0 0 2540956 522188 5130500 0 0 0 6 1117 439 1 0 99 0 0
0 0 0 2540940 522188 5130512 0 0 0 536 1189 932 1 0 98 0 0
0 0 0 2538444 522188 5130588 0 0 0 0 1187 1417 4 1 96 0 0
0 0 0 2490060 522188 5130640 0 0 0 18 1253 1123 5 1 94 0 0
-
w——查看谁登陆、他们在干什么。例如,# w username 和 17:58:47 up 5 days, 20:28, 2 users, load average: 0.36, 0.26, 0.24
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 10.1.3.145 14:55 5.00s 0.04s 0.02s vim /etc/resolv.conf
root pts/1 10.1.3.145 17:43 0.00s 0.03s 0.00s w
-
uptime——查看系统运行的时间
-
ps——显示在工作的进程# ps -A显示所有进程程 PID TTY TIME CMD
1 ? 00:00:02 init
2 ? 00:00:02 migration/0
3 ? 00:00:01 ksoftirqd/0
4 ? 00:00:00 watchdog/0
5 ? 00:00:00 migration/1
6 ? 00:00:15 ksoftirqd/1
....
.....
4881 ? 00:53:28 java
4885 tty1 00:00:00 mingetty
4886 tty2 00:00:00 mingetty
4887 tty3 00:00:00 mingetty
4888 tty4 00:00:00 mingetty
4891 tty5 00:00:00 mingetty
4892 tty6 00:00:00 mingetty
4893 ttyS1 00:00:00 agetty
12853 ? 00:00:00 cifsoplockd
12854 ? 00:00:00 cifsdnotifyd
14231 ? 00:10:34 lighttpd
14232 ? 00:00:00 php-cgi
54981 pts/0 00:00:00 vim
55465 ? 00:00:00 php-cgi
55546 ? 00:00:00 bind9-snmp-stat
55704 pts/1 00:00:00 ps
-
free——内存使用情况,使用的、可用的内存和交换空间以及内核使用的缓存
-
iostat——
-
sar——
-
mpstat——
-
pmap——进程的内存使用情况
-
netstat
-
ss
-
iptraf——实时网络统计
-
tcpdump——详细网络流量分析
-
/proc文件系统查看各种内核数据,例如cat /proc/cpuinfo查看CPU的信息,cat /proc/meminfo查看内存使用的信息,cat /proc/mounts查看文件系统挂载点和/proc/zoneinfo等等
-
nagios——服务器和网络监测,查看主机、网络设备和服务状态
-
cacti——远程监测X window工具获得网络、设备和服务的数据和信息
-
KSysguard——是KDE桌面用户的图形监测工具
-
Gnome——桌面的系统监测工具
其他系统管理员的监测工具:
- nmap - scan your server for open ports.
- lsof - list open files, network connections and much more.
- ntop web based tool - ntop is the best tool to see network usage in a way similar to what top command does for processes i.e. it is network traffic monitoring software. You can see network status, protocol wise distribution of traffic for UDP, TCP, DNS, HTTP and other protocols.
- Conky - Another good monitoring tool for the X Window System. It is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages, e-mail inboxes etc.
- GKrellM - It can be used to monitor the status of CPUs, main memory, hard disks, network interfaces, local and remote mailboxes, and many other things.
- vnstat - vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s).
- htop - htop is an enhanced version of top, the interactive process viewer, which can display the list of processes in a tree form.
- mtr - mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.
来源:
希望对大家有用。