服务器维护,服务器代维,安全设置,漏洞扫描,入侵检测服务

dirtysea 发表于 2010-7-23 17:58:16

Linux系统管理员应该知道的20个系统监控工具

<P>需要监控Linux服务器系统性能吗?尝试下面这些系统内置或附件的工具吧。大多数Linux发行版本都装备了大量的监控工具。这些工具提供了能用作取得相关信息和系统活动的量度指标。你能使用这些工具发现造成性能问题可能原因。此次讨论到的工具只是分析和调试服务器下面问题时最基本工具中的一部分。</P>
<P>1.找出瓶颈</P>
<P>2.硬盘(存储)瓶颈</P>
<P>3.CPU及内存瓶颈</P>
<P>4.网络瓶颈</P>
<P><STRONG>#1: top - 进程活动</STRONG></P>
<P>top提供一个当前运行系统实时动态的视图,也就是正在运行进程。在默认情况下,显示系统中CPU使用率最高的任务,并每5秒钟刷新一次。</P>
<P style="TEXT-ALIGN: center"><IMG style="ZOOM: 100%" class=fit-image onmousewheel="javascript:return big(this)" border=0 alt=管理员必备的20个Linux系统监控工具 src="http://www.linuxeden.com/upimg/allimg/100519/2202293X7-0.jpg" onload="javascript:if(this.width>498)this.style.width=498;" small="0"><BR>图01.Linux top命令</P>
<P>常用热键</P>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TH>热键</TH>
<TH>用途</TH></TR>
<TR>
<TD>t</TD>
<TD>显示摘要信息开关.</TD></TR>
<TR>
<TD>m</TD>
<TD>显示内存信息开关.</TD></TR>
<TR>
<TD>A</TD>
<TD>分类显示系统不同资源的使用大户。有助于快速识别系统中资源消耗多的任务。</TD></TR>
<TR>
<TD>f</TD>
<TD>添加删除所要显示栏位.</TD></TR>
<TR>
<TD>o</TD>
<TD>调整所要显示栏位的顺序.</TD></TR>
<TR>
<TD>r</TD>
<TD>调整一个正在运行的进程Nice值.</TD></TR>
<TR>
<TD>k</TD>
<TD>结束一个正在运行的进程.</TD></TR>
<TR>
<TD>z</TD>
<TD>彩色/黑白显示开关</TD></TR></TBODY></TABLE></P>
<P><STRONG>#2:vmstat -系统活动、硬件及系统信息</STRONG></P>
<P>使用vmstat命令可以得到关于进程、内存、内存分页、堵塞IO、traps及CPU活动的信息。</P>
<P># vmstat 3</P>
<P>输出样例:</P><PRE>procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------<P>rb   swpd   free   buffcache   si   so    bi    bo   in   cs us sy id wa st</P><P>00      0 2540988 522188 5130400    0    0   2    32    4    241 9600</P><P>10      0 2540988 522188 5130400    0    0   0   720 119966510 9900</P><P>00      0 2540956 522188 5130400    0    0   0   0 1151 156941 9500</P><P>00      0 2540956 522188 5130500    0    0   0   6 111743910 9900</P><P>00      0 2540940 522188 5130512    0    0   0   536 118993210 9800</P><P>00      0 2538444 522188 5130588    0    0   0   0 1187 141741 9600</P><P>00      0 2490060 522188 5130640    0    0   0    18 1253 112351 9400</P></PRE>
<P>显示内存使用详细信息</P><PRE># vmstat -m</PRE>
<P>显示内存活动/不活动的信息</P>
<P># vmstat -a</P>
<P><STRONG>#3: w - 显示谁已登录,他们正在做什么?</STRONG></P>
<P>w命令显示系统当前用户及其运行进程的信息。</P>
<P># w username</P>
<P># w vivek</P>
<P>输出样例:</P><PRE>17:58:47 up 5 days, 20:28,2 users,load average: 0.36, 0.26, 0.24<P>USER   TTY      FROM            LOGIN@   IDLE   JCPU   PCPU WHAT</P><P>root   pts/0    10.1.3.145       14:55    5.00s0.04s0.02s vim /etc/resolv.conf</P><P>root   pts/1    10.1.3.145       17:43    0.00s0.03s0.00s w</P></PRE>
<P><STRONG>#4:uptime - 告诉系统已经运行了多久?</STRONG></P>
<P>uptime命令过去只显示系统运行多久。现在,可以显示系统运行多久、当前有多少的用户登录、在过去的1,5,15分钟里平均负载时多少。</P>
<P># uptime</P>
<P>输入样例:</P><PRE>18:02:41 up 41 days, 23:42,1 user,load average: 0.00, 0.00, 0.00</PRE>
<P>1可以被认为是最优的负载值。负载是会随着系统不同改变得。单CPU系统1-3和SMP系统6-10都是可能接受的。</P>
<P><STRONG>#5:ps - 显示进程</STRONG></P>
<P>ps命令显示当前运行进程的快照。使用-A或-e显示所有进程。</P>
<P># ps -A</P>
<P>输出样例:</P><PRE>PID TTY          TIME CMD<P>1 ?      00:00:02 init</P><P>2 ?      00:00:02 migration/0</P><P>3 ?      00:00:01 ksoftirqd/0</P><P>4 ?      00:00:00 watchdog/0</P><P>5 ?      00:00:00 migration/1</P><P>6 ?      00:00:15 ksoftirqd/1</P><P>....</P><P>.....</P><P>4881 ?      00:53:28 java</P><P>4885 tty1   00:00:00 mingetty</P><P>4886 tty2   00:00:00 mingetty</P><P>4887 tty3   00:00:00 mingetty</P><P>4888 tty4   00:00:00 mingetty</P><P>4891 tty5   00:00:00 mingetty</P><P>4892 tty6   00:00:00 mingetty</P><P>4893 ttyS1    00:00:00 agetty</P><P>12853 ?      00:00:00 cifsoplockd</P><P>12854 ?      00:00:00 cifsdnotifyd</P><P>14231 ?      00:10:34 lighttpd</P><P>14232 ?      00:00:00 php-cgi</P><P>54981 pts/0    00:00:00 vim</P><P>55465 ?      00:00:00 php-cgi</P><P>55546 ?      00:00:00 bind9-snmp-stat</P><P>55704 pts/1    00:00:00 ps</P></PRE>
<P>ps与top非常相似,但ps提供更多的信息。</P>
<P>输出长格式</P><PRE># ps -Al</PRE>
<P>输出附加全格式(显示进程在执行时传入的参数)</P><PRE># ps -AlF</PRE>
<P>显示进程结构</P>
<P># ps -AlFH</P>
<P>在进程后显示线程</P>
<P># ps -AlLm</P>
<P>打印服务器上所有进程</P>
<P># ps ax</P>
<P># ps axu</P>
<P>打印进程树</P>
<P># ps -ejH</P>
<P># ps axjf</P>
<P># pstree</P>
<P>打印安全信息</P>
<P># ps -eo euser,ruser,suser,fuser,f,comm,label</P>
<P># ps axZ</P>
<P># ps -eM</P>
<P>查看使用Vivek用户名运行的进程</P>
<P># ps -U vivek -u vivek u</P>
<P>设置自定义输出格式</P>
<P># ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm</P>
<P># ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm</P>
<P># ps -eopid,tt,user,fname,tmout,f,wchan</P>
<P>只显示Lighttpd的进程ID</P>
<P># ps -C lighttpd -o pid=</P>
<P>或者</P>
<P># pgrep lighttpd</P>
<P>或者</P>
<P># pgrep -u vivek php-cgi</P>
<P>显示PID为55977的进程名称</P>
<P># ps -p 55977 -o comm=</P>
<P>找出消耗内存最多的前10名进程</P>
<P># ps -auxf | sort -nr -k 4 | head -10</P>
<P>找出使用CPU最多的前10名进程</P>
<P># ps -auxf | sort -nr -k 3 | head -10</P>
<P><STRONG>#6:free - 内存使用情况</STRONG></P>
<P>free命令显示系统中空闲的、已用的物理内存及swap内存,及被内核使用的buffer。</P>
<P># free</P>
<P>输出样例:</P><PRE>total       used       free   shared    buffers   cached<P>Mem:      12302896    9739664    2563232          0   523124    5154740</P><P>-/+ buffers/cache:    4061800    8241096</P><P>Swap:      1052248          0    1052248</P></PRE>
<P><STRONG>#7:iostat - CPU平均负载,硬盘活动</STRONG></P>
<P>iostat命令可报告中央处理器(CPU)的统计信息,各种设备、分区及网络文件系统输入/输出的统计信息。</P>
<P># iostat</P>
<P>输出样例:</P><PRE>Linux 2.6.18-128.1.14.el5 (www03.nixcraft.in)06/26/2009<P>avg-cpu:%user   %nice %system %iowait%steal   %idle</P><P>3.50    0.09    0.51    0.03    0.00   95.86</P><P>Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn</P><P>sda            22.04      31.88       512.03   16193351260102868</P><P>sda1            0.00         0.00         0.00       2166      180</P><P>sda2             22.04      31.87       512.03   16189010260102688</P><P>sda3            0.00         0.00         0.00       1615          0</P></PRE>
<P><STRONG>#8:sar - 搜集和报告系统活动</STRONG></P>
<P>sar命令用来搜集、报告和储存系统活动信息。查看网路计数器,输入:</P>
<P># sar -n DEV | more</P>
<P>显示最近24小时网络计数器</P>
<P># sar -n DEV -f /var/log/sa/sa24 | more</P>
<P>你亦可以用sar显示实时情况</P>
<P># sar 4 5</P>
<P>输出样例:</P>
<P>Linux 2.6.18-128.1.14.el5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;&nbsp;&nbsp;&nbsp;&nbsp; 1.56&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.22&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp; 98.22</P>
<P>06:45:32 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp; 96.19</P>
<P>Average:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.02&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.27&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp; 97.70</P>
<P><STRONG>#9:mpstat - 多处理器使用率</STRONG></P>
<P>mpstat命令可以显示所有可用处理器的使用情况,处理器编号从0开始。mpstat -P ALL显示每个处理器的平均使用率。</P>
<P># mpstat -P ALL</P>
<P>输出样例:</P><PRE><P>Linux 2.6.18-128.1.14.el5 (www03.nixcraft.in)&nbsp;&nbsp; 06/26/2009</P>
<P>06:48:11 PM CPU&nbsp;&nbsp; %user&nbsp;&nbsp; %nice&nbsp;&nbsp;&nbsp; %sys %iowait&nbsp;&nbsp;&nbsp; %irq&nbsp;&nbsp; %soft %steal&nbsp;&nbsp; %idle&nbsp;&nb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; 95.69&nbsp;&nbsp;&nbsp;&nbsp; 76.89</P></PRE>
<P><STRONG>#10: pmap - 进程的内存使用</STRONG></P>
<P>pmap命令可以显示进程的内存映射,使用这个命令可以找出造成内存瓶颈的原因。</P>
<P># pmap -d PID</P>
<P>显示PID为47394进程的内存信息。</P>
<P># pmap -d 47394</P>
<P>输出样例:</P>
<P>47394:&nbsp;&nbsp; /usr/bin/php-cgi</P>
<P>Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Kbytes Mode Offset&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Device&nbsp;&nbsp;&nbsp; Mapping</P>
<P>0000000000400000&nbsp;&nbsp;&nbsp; 2584 r-x-- 0000000000000000 008:00002 php-cgi</P>
<P>0000000000886000&nbsp;&nbsp;&nbsp;&nbsp; 140 rw--- 0000000000286000 008:00002 php-cgi</P>
<P>00000000008a9000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 52 rw--- 00000000008a9000 000:00000&nbsp;&nbsp; [ anon ]</P>
<P>0000000000aa8000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 76 rw--- 00000000002a8000 008:00002 php-cgi</P>
<P>000000000f678000&nbsp;&nbsp;&nbsp; 1980 rw--- 000000000f678000 000:00000&nbsp;&nbsp; [ anon ]</P>
<P>000000314a600000&nbsp;&nbsp;&nbsp;&nbsp; 112 r-x-- 0000000000000000 008:00002 ld-2.5.so</P>
<P>000000314a81b000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 r---- 000000000001b000 008:00002 ld-2.5.so</P>
<P>000000314a81c000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 rw--- 000000000001c000 008:00002 ld-2.5.so</P>
<P>000000314aa00000&nbsp;&nbsp;&nbsp; 1328 r-x-- 0000000000000000 008:00002 libc-2.5.so</P>
<P>000000314ab4c000&nbsp;&nbsp;&nbsp; 2048 ----- 000000000014c000 008:00002 libc-2.5.so</P>
<P>.....</P>
<P>......</P>
<P>..</P>
<P>00002af8d48fd000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 rw--- 0000000000006000 008:00002 xsl.so</P>
<P>00002af8d490c000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 40 r-x-- 0000000000000000 008:00002 libnss_files-2.5.so</P>
<P>00002af8d4916000&nbsp;&nbsp;&nbsp; 2044 ----- 000000000000a000 008:00002 libnss_files-2.5.so</P>
<P>00002af8d4b15000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 r---- 0000000000009000 008:00002 libnss_files-2.5.so</P>
<P>00002af8d4b16000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 rw--- 000000000000a000 008:00002 libnss_files-2.5.so</P>
<P>00002af8d4b17000 768000 rw-s- 0000000000000000 000:00009 zero (deleted)</P>
<P>00007fffc95fe000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 84 rw--- 00007ffffffea000 000:00000&nbsp;&nbsp; [ stack ]</P>
<P>ffffffffff600000&nbsp;&nbsp;&nbsp; 8192 ----- 0000000000000000 000:00000&nbsp;&nbsp; [ anon ]</P>
<P>mapped: 933712K&nbsp;&nbsp;&nbsp; writeable/private: 4304K&nbsp;&nbsp;&nbsp; shared: 768000K</P>
<P>最后一行非常重要:</P>
<P>* mapped: 933712K 内存映射所占空间大小</P>
<P>* writeable/private: 4304K 私有地址空间大小</P>
<P>* shared: 768000K 共享地址空间大小</P>
<P><STRONG>#11和#12: netstat和ss - 网络相关信息</STRONG></P>
<P>netstat可以显示网络链接、路由表信息、接口统计信息、伪装链接和多播成员(multicast memberships),ss命令用来显示网络套接字信息,它允许显示类似netstat一样的信息。关于ss和netstat使用,可参考下列资源。</P>
<P><STRONG>#13: iptraf - 网络实时信息</STRONG></P>
<P>iptraf是一个可交互式的IP网络监控工具。它可以生成多种网络统计信息包括:TCP信息、UDP数量、ICMP和OSPF信息、以太网负载信息、节点状态、IP校验错误等。有下面几种信息格式:</P>
<UL>
<LI>不同网络TCP链接传输量
<LI>不同网络接口IP传输量
<LI>不同协议网络传输量
<LI>不同TCP/UDP端口和不同包大小网络传输量
<LI>不同第二层地址网络传输量 </LI></UL>
<P style="TEXT-ALIGN: center"><IMG style="WIDTH: 498px" class=fit-image onmousewheel="javascript:return big(this)" border=0 alt=管理员必备的20个Linux系统监控工具 src="http://www.linuxeden.com/upimg/allimg/100519/220229A47-1.jpg" onload="javascript:if(this.width>498)this.style.width=498;" small="0"><BR>图02:一般接口信息:不同网络接口IP传输量</P>
<P style="TEXT-ALIGN: center"><IMG style="WIDTH: 498px" class=fit-image onmousewheel="javascript:return big(this)" border=0 alt=管理员必备的20个Linux系统监控工具 src="http://www.linuxeden.com/upimg/allimg/100519/2202292353-2.jpg" onload="javascript:if(this.width>498)this.style.width=498;" small="0"><BR>图03:不同网络TCP链接传输量</P>
<P><STRONG>#14:tcpdump:详细的网络流量分析</STRONG></P>
<P>tcpdump是一个简单网络流量转储工具,然而要使用好需要对TCP/IP协议非常熟悉。例如要显示关于DNS的网络流量,输入:</P>
<P># tcpdump -i eth1 'udp port 53'</P>
<P>显示所有进出80端口IPv4 HTTP包,也就是只打印包含数据的包。例如:SYN、FIN包和ACK-only包输入:</P>
<P># tcpdump 'tcp port 80 and (((ip - ((ip&amp;0xf)&lt;&lt;2)) - ((tcp&amp;0xf0)&gt;&gt;2)) != 0)'</P>
<P>显示所有到的FTP会话,输入:</P>
<P># tcpdump -i eth1 'dst 202.54.1.5 and (port 21 or 20'</P>
<P>显示所有到192.168.1.5的HTTP会话</P>
<P># tcpdump -ni eth0 'dst 192.168.1.5 and tcp and port http'</P>
<P>用wireshark浏览转储文件中的详细信息,输入:</P>
<P># tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80</P>
<P><STRONG>#15:strace - 系统调用</STRONG></P>
<P>追踪系统调用和型号,这对于调试Web服务器和其他服务器非常有用。了解怎样追踪进程和他功能。</P>
<P><STRONG>#16:/proc文件系统 - 各种内核信息</STRONG></P>
<P>/proc目录下文件提供了很多不同硬件设备和内核的详细信息。更多详情参见Linux kernel /proc。一般/proc例如:</P>
<P># cat /proc/cpuinfo</P>
<P># cat /proc/meminfo</P>
<P># cat /proc/zoneinfo</P>
<P># cat /proc/mounts</P>
<P><STRONG>#17:Nagios - 服务器及网络监控</STRONG></P>
<P>Nagios 是一款非常流行的系统及网络监控软件。你可以轻松监控所有的主机、网络设备及服务。它能在发生故障和重新恢复后发送警讯。FAN是"Fully Automated Nagios"的缩写。FAN的目标就是由Nagios社群提供Nagios的安装。为了使安装Nagios服务器更加容易,FAN提供一个标准ISO格式的光盘镜像。此发行版中还会包含一组增强用户使用体验的工具。</P>
<P><STRONG>#18:Cacti - 基于Web的监控工具</STRONG></P>
<P>Cacti是一套完成的网络图形化解决方案,基于RRDTool的资料存储和图形化功能。Cacti提供一个快速的轮询器、进阶的图形化模板、多种数据采集方法和用户管理功能。这些功能都拥有非常友好易用的界面,确保可以部署在一个包含数百台设备的复杂网络中。它提供关于网络、CPU、内存、已登录用户、Apache、DNS等信息。</P>
<P><STRONG>#19:KDE System Guard</STRONG></P>
<P>KSysguard是在KDE桌面下一个网络化的系统监控工具。这个工具可以通过SSH会话运行。它提供很多功能,例如可以监控本机和远程主机的客户端/服务器架构,前端图形界面使用所谓传感器得到信息并展现出来。传感器返回的可以是一个简单的数值或是一组表格的信息。针对不同的信息类型,提供一个或多个显示。这些显示被组织多个工作表中,可以工作表可以独体储存和加载。所以,KSysguard不只是一个简单的任务管理器,还是一个可以控制多台服务器的强大工具。</P>
<P style="TEXT-ALIGN: center"><IMG style="WIDTH: 498px" class=fit-image onmousewheel="javascript:return big(this)" border=0 alt=管理员必备的20个Linux系统监控工具 src="http://www.linuxeden.com/upimg/allimg/100519/2202294F2-3.jpg" onload="javascript:if(this.width>498)this.style.width=498;" small="0"><BR>图05:KDE System Guard</P>
<P><STRONG>#20:Gnome System Monitor</STRONG></P>
<P>System Monitor可以显示系统基本信息、监控系统进程、系统资源及文件系统使用率。你也可以使用System Monitor监控和修改系统行为。尽管没有KDE System Guard功能强大,但其提供的基本信息对于入门用户还是非常有用的。</P>
<P>* 显示关于计算机硬件和软件的各种基本信息。</P>
<P>* Linux内核版本</P>
<P>* GNOME版本</P>
<P>* 硬件</P>
<P>* 安装的内存</P>
<P>* 处理器及其速度</P>
<P>* 系统状态</P>
<P>* 当前可用的硬盘空间</P>
<P>* 进程</P>
<P>* 内存及交换空间</P>
<P>* 网络使用率</P>
<P>* 文件系统</P>
<P>* 所有挂载的文件系统及其基本信息</P>
<P style="TEXT-ALIGN: center"><IMG style="WIDTH: 498px; ZOOM: 100%" class=fit-image onmousewheel="javascript:return big(this)" border=0 alt=管理员必备的20个Linux系统监控工具 src="http://www.linuxeden.com/upimg/allimg/100519/2202295X7-4.jpg" onload="javascript:if(this.width>498)this.style.width=498;" small="0"><BR>图06:The Gnome System Monitor application</P>
<P style="TEXT-ALIGN: left">&nbsp;</P>
页: [1]
查看完整版本: Linux系统管理员应该知道的20个系统监控工具