每位linux系统管理员必须知道的20条监控工具
- 格式:doc
- 大小:603.00 KB
- 文档页数:14
Linux系统的系统日志管理和分析工具比较在Linux系统中,系统日志是存储和记录系统运行时的重要信息和事件的一种机制。
这些日志可以帮助系统管理员追踪问题、监控系统状态和进行故障排查。
为了更有效地管理和分析系统日志,许多工具被开发出来。
本文将比较并介绍几种常用的Linux系统日志管理和分析工具。
1. Syslog-ngSyslog-ng是一个功能强大的开源系统日志管理工具,它能够收集、过滤和转发系统产生的日志。
Syslog-ng支持灵活的日志过滤规则和插件机制,使得管理员能够根据需要自定义日志处理流程。
此外,Syslog-ng还支持多种日志格式,并能将日志导出到不同的目标,如文件、远程服务器等。
该工具易于使用,并且具有丰富的文档和社区支持。
2. rsyslogrsyslog是一个高性能的系统日志记录工具,它是syslog的一个升级版本。
与Syslog-ng类似,rsyslog支持多种日志格式和目标,还具备强大的日志过滤功能。
rsyslog提供了插件机制,可以集成到其他系统或应用中,实现更复杂的日志处理需求。
此外,rsyslog还支持TCP和UDP协议,使得日志传输更加灵活可靠。
3. logrotatelogrotate是一个用于管理系统日志轮换的工具。
它能够定期检查和压缩系统的日志文件,防止日志过度增长导致存储空间不足。
logrotate 支持灵活的配置选项,可以指定日志保存的时间长度、压缩算法等。
此外,logrotate还能触发其他动作,如发送邮件通知,方便管理员及时了解和处理日志问题。
4. JournalctlJournalctl是systemd提供的一个强大的日志管理工具,用于查看和分析系统的日志消息。
它能够以人类可读的格式输出日志,并支持多种过滤和查询选项,如按时间范围、服务名、日志级别等。
Journalctl 还支持实时监控和跟踪日志,方便管理员实时查看系统运行状态和故障排查。
5. Elasticsearch + Logstash + Kibana (ELK)ELK是一个流行的开源日志分析平台,由Elasticsearch、Logstash 和Kibana三个组件组成。
Linux上的系统监控工具比较NagiosvsZabbix在Linux系统中,系统监控工具起着至关重要的作用,帮助管理员实时监测系统状态和性能指标。
Nagios和Zabbix是两款流行的系统监控工具,它们在功能和使用上有所差异。
本文将对Nagios和Zabbix进行比较,以帮助读者选择适合自己需求的系统监控工具。
一、NagiosNagios是一款开源的系统监控工具,通过监测主机、服务和网络设备等方面来保证系统的可用性。
它具有以下特点:1. 灵活性:Nagios可以监控各种类型的主机、服务和设备,例如服务器、路由器、数据库等。
用户可以根据自己的需求,通过自定义插件来监测不同的指标。
2. 强大的告警功能:Nagios可以设置各种告警规则和通知方式,当系统出现故障或达到预定的阈值时,及时发送告警信息给管理员。
3. 可扩展性:Nagios拥有丰富的第三方插件和扩展,可以方便地与其他系统集成,满足复杂的监控需求。
4. 灵活的配置:Nagios使用文本配置文件进行管理,管理员可以根据需要编辑配置文件,实现对监控对象和监控指标的灵活配置。
二、ZabbixZabbix也是一款开源的系统监控工具,具有以下特点:1. 自动发现功能:Zabbix可以自动发现并监控网络设备、服务器和服务。
这个功能可以大大减轻管理员配置监控对象的工作量。
2. 实时监控和图形化展示:Zabbix提供实时数据监控和图形化展示功能,可以直观地查看系统的各项性能指标和状态。
3. 强大的报表功能:Zabbix可以生成各种类型的报表,帮助管理员分析历史数据、趋势和性能统计等。
4. 可视化配置:Zabbix提供直观的Web界面进行配置和管理,管理员可以通过图形化界面完成监控对象和监控指标的配置。
三、Nagios vs ZabbixNagios和Zabbix在功能和使用上都有各自的优势,下面对它们进行比较:1. 配置和管理:Nagios使用文本配置文件进行管理,需要具备一定的技术能力和配置经验。
linux操作系统监控工具监控你的WEB服务器或者WEB主机运行是否正常与健康是非常重要的。
你要确保用户始终可以打开你的网站并且网速不慢。
服务器监控工具允许你收集和分析有关你的Web服务器的数据。
这里店铺就与大家谈谈Linux操作票撒谎那个面都有一些什么样的系统监控工具。
linux操作系统监控工具一、基于命令行的性能监控工具1.dstat - 多类型资源统计工具该命令整合了vmstat,iostat和ifstat三种命令。
同时增加了新的特性和功能可以让你能及时看到各种的资源使用情况,从而能够使你对比和整合不同的资源使用情况。
通过不同颜色和区块布局的界面帮助你能够更加清晰容易的获取信息。
它也支持将信息数据导出到cvs 格式文件中,从而用其他应用程序打开,或者导入到数据库中。
你可以用该命令来监控cpu,内存和网络状态随着时间的变化。
2.atop - 相比top更好的ASCII码体验这个使用ASCII码显示方式的命令行工具是一个显示所有进程活动的性能监控工具。
它可以展示每日的系统日志以进行长期的进程活动分析,并高亮显示过载的系统使用资源。
它包含了CPU,内存,交换空间,磁盘和网络层的度量指标。
所有这些功能只需在终端运行atop即可。
# atop当然你也可以使用交互界面来显示数据并进行排序。
3.Nmon - 类Unix系统的性能监控Nmon是Nigel's Monitor缩写,它最早开发用来作为AIX的系统监控工具。
如果使用在线模式,可以使用光标键在屏幕上操作实时显示在终端上的监控信息。
使用捕捉模式能够将数据保存为CSV格式,方便进一步的处理和图形化展示。
更多的信息参考我们的nmon性能监控文章。
4.slabtop - 显示内核slab缓存信息这个应用能够显示缓存分配器是如何管理Linux内核中缓存的不同类型的对象。
这个命令类似于top命令,区别是它的重点是实时显示内核slab缓存信息。
它能够显示按照不同排序条件来排序显示缓存列表。
Linux命令高级技巧使用lsof命令进行进程和文件监控Linux操作系统有许多强大的命令,用于管理和监控系统的各种资源。
其中,lsof(list open files)命令是一个非常有用的工具,它可以用来查看系统中打开的文件和相关的进程信息。
在本文中,我们将介绍lsof命令的高级技巧,以帮助您更好地监控和管理系统的进程和文件。
一、基本用法1. 查看所有打开的文件要查看系统中所有打开的文件,只需以root用户身份在终端执行以下命令:```$ sudo lsof```这将列出所有的文件和进程信息,包括文件描述符、进程ID、进程所有者等。
2. 查看指定进程的打开文件如果您只想查看某个特定进程正在打开的文件,您可以使用`-p`选项指定进程ID,例如:```$ sudo lsof -p 1234```其中,`1234`是您要查看的进程ID。
3. 查看指定文件的打开进程您还可以使用lsof命令来查看指定文件被哪些进程打开,使用以下命令格式:```$ sudo lsof /path/to/file```这将列出打开该文件的所有进程和相关信息。
二、高级技巧1. 列出网络连接您可以使用lsof命令来列出系统中的网络连接。
使用`-i`选项可以只显示网络连接相关的信息,例如:```$ sudo lsof -i```这将显示所有的网络连接,包括当前正在进行的连接以及已经关闭的连接。
2. 查找指定端口的进程要查找指定端口正在使用的进程,可以使用`-i`选项结合端口号进行过滤,例如:```$ sudo lsof -i :80```这将显示使用端口80的进程和相关信息。
如果没有任何输出,表示该端口没有被任何进程使用。
3. 查找特定用户的进程和文件您可以使用lsof命令来查找特定用户打开的文件或进程。
使用`-u`选项可以只显示特定用户相关的信息,例如:```$ sudo lsof -u username```其中,`username`是您要查找的用户名。
Linux终端中的进程管理和监控在Linux终端中,进程的管理和监控是系统管理者和开发人员必备的技能之一。
通过合理的进程管理和监控,可以保证系统的稳定性和正常运行。
本文将介绍Linux终端中进程管理和监控的相关知识,并提供一些实用的命令和工具供读者参考。
一、进程管理在Linux系统中,每个正在运行的程序都是一个进程。
进程管理的任务包括启动、停止、监控和调整进程的运行状态等。
下面是一些常用的进程管理命令及其功能:1. ps命令:用于查看当前系统中运行的进程信息。
通过不同的选项,可以显示进程的PID(进程ID)、状态、内存占用等详细信息。
2. kill命令:用于终止指定的进程。
可以通过进程ID(PID)或进程名来指定要终止的进程。
3. top命令:用于实时监控系统中的进程状态。
它可以显示当前运行的进程列表,并实时更新进程的CPU利用率、内存占用等信息。
4. renice命令:用于调整进程的优先级。
可以通过指定进程ID或进程名,设置进程的优先级,以调整系统资源的分配。
二、进程监控除了上述命令外,Linux终端还提供了一些工具用于进程的监控和管理。
下面是一些常用的进程监控工具及其功能:1. System Monitor:一个图形化的工具,用于实时监控系统的状态和进程信息。
它可以以图表的形式显示CPU利用率、内存占用、网络流量等信息,并提供用于杀死进程、调整优先级等功能。
2. htop:一个更加强大的进程监控工具,相比于top命令,htop提供了更多的功能和定制选项。
它可以以交互式的方式显示系统状态和进程信息,并允许用户进行进一步的操作,如终止进程、修改优先级等。
3. systemd:一个集成的系统和服务管理工具。
通过systemd,可以对系统中的进程进行监控和管理,包括启动、停止、重启进程等操作。
它还提供了一些高级功能,如进程的自动重启、进程的依赖管理等。
4. monit:一个轻量级的进程监控工具,可用于监控系统中的进程和服务。
Linux系统的网络流量监控和分析方法随着网络的发展和应用的广泛,对于网络流量的监控和分析变得越来越重要。
在Linux系统中,有许多方法可以实现对网络流量的监控和分析。
本文将介绍一些常用的Linux 系统的网络流量监控和分析方法,并分析其优缺点。
1. 使用ifconfig命令ifconfig命令是一个非常简单且常用的命令,用于配置和显示网络接口。
它可以用来监控网络接口的发送和接收数据量。
通过使用ifconfig命令,可以查看网络接口的IP地址、子网掩码、网络状态等信息。
然而,ifconfig命令只提供基本的网络接口信息,无法进行深入的网络流量分析。
2. 使用netstat命令netstat命令用于显示与IP、TCP、UDP和ICMP协议相关的统计数据。
使用netstat命令可以查看当前连接状态、监听端口、路由表等信息。
此外,netstat命令还可以用于查看网络接口的流量统计,包括接收和发送数据包的数量。
然而,与ifconfig命令类似,netstat命令只提供基本的网络流量信息,无法进行详细的流量分析。
3. 使用tcpdump命令tcpdump命令是一个功能强大的网络抓包工具。
它可以捕获网络接口上的数据包,并将其以文本形式显示出来。
tcpdump命令可以根据用户定义的过滤器来捕获特定类型的数据包,如IP地址、端口号、协议类型等。
通过分析捕获的数据包,可以了解网络流量的来源、目的地、传输协议等信息。
但是,tcpdump命令对于非专业人士来说有一定的学习曲线,并且在大规模网络环境下处理大量数据包时,可能会影响系统性能。
4. 使用nload命令nload命令是一个简单易用的网络流量监控工具。
它能够实时显示网络接口的流量情况,包括接收和发送的数据量、网络带宽利用率等信息。
nload命令提供了一个直观的图形界面,可以方便地监控网络接口的流量变化。
然而,nload命令只提供基本的流量监控功能,无法进行深入的流量分析。
Linux命令行中的进程监控技巧htopatop和nmon命令详解Linux命令行中的进程监控技巧:htop、atop和nmon命令详解在Linux系统中,进程监控是一项重要的任务,它可以帮助我们了解系统的运行状态、资源利用情况以及解决性能瓶颈等问题。
本文将详细介绍三个常用的命令行工具:htop、atop和nmon,它们都可以用于进程监控,但在功能和用法上有些许差异。
一、htop命令htop是一个交互式的进程监控工具,提供了比top命令更加直观和友好的界面。
使用htop,我们可以轻松地查看系统中运行的进程,并实时了解它们的CPU、内存和I/O等资源的使用情况。
下面是htop命令的使用示例及相关说明:1. 安装htop命令:sudo apt-get install htop2. 运行htop命令:htop3. htop界面说明:htop的界面由多个区域组成,包括进程列表、系统摘要、进程树、CPU和内存占用情况等。
通过上下左右箭头键可以在不同区域之间切换,按F1键可以查看帮助文档。
在进程列表中,我们可以看到每个进程的PID、用户、CPU占用率、内存占用率等信息,并可以通过快捷键对进程进行操作,如杀死进程、跟踪进程等。
二、atop命令atop是另一个功能强大的进程监控工具,它可以提供比top和htop 更为详细的系统状态信息,并且支持日志记录功能。
下面是atop命令的使用示例及相关说明:1. 安装atop命令:sudo apt-get install atop2. 运行atop命令:sudo atop3. atop界面说明:atop的界面分为多个区域,包括系统摘要、进程列表、资源占用情况、磁盘IO、网络流量等。
在进程列表中,我们可以看到每个进程的PID、用户、CPU占用率、内存占用率、磁盘IO等信息,并且atop支持按字段排序和过滤功能,方便我们查找和分析进程。
同时,atop可以记录系统状态信息到日志文件中,我们可以使用atop命令读取和分析这些日志。
Linux终端中如何监控网络流量Linux终端是一种强大的工具,可以用来进行各种系统操作和网络管理。
在网络管理中,监控网络流量是非常重要的,它可以帮助我们了解网络的使用情况,排查问题和优化网络性能。
本文将介绍如何在Linux终端中监控网络流量的方法。
一、使用ifconfig命令查看网络接口信息ifconfig是Linux系统中常用的一个命令,可以用来查看和配置网络接口的信息。
通过执行ifconfig命令,可以列出当前系统中的网络接口,并且可以查看每个接口的IP地址、MAC地址等信息。
在终端中输入以下命令:```ifconfig```将会显示出当前系统中所有的网络接口信息。
我们可以根据接口的名称找到需要监控的网络接口,例如eth0、wlan0等。
二、使用iftop命令实时监控网络流量iftop是一个可以实时查看网络流量的工具,它可以显示出每个网络连接的流量情况,包括发送和接收的数据量,以及带宽的使用情况。
通过监控网络流量,我们可以观察到当前网络上的实时数据传输情况。
首先,我们需要安装iftop工具。
在终端中输入以下命令:sudo apt-get install iftop```安装完成后,我们可以通过以下命令来使用iftop工具:```sudo iftop -i <接口名称>```其中,<接口名称>是需要监控的网络接口名称,例如eth0、wlan0等。
执行命令后,将会出现一个类似终端的界面,显示出当前网络连接的信息和流量情况。
按下Ctrl + C即可退出iftop。
三、使用nethogs命令监控网络流量nethogs是一个可以监控网络流量的命令行工具,它可以显示出每个进程使用的网络带宽和流量情况。
通过监控进程的网络流量,我们可以了解到每个进程对网络的使用情况,帮助我们发现异常的网络活动。
首先,我们需要安装nethogs工具。
在终端中输入以下命令:```sudo apt-get install nethogs```安装完成后,我们可以通过以下命令来使用nethogs工具:sudo nethogs <接口名称>```其中,<接口名称>是需要监控的网络接口名称,例如eth0、wlan0等。
Linux下系统如何监控服务器硬件、操作系统、应⽤服务和业务1.Linux监控概述Linux服务器要保证系统的⾼可⽤性,需要实时了解到服务器的硬件、操作系统、应⽤服务等的运⾏状况,各项性能指标是否正常,需要使⽤各种LINUX命令。
做到⾃动化运维就需要,将上述各项监控指标在同⼀个软件中展显出来,图形化监控,消息报警机制,⽇志检看,资产管理等等2.Linux监控的对象2.1 硬件监控(1)服务器:如电源,风扇,磁盘,CPU等,可以使⽤IPMI监控,在LINUX下安装IPMITOOL不同的服务器⼚商都在服务器上配有远程控制卡BMC: 如DELL(iDRAC) ,IBM (IMM) ,HP(ILO)LINUX下只需安装:#yum install -y OpenIPMI ipmitool 这⼆个⼯具就可以IPMI命令可以在服务器本地运⾏,也可以通过⽹络远程调⽤,IPMI在服务器上可以配置单独的IP地址和访问密码(2)⽹络设备:交换机,防⽕墙,路由器等,使⽤SNMP进⾏监控在被监控的设备上开启SNMP代理,到时可以通过⼯具进⾏获取数据,如ZABBIX1.LINUX上安装#yum list |grep snmp#yum install -y net-snmp net-snmp-utils安装好后要配置snmpd.conf⽂件rocommunity snmptest 172.16.20.89 #172.16.20.89表⽰仅这IP地址才可以来访问snmp信息#systemctl start snmpd 启动SNMP ,netstat -nulp ,netstat -ntlp 查看snmp启来的端⼝udp=161 ,TCP=199通过SNMP命令可以获取监控信息:#snmpget -v2c -c snmptest 172.16.20.89 1.3.6.1.2.1.1.3.0 #1.3.6.1.2.1.1.3.0为OID2.交换机上开启snmp-server community public ro(3)定期机房巡检,查看设备运⾏情况2.2 操作系统监控安装sysstat⼯具,包括了iostat、vmstat、sar、mpstat、nfsiostat、pidstat (yum install -y sysstat #rpm -ql sysstat)(1)CPU (CPU调度上下⽂切换,运⾏队列负载,CPU使⽤率)确定服务类型:IO密集型(如:数据库),CPU密集型(如:WEB)1.cpu利⽤率内核态: 30%和⽤户态:70%2.cpu运⾏队列:1~3线程 1CPU=4核队列不超过12个3.上下⽂切换:尽量少,结合cpu利⽤率4.#top命令(显⽰CPU和内存信息,M按内存使⽤率排序,P按CPU使⽤率排序,Q退出)CPU百分⽐各项指标: us:⽤户态 sy:内核态 ni:进程间优先级更换 id:空闲 wa:IO等待 hi:硬中断 si:软件中 st:虚拟5.CPU监控的各种命令:top ,vmstat , mpstat, uptime ,ps cpu进程情况,pstree 以树形结构显⽰进程之间的关系(2)内存1. free -m :显⽰内存信息2.vmstat :来监控虚拟内存 #vmstat 1 10 每隔1秒共10次获取监控信息(3)磁盘1.iostat:命令⽤来显⽰存储⼦系统的详细信息,通常⽤它来监控磁盘 I/O 的情况。
Linux命令技巧利用lsof和netstat进行网络连接和端口监控Linux命令技巧:利用lsof和netstat进行网络连接和端口监控在Linux系统中,网络连接和端口监控是系统管理员和网络工程师必须掌握的技能。
本文将介绍如何使用lsof和netstat这两个强大的命令行工具来实现网络连接的监控和端口的查看。
一、lsof命令lsof(List Open Files)是一个用于查看Linux系统中打开的文件的命令。
除了查看文件外,它还可以用来查看网络连接。
下面是一些常用的lsof命令选项与实例:1. 查看指定端口的连接要查看指定端口的连接状态,可以使用以下命令:```shelllsof -i :port_number```其中,port_number是待查看的端口号。
例如,要查看80端口的连接状态,我们可以执行以下命令:```shelllsof -i :80```2. 查看活动的网络连接要查看系统上当前活动的网络连接,可以使用以下命令:```shelllsof -i```该命令将列出系统上所有活动的网络连接,包括连接类型、本地地址、远程地址和状态。
3. 查看指定进程的网络连接要查看指定进程的网络连接,可以使用以下命令:```shelllsof -p PID```其中,PID是进程的ID。
例如,要查看进程号为1234的进程的网络连接,我们可以执行以下命令:```shelllsof -p 1234```二、netstat命令netstat命令用于查看系统网络状态和网络连接信息。
下面是一些常用的netstat命令选项与实例:1. 查看所有网络连接要查看系统上所有的网络连接状态,可以使用以下命令:```shellnetstat -a```该命令将列出所有的网络连接信息,包括本地地址、远程地址、连接状态等。
2. 查看指定端口的监听情况要查看指定端口是否正在被监听,可以使用以下命令:```shellnetstat -tuln | grep port_number```其中,port_number是待查看的端口号。
每位linux系统管理员必须知道的20条监控工具1.Finding out bottlenecks.2.Disk (storage) bottlenecks.3.CPU and memory bottlenecks.work bottlenecks.#1: top - Process Activity CommandThe top program provides a dynamic real-time view of a runningsystem i.e. actual process activity. By default, it displays the mostCPU-intensive tasks running on the server and updates the list everyfive seconds.Fig.01: Linux top commandCommonly Used Hot KeysThe top command provides several useful hot keys:HotKeyUsaget Displays summary information off and on.m Displays memory information off and on.A Sorts the display by top consumers of various system eful for quick identification of performance-hungry tasks on a system.f Enters an interactive configuration screen for top. Helpful for setting up top for a specific task.o Enables you to interactively select the ordering within top. r Issues renice command.k Issues kill command.z Turn on or off color/mono=> Related:How do I Find Out Linux CPU Utilization?#2: vmstat - System Activity, Hardware and System InformationThe command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.# vmstat 3Sample Outputs:procs -----------memory---------- ---swap-- -----io---- --system-------cpu------r b swpd free buff cache si so bi bo in cs us sy id wa st0 0 0 2540988 5221885130400 0 0 2 32 4 2 4 1 96 0 01 0 0 2540988 522188 5130400 0 0 0 7201199 665 1 0 99 0 00 0 0 2540956 522188 5130400 0 0 0 0 11511569 4 1 95 0 00 0 0 2540956 522188 5130500 0 0 0 61117 439 1 0 99 0 00 0 0 2540940 522188 5130512 0 0 0 5361189 932 1 0 98 0 00 0 0 2538444 522188 5130588 0 0 0 0 11871417 4 1 96 0 00 0 0 2490060 522188 5130640 0 0 0 18 12531123 5 1 94 0 0Display Memory Utilization Slabinfo# vmstat -mGet Information About Active / Inactive Memory Pages# vmstat -a=> Related:How do I find out Linux Resource utilization to detect system bottlenecks?#3: w - Find Out Who Is Logged on And What They Are Doingw command displays information about the users currently on the machine, and their processes. # w username# w vivekSample Outputs: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.confroot pts/1 10.1.3.145 17:43 0.00s 0.03s 0.00s w#4: uptime - Tell How Long The System Has Been RunningThe uptime commandcan be used to see how long the server has beenrunning. The current time, how long the system has been running, howmany users are currently logged on, and the system load averages forthe past 1, 5, and 15 minutes.# uptimeOutput:18:02:41 up 41 days, 23:42, 1 user, load average: 0.00, 0.00, 0.001 can be considered as optimal load value. The load can change fromsystem to system. For a single CPU system 1 - 3 and SMP systems 6-10load value might be acceptable.#5: ps - Displays The Processesps command will report a snapshot of the current processes. To select all processes use the -A or -e option: # ps -ASample Outputs:PID TTY TIME CMD1 ? 00:00:02 init2 ? 00:00:02 migration/03 ? 00:00:01 ksoftirqd/04 ? 00:00:00 watchdog/05 ? 00:00:00 migration/16 ? 00:00:15 ksoftirqd/1.........4881 ? 00:53:28 java4885 tty1 00:00:00 mingetty4886 tty2 00:00:00 mingetty4887 tty3 00:00:00 mingetty4888 tty4 00:00:00 mingetty4891 tty5 00:00:00 mingetty4892 tty6 00:00:00 mingetty4893 ttyS1 00:00:00 agetty12853 ? 00:00:00 cifsoplockd12854 ? 00:00:00 cifsdnotifyd14231 ? 00:10:34 lighttpd14232 ? 00:00:00 php -cgi54981 pts/0 00:00:00 vim55465 ? 00:00:00 php-cgi55546 ? 00:00:00 bind 9-snmp -stat55704 pts/1 00:00:00 psps is just like top but provides more information.Show Long Format Output# ps -AlTo turn on extra full mode (it will show command line arguments passed to process):# ps -AlFTo See Threads ( LWP and NLWP)# ps -AlFHTo See Threads After Processes# ps -AlLmPrint All Process On The Server# ps ax# ps axuPrint A Process Tree# ps -ejH# ps axjf# pstreePrint Security Information# ps -eo euser,ruser,suser,fuser,f,comm,label # ps axZ# ps -eMSee Every Process Running As User Vivek# ps -U vivek -u vivek uSet Output In a User-Defined Format# ps -eopid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm# ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm# ps -eopid,tt,user,fname,tmout,f,wchanDisplay Only The Process IDs of Lighttpd# ps -C lighttpd -o pid=OR# pgrep lighttpdOR# pgrep -u vivek php-cgiDisplay The Name of PID 55977# ps -p 55977 -o comm=Find Out The Top 10 Memory Consuming Process# ps -auxf | sort -nr -k 4 | head -10Find Out top 10 CPU Consuming Process# ps -auxf | sort -nr -k 3 | head -10#6: free - Memory UsageThe command free displays the total amount of free and used physicaland swap memory in the system, as well as the buffers used by thekernel.# freeSample Output:total used free shared buffers cac hedMem: 12302896 9739664 2563232 0 523124 515 4740-/+ buffers/cache: 4061800 8241096Swap: 1052248 0 1052248=> Related::1.Linux Find Out Virtual Memory PAGESIZE2.Linux Limit CPU Usage Per Process3.How much RAM does my Ubuntu / Fedora Linux desktop PC have?#7: iostat - Average CPU Load, Disk ActivityThe command iostat reportCentral Processing Unit (CPU) statisticsand input/output statistics for devices, partitions and networkfilesystems (NFS).# iostatSample Outputs:Linux 2.6.18-128.1.14.el5 (www03.nixcraft.in) 06/26/2009avg-cpu: %user %nice %system %iowait %steal %idle3.50 0.09 0.51 0.03 0.00 95.86Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrt nsda 22.04 31.88 512.03 16193351 26010286 8sda1 0.00 0.00 0.00 2166 18 0sda2 22.04 31.87 512.03 16189010 26010268 8sda3 0.00 0.00 0.00 1615 0=> Related:: Linux Track NFS Directory / Disk I/O Stats#8: sar - Collect and Report System ActivityThe sar command is used to collect, report, and save system activity information. To see network counter, enter:# sar -n DEV | moreTo display the network counters from the 24th:# sar -n DEV -f /var/log/sa/sa24 | moreYou can also display real time usage using sar:# sar 4 5Sample Outputs:Linux 2.6.18-128.1.14.el5(www03.nixcraft.in) 06/26/200906:45:12PM CPU %user %nice %system %iowait %steal %i dle06:45:16PM all 2.00 0.00 0.22 0.00 0.00 97 .7806:45:20PM all 2.07 0.00 0.38 0.03 0.00 97 .5206:45:24PM all 0.94 0.00 0.28 0.00 0.00 98 .7806:45:28PM all 1.56 0.00 0.22 0.00 0.00 98 .2206:45:32PM all 3.53 0.00 0.25 0.03 0.00 96 .19Average: all 2.02 0.00 0.27 0.01 0.00 97.70=> Related:: How to collect Linux system utilization data into a file#9: mpstat - Multiprocessor UsageThe mpstat command displays activities for each available processor,processor 0 being the first one. mpstat -P ALL to display average CPUutilization per processor:# mpstat -P ALLSample Output:Linux 2.6.18-128.1.14.el5(www03.nixcraft.in) 06/26/200906:48:11PM CPU %user %nice %sys %iowait %irq %soft %steal %id le intr/s06:48:11PM all 3.50 0.09 0.34 0.03 0.01 0.17 0.00 95.86 1218.0406:48:11PM 0 3.44 0.08 0.31 0.02 0.00 0.12 0.00 96.04 1000.3106:48:11PM 1 3.10 0.08 0.32 0.09 0.02 0.11 0.00 96.28 34.9306:48:11PM 2 4.16 0.11 0.36 0.02 0.00 0.11 0.00 95.25 0.0006:48:11PM 3 3.77 0.11 0.38 0.03 0.01 0.24 0.00 95.46 44.8006:48:11PM 4 2.96 0.07 0.29 0.04 0.02 0.10 0.00 96.52 25.9106:48:11PM 5 3.26 0.08 0.28 0.03 0.01 0.10 0.00 96.23 14.9806:48:11PM 6 4.00 0.10 0.34 0.01 0.00 0.13 0.00 95.42 3.7506:48:11PM 7 3.30 0.11 0.39 0.03 0.01 0.46 0.00 95. 69 76.89=> Related:: Linux display each multiple SMP CPU processors utilization individually .#10: pmap - Process Memory UsageThe command pmap report memory map of a process. Use this command to find out causes of memory bottlenecks.# pmap -d PIDTo display process memory information for pid # 47394, enter:# pmap -d 47394Sample Outputs:47394: /usr/bin/php-cgiAddress Kbytes Mode Offset Device Mapping 0000000000400000 2584 r-x-- 0000000000000000 008:00002 php-cgi 0000000000886000 140 rw--- 0000000000286000 008:00002 php-cgi 00000000008a9000 52 rw--- 00000000008a9000 000:00000 [ anon ] 0000000000aa8000 76 rw--- 00000000002a8000 008:00002 php-cgi 000000000f678000 1980 rw--- 000000000f678000 000:00000 [ anon ] 000000314a600000 112 r-x-- 0000000000000000 008:00002 ld-2.5.so 000000314a81b000 4 r---- 000000000001b000 008:00002 ld-2.5.so 000000314a81c000 4 rw--- 000000000001c000 008:00002 ld-2.5.so 000000314aa00000 1328 r-x-- 0000000000000000 008:00002 libc-2.5.so 000000314ab4c000 2048 ----- 000000000014c000 008:00002 libc-2.5.so .............00002af8d48fd000 4 rw--- 0000000000006000 008:00002 xsl.so 00002af8d490c000 40 r-x-- 0000000000000000 008:00002libnss_files-2.5.so00002af8d4916000 2044 ----- 000000000000a000 008:00002libnss_files-2.5.so00002af8d4b15000 4 r---- 0000000000009000 008:00002libnss_files-2.5.so00002af8d4b16000 4 rw--- 000000000000a000 008:00002libnss_files-2.5.so00002af8d4b17000 768000 rw-s- 0000000000000000 000:00009 zero (deleted) 00007fffc95fe000 84 rw--- 00007ffffffea000 000:00000 [ stack ] ffffffffff600000 8192 ----- 0000000000000000 000:00000 [ anon ] mapped: 933712K writeable/private: 4304K shared: 768000KThe last line very important:∙mapped: 933712K total amount of memory mapped to files∙writeable/private: 4304K the amount of private address space∙shared: 768000K the amount of address space this process is sharing with others=> Related:: Linux find the memory used by a program / process using pmap command#11 and #12: netstat and ss - Network StatisticsThe command netstat displays network connections, routing tables,interface statistics, masquerade connections, and multicastmemberships. ss command is used to dump socket statistics. It allowsshowing information similar to netstat. See the following resourcesabout ss and netstat commands:∙ss: Display Linux TCP / UDP Network and Socket Information∙Get Detailed Information About Particular IP address Connections Using netstat Command#13: iptraf - Real-time Network StatisticsThe iptraf command is interactive colorful IP LAN monitor. It is anncurses-based IP LAN monitor that generates various network statisticsincluding TCP info, UDP counts, ICMP and OSPF information, Ethernetload info, node stats, IP checksum errors, and others. It can providethe following info in easy to read format:∙Network traffic statistics by TCP connection∙IP traffic statistics by network interface∙Network traffic statistics by protocol∙Network traffic statistics by TCP/UDP port and by packet size ∙Network traffic statistics by Layer2 addressFig.02: General interface statistics: IP traffic statistics by network interfaceFig.03 Network traffic statistics by TCP connection#14: tcpdump - Detailed Network Traffic AnalysisThe tcpdump is simplecommand that dump traffic on a network.However, you need good understanding of TCP/IP protocol to utilize thistool. For.e.g to display traffic info about DNS, enter:# tcpdump -i eth1 'udp port 53'To display all IPv4 HTTP packets to and from port 80, i.e. print onlypackets that contain data, not, for example, SYN and FIN packets andACK-only packets, enter:# tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) -((tcp[12]&0xf0)>>2)) != 0)'To display all FTP session to 202.54.1.5, enter:# tcpdump -i eth1 'dst 202.54.1.5 and (port 21 or 20'To display all HTTP session to 192.168.1.5:# tcpdump -ni eth0 'dst 192.168.1.5 and tcp and port http'Use wireshark to view detailed information about files, enter:# tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80#15: strace - System CallsTrace system calls and signals. This is useful for debugging web server and other server problems. See how to use to trace the process and see What it is doing.#16: /Proc file system - Various Kernel Statistics/proc file system provides detailed information about various hardware devices and other Linux kernel information. See Linux kernel /proc documentations for further details. Common /proc examples:# cat /proc/cpuinfo# cat /proc/meminfo# cat /proc/zoneinfo# cat /proc/mounts17#: Nagios - Server And Network Monitoring Nagios is apopular open source computer system and network monitoring applicationsoftware. You can easily monitor all your hosts, network equipment andservices. It can send alert when things go wrong and again when theyget better. FAN is "Fully Automated Nagios". FAN goals are to provide a Nagiosinstallation including most tools provided by the Nagios Community. FANprovides a CDRom image in the standard ISO format, making it easy toeasilly install a Nagios server. Added to this, a wide bunch of toolsare including to the distribution, in order to improve the userexperience around Nagios.18#: Cacti - Web-based Monitoring ToolCacti is a complete network graphing solution designed to harnessthe power of RRDTool's data storage and graphing functionality. Cactiprovides a fast poller, advanced graph templating, multiple dataacquisition methods, and user management features out of the box. Allof this is wrapped in an intuitive, easy touse interface that makessense for LAN-sized installations up to complex networks with hundredsof devices. It can provide data about network, CPU, memory, logged inusers, Apache , DNS servers and much more. See how to install and configure Cacti network graphing tool under CentOS / RHEL.#19: KDE System Guard - Real-time Systems Reporting and GraphingKSysguard is a network enabled task and system monitor applicationfor KDE desktop. This tool can be run over ssh session. It provideslots of features such as a client/server architecture that enablesmonitoring of local and remote hosts. The graphical front end usesso-called sensors to retrieve the information it displays. A sensor canreturn simple values or more complex information like tables. For eachtype of information, one or more displays are provided. Displays areorganized in worksheets that can be saved and loaded independently fromeach other. So, KSysguard is not only a simple task manager but also avery powerful tool to control large server farms.Fig.05 KDE System Guard {Image credit: Wikipedia}See the KSysguard handbook for detailed usage.#20: Gnome System Monitor - Real-time Systems Reporting and GraphingTheSystem Monitor application enables you to display basic systeminformation and monitor system processes, usage of system resources,and file systems. You can also use System Monitor to modify thebehavior of your system. Although not as powerful as the KDE SystemGuard, it provides the basic information which may be useful for newusers:∙Displays various basic information about the computer's hardware and software.∙Linux Kernel version∙GNOME version∙Hardware∙Installed memory∙Processors and speeds∙System Status∙Currently available disk space∙Processes∙Memory and swap space∙Network usage∙File Systems∙Lists all mounted filesystems along with basic information about each.Fig.06 The Gnome System Monitor applicationBounce: Additional ToolsA few more tools:∙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 waysimilar to what top command does for processes i.e. it is networktraffic monitoring software. You can see network status, protocol wisedistribution of traffic for UDP, TCP, DNS, HTTP and other protocols.∙Conky-Another good monitoring tool for the X Window System. It is highlyconfigurable and is able to monitor many system variables including thestatus of the CPU, memory, swap space, disk storage, temperatures,processes, network interfaces, battery power, system messages, e-mailinboxes etc.∙GKrellM- It can be used to monitor the status of CPUs, main memory, harddisks, network interfaces, local and remote mailboxes, and many otherthings.∙vnstat- vnStat is a console-based network traffic monitor. It keepsa log ofhourly, daily and monthly network traffic for the selectedinterface(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.Did I miss something? Please add your favorite system motoring tool in the comments.。