atop是一个功能非常强大的linux服务器监控工具,它的数据采集主要包括:CPU、内存、磁盘、网络、进程等,并且内容非常的详细,特别是当那一部分存在压力它会以特殊的颜色进行展示,如果颜色是红色那么说明已经非常严重了。

注意:所有的信息都是反映过去10S的状态信息

使用

atop工具安装好后在运行命令atop就能弹出监控界面

接下来我们就来详细看看每行参数意义。

atop:改行列出了服务器的host、当前时间、信息收集的频率

PRC:该列展示整个系统的性能状况;

  1. sys:过去10s所有的进程在内核态运行的时间总和
  2. usr:过去10s所有的进程在用户态的运行时间总和
  3. #proc:进程总数
  4. #trun:过去10s转换的进程数
  5. #zombie:过去10s僵死进程的数量
  6. #exit:在10s采样周期期间退出的进程数量

CPU: cpu列展示了服务器的CPU整体的一个状态信息,包括内核和用户所占的比例、处理中断所占的比例、CPU的处于空闲下比例(这里是100%*cpu核心数,CPU有时候也会因为由于磁盘性能问题出现等待的空闲)

  1. sys:cpu在处理进程时处于内核态的时间所占的比例
  2. usr:cpu在处理进程时处于用户态的时间所占的比例
  3. irq:cpu在处理进程的中断请求所占的实际比例
  4. idle:cpu处于空闲状态下的时间比例(除了本身空闲,还有比如等待磁盘io的情况下也会处于空闲状态)

cpu:每个核心的状态信息,和总的CPU信息一样,每列加起来的总和就是总的CPU的状态信息。

CPL:cpl也反应了服务器整体的性能,展示信息包括进程等待队列数,分别从过去1分钟、5分钟、15分钟的采样信息。

  1. avg1:过去1分钟进程等待队列数
  2. avg5:过去5分钟进程等待队列数
  3. avg15:过去15分钟进程等待队列数
  4. csw(context swapping):上下文交换次数
  5. intr(interrupt):中断发生的次数
  6. numcpu:cpu的核心数

mem:该列主要展示内存的使用信息。

  1. tot:物理内存总量
  2. free:空闲内存的大小(不能单单从这个字段就判断内存不足,还需要参考free -m中的-/+ buffers/cache:free因为这块的内容随时就可以拿过来使用,还可以从是否有使用Swap来判断是否内存不足)
  3. cache:用于页缓存的内存大小
  4. dirty:内存中的脏页大小
  5. buff:用于文件缓存的内存大小
  6. slab:系统内核占用的内存大小

SWP:交换空间使用情况

  1. tot:交换空间总量
  2. free:交换空间剩余空间总量

PAG列:虚拟内存分页情况

  1. swin:换入内存页数
  2. swout:换出内存页数

LVM/DSK:每个分区信息以一列来进行展示

  1. busy:磁盘忙时所占比例
  2. read、KiB/r 、MBr/s:每秒读的请求数和请求的kb、mb数
  3. write、KiB/w 、MBr/w:每秒写的请求数和请求的kb、mb数
  4. avq:磁盘平均队列长度(根据实际的监控该列好像是磁盘平均请求数avgrq)
  5. avio:磁盘的平均io时间

NET:展示了传输层(TCP/UDP)、网络层(ip)、网络接口的网络传输信息。

transport:传输层(TCP/UDP)的数据输入输出的展示,例如在服务器的内部进程之间的数据传输就是在传输层展示,以为还不需要往下通过网络进行传输。

network:网络层(ip)的数据输入输出的展示;

eth0:默认的网络接口的数据输入输出的展示,也就是通过etho的ip的数据传输的展示,

  1. sp:网卡的带宽(1000M)
  2. pcki:传入的数据包的大小
  3. pcko:传出的数据包的大小
  4. si:每秒传入的数据大小
  5. so:每秒传出的数据大小
  6. coll(collisions):每秒的冲突数
  7. mlti(MULTICAST):每秒的多路广播的数量
  8. erri/erro:每秒输入输出的错误数
  9. drpi/drpo:每秒的输入输出的丢包数

lo:通过127.0.0.1网络接口的数据传输的数据展示,参数和上面的eth0是一样的

进程列

进程列展示了每个进程在过去10S内的数据

m模式:内存状态模式

SYSCPU:过去10s内进程处于内核模式占用的CPU时间

USRCPU:过去10S进程处于用户模式占用的CPU时间

VSIZE:过去10S进程占用的虚拟空间大小

RSIZE:过去10S进程占用的内存空间大小

PSIZE:过去10S进程占用的页大小

VGROW:过去10S进程增长的虚拟空间大小

RGROW:过去10S进程增长的内存大小

SWAPSZ:过去10S进程使用交换空间的大小。

MEM:过去10S进程占用内存百分比

d模式:磁盘状态模式

RDDSK:过去10S进程读磁盘的数据量

WRDSK:过去10S进程写磁盘的数据量
DSK:过去10S进程所占磁盘的百分比
CMD:进程名 

p模式:进程状态模式,同一个名称的进程显示一列,根据进程名进行分组显示

NPROCS:相同名称的进程数量

其它的参数上面已经有列出

v模式:线程状态模式

u模式:用户模式

根据用户进行分组显示

g模式:标准模式

s:进程当前的状态,包括:s(sleeping),R(runing)等

atop的相关文件

/etc/atop:目录保存的是atop的配置文件
/etc/rc.d/init.d/atop:atop的启动文件
/etc/cron.d/atop:atop的定时任务文件,默认是每天0点开始
/var/log/atop:atop日志文件,默认是每天0点开始会产生当天的一个日志文件,然后可以通过atop -r file 查看信息,但是没有找到自动播放的的功能,只能通过输入b显示一个指定的时间的信息,可以写个循环来实现
/usr/bin/atop:atop命令目录

atop -r atop_20160510 -b 13:00 -e 17:00 

atop产生的日志文件信息是10分钟一个采样周期进行记录,可以通过修改/etc/atop/atop.daily文件进行修改。

atop的其它参数:

 
Usage: atop [-flags] [interval [samples]]
or
Usage: atop -w file [-S] [-a] [interval [samples]]
atop -r [file] [-b hh:mm] [-e hh:mm] [-flags] generic flags:
-a show or log all processes (i.s.o. active processes only)
-R calculate proportional set size (PSS) per process
-P generate parseable output for specified label(s)
-L alternate line length (default 80) in case of non-screen output
-f show fixed number of lines with system statistics
-F suppress sorting of system resources
-G suppress exited processes in output
-l show limited number of lines for certain resources
-y show individual threads
-1 show average-per-second i.s.o. total values -x no colors in case of high occupation
-g show general process-info (default)
-m show memory-related process-info
-d show disk-related process-info
-n show network-related process-info
-s show scheduling-related process-info
-v show various process-info (ppid, user/group, date/time)
-c show command line per process
-o show own defined process-info
-u show cumulated process-info per user
-p show cumulated process-info per program (i.e. same name) -C sort processes in order of cpu-consumption (default)
-M sort processes in order of memory-consumption
-D sort processes in order of disk-activity
-N sort processes in order of network-activity
-A sort processes in order of most active resource (auto mode) specific flags for raw logfiles:
-w write raw data to file (compressed)
-r read raw data from file (compressed)
special file: y[y...] for yesterday (repeated)
-S finish atop automatically before midnight (i.s.o. #samples)
-b begin showing data from specified time
-e finish showing data after specified time
 

下载地址:http://www.atoptool.nl/downloadatop.php

总结

在atop的展示页面也可以输入m(内存)、p(进程)、u(用户)、d(磁盘)、c(进程运行的代码)、v(线程) 进行页面切换。

We’re all familiar with top, a real-time system monitor. Some prefer htop and previously I mentioned iotop for disk read/write monitoring. Lets looks at another popular tool for Linux server performance analysisatop.

Advantages of atop

Atop is a ASCII full-screen performance monitor which can log and report the activity of all server processes. One feature I really like is that atop will stay active in the background for long-term server analysis (up to 28 days by default). Other advantages include:

  • Shows resource usage of ALL processes, even those that are closed/completed.
  • Monitors threads within processes & ignores processes that are unused.
  • Accumulates resource usage for all processes and users with the same name.
  • Highlights critical resources using colors (red).
  • Will add or remove columns as the size of the display window changes.
  • Includes disk I/O and network utilization.
  • Uses netatop kernel module to monitor TCP & UDP and network bandwidth.

Once atop is launched, by default it will show system activity for CPU, memory, swap, disks and network in 10 second intervals. In addition, for each process and thread you can analyse CPU utilization, memory consumption, disk I/O, priority, username, state, and even exit codes.

Install atop on RHEL/CentOS/Fedora Linux

First install and enable EPEL (Extra Packages for Enterprise Linux) repo. See: RedHat solution #308983.

yum install atop

Install atop on Debian/Ubuntu Linux

apt-get install atop

Once installed on any distro, you can launch it similar to top using:

atop

Guide on using atop system & process Monitor

A good place to start would be to read the man pages:

man atop

Other useful commands:

Launch with average-per-second total values:

atop -1

Launch with active processes only:

atop -a

Launch with command line per process

atop -c

Launch with disk info

atop -d

Launch with memory info

atop -m

Launch with network info

atop -n

Launch with scheduling info

atop -s

Launch with various info (ppid, user, time)

atop -v

Launch with individual threads

atop -y

Once atop is running, press the following shortcut keys to sort processes:

  • a – sort in order of most active resource.
  • c – revert to sorting by cpu consumption (default).
  • d – sort in order of disk activity.
  • m – sort in order of memory usage
  • n – sort in order of network activity

Guide to reading atop reports/logs

By default after install the atop daemon writes snapshots to a compressed log file (eg. /var/log/atop/atop_20140813). These log files can be read using:

atop -r /full/path/to/atop/log/file

Once you open a log file (eg. atop -r /var/log/atop/atop_20140813) then use t to go forward in 10 minute intervals and T to go back. You can analyse specific times by pressing b then entering the time. The above shortcut keys also work in this mode… a, c, d, m,n.

You can use shortcuts with atopsar. For example, using the flag “-c 30 5” with atopsar will generate a report for current CPU utilization for 5 minutes (ten times with intervals of 30 seconds):

atopsar -c 30 5

Using the flag -A with return all available reports.

atopsar -A

But you can limit this to a specific time window using beginning “-b” and end “-e” flags:

atopsar -A -b 11:00 -e 11:15

atop: http://www.atoptool.nl/

Other popular command line Linux server performance analysis tools

tophtopnmonnet-toolsiptrafcollectlglancesiostat and vmstat.

Linux atop 监控系统状态的更多相关文章

  1. Linux watch 监控系统状态

    1.linux下watch命令的基本用法 # watch --helpUsage: watch [-dhntv] [--differences[=cumulative]] [--help] [--in ...

  2. 【Linux】监控系统的状态

    1.w命令 w命令是一个很强大的命令,该命令显示的信息比较丰富.以下是我的虚拟机w命令的一个展示 从上图我们可以看到: 第一行从左面开始显示的信息依次为:时间.系统运行时间.登陆用户数.平均负载 第二 ...

  3. sar监控系统状态

    sar 命令很强大,它可以监控系统所有资源状态,比如平均负载.网卡流量.磁盘状态.内存使用等等. 它不同于其他系统状态监控工具的地方在于,它可以打印历史信息,可以显示当天从零点开始到当前时刻的系统状态 ...

  4. 使用haproxy 2.0 prometheus metrics 监控系统状态

    haproxy 2.0 已经发布一段时间了,提供内部直接暴露的prometheus metrics 很方便 ,可以快速的监控系统的状态 以下是一个简单的demo 环境准备 docker-compose ...

  5. Linux记录-监控系统开发

    需求:使用shell定制各种个性化告警工具,但需要统一化管理.规范化管理.思路:指定一个脚本包,包含主程序.子程序.配置文件.邮件引擎.输出日志等.主程序:作为整个脚本的入口,是整个系统的命脉.配置文 ...

  6. linux系统常用监控系统状态信息命令

    [root@bogon ~]# uptime #平均负载 23:33:21 up 2:09, 3 users, load average: 0.02, 0.05, 0.05 [root@bogon ~ ...

  7. Linux atop监控

    200 ? "200px" : this.width)!important;} --> 介绍 atop是一个功能非常强大的linux服务器监控工具,它的数据采集主要包括:CP ...

  8. Linux atop监控说明

    2017-02-22 09:42 by pursuer.chen, 7060 阅读, 2 评论, 收藏, 编辑 介绍 atop是一个功能非常强大的linux服务器监控工具,它的数据采集主要包括:CPU ...

  9. Linux基础--------监控系统、进程管理、软件包管理-------free、dd、kill、 rpm、yum、源码安装python

    作业一:1) 开启Linux系统前添加一块大小为15G的SCSI硬盘 2) 开启系统,右击桌面,打开终端 3) 为新加的硬盘分区,一个主分区大小为5G,剩余空间给扩展分区,在扩展分区上划分1个逻辑分区 ...

随机推荐

  1. 支付宝客户端架构解析:Android 容器化框架初探

    摘要: 本文将介绍支付宝 Android 容器化框架设计的基本思路. 1. 前言 由本章节开始,我们将从支付宝客户端的架构设计方案入手,细分拆解客户端在“容器化框架设计”.“网络优化”.“性能启动优化 ...

  2. MySQL中间件之ProxySQL(13):ProxySQL集群

    返回ProxySQL系列文章:http://www.cnblogs.com/f-ck-need-u/p/7586194.html ProxySQL有原生的集群功能,但是这个原生的集群功能还正在试验阶段 ...

  3. Python函数属性和PyCodeObject

    函数属性 python中的函数是一种对象,它有属于对象的属性.除此之外,函数还可以自定义自己的属性.注意,属性是和对象相关的,和作用域无关. 自定义属性 自定义函数自己的属性方式很简单.假设函数名称为 ...

  4. Go基础系列:指定goroutine的执行顺序

    Go channel系列: channel入门 为select设置超时时间 nil channel用法示例 双层channel用法示例 指定goroutine的执行顺序 当关闭一个channel时,会 ...

  5. 为Spring Cloud Config插上管理的翅膀

    最近一致在更新Spring Cloud Config的相关内容,主要也是为这篇埋个伏笔,相信不少调研过Spring Cloud Config的用户都会吐槽它的管理能力太弱.因此,就有了下面为讲推荐的这 ...

  6. Ubuntu使用(一)——常用命令与软件安装配置

    1.安装输入法 2.配置JDK 3.eclipse 3.1 eclipse启动错误 修改eclipse.init的配置,主要加-vm以及下面的jre路径,路径前别留空格 之前因为加了空格,一直找不到原 ...

  7. RNN入门(三)利用LSTM生成旅游点评

    介绍   前几天,某个公众号发文质疑马蜂窝网站,认为它搬运其它网站的旅游点评,对此,马蜂窝网站迅速地做出了回应.相信大多数关注时事的群众已经了解了整个事情的经过,在这里,我们且不论这件事的是是非非,也 ...

  8. Windows server 2008 R2端口转发

    查询配置了转发的端口 netsh interface portproxy show v4tov4 配置转发(所有ip访问192.168.0.99的1001端口均指向1953端口) netsh inte ...

  9. ajax实现跨域访问

    ajax跨域访问是一个老生畅谈的问题啦,网上解决方法很多,discuz用的p3p协议,有兴趣的朋友可以了解下,比较常用的是JSONP方法,貌似目前这种方法只支持GET方式,不如POST方式安全. 即使 ...

  10. sudo: cd: command not found

    事件起因 今天在aws ubutun上忽然发现的一个问题,执行sudo cd 时出现 sudo: cd: command not found 原因 shell shell是一个命令解析器 所谓shel ...