zoukankan      html  css  js  c++  java
  • linux 安装sysstat使用iostat、mpstat、sar、sa

    使用yum安装 
    #yum install sysstat 

    sysstat的安装包是:sysstat-5.0.5-1.i386.rpm,装完了sysstat-5.0.5-1.i386.rpm
    后 就会有iostat、mpstat、sar、sa的功能,sysstat-5.0.5-1.i386.rpm 

    启动sysstat 
    /etc/init.d/sysstat start 

    设置sysstat自启动 
    #chkconfig sysstat on

    MPSTAT
    MPSTAT -P ALL 2 3
     
    mpstat是Multiprocessor Statistics的缩写,是实时系统监控工具。其报告与CPU的一些统计信息,这些信息存放在/proc/stat文件中。在多CPUs系统里,其不 但能查看所有CPU的平均状况信息,而且能够查看特定CPU的信息。下面只介绍 mpstat与CPU相关的参数,mpstat的语法如下:
    mpstat [-P {|ALL}] [internal [count]]
    参数的含义如下:
    参数 解释
    -P {|ALL} 表示监控哪个CPU, cpu在[0,cpu个数-1]中取值
    internal 相邻的两次采样的间隔时间
    count 采样的次数,count只能和delay一起使用
    当没有参数时,mpstat则显示系统启动以后所有信息的平均值。有interval时,第 一行的信息自系统启动以来的平均信息。从第二行开始,输出为前一个interval时间段的平均信息。与CPU有关的输出的含义如下:
    参数 解释 从/proc/stat获得数据
    CPU 处理器ID
    user 在internal时间段里,用户态的CPU时间(%) ,不包含 nice值为负 进程 usr/total*100
    nice 在internal时间段里,nice值为负进程的CPU时间(%) nice/total*100
    system 在internal时间段里,核心时间(%) system/total*100
    iowait 在internal时间段里,硬盘IO等待时间(%) iowait/total*100
    irq 在internal时间段里,软中断时间(%) irq/total*100
    soft 在internal时间段里,软中断时间(%) softirq/total*100
    idle 在internal时间段里,CPU除去等待磁盘IO操作外的因为任何原因而空闲的时间闲置时间 (%) idle/total*100
    intr/s 在internal时间段里,每秒CPU接收的中断的次数 intr/total*100
    CPU总的工作时 间=total_cur=user+system+nice+idle+iowait+irq+softirq
    total_pre=pre_user+ pre_system+ pre_nice+ pre_idle+ pre_iowait+ pre_irq+ pre_softirq
    user=user_cur – user_pre
    total=total_cur-total_pre
    其中_cur 表示当前值,_pre表示interval时间前的值。上表中的所有值可取到两位小数点。
    cat /proc/stat
    “ctxt”给出了自系统启动以来CPU发生的上下文交换的次数。
    “btime”给出了从系统启动到现在为止的时间,单位为秒。
    “processes (total_forks) 自系统启动以来所创建的任务的个数目。
    “procs_running”:当前运行队列的任务的数目。
    “procs_blocked”:当前被阻塞的任务的数目。
     
    ============================
    sysstat工具包提供的主要命令:iostat mpstat sar
    sar的最后两个参数一般是interval count
    1、sar -u 1 5
    输出CPU使用情况的统计信息,每秒输出一次,一共输出100次
    2、sar -b 1 5
    显示I/O和传送速率的统计信息
    3、sar -c
    每秒钟创建的进程数
    4、sar -n DEV 1 5
    输出网络设备状态的统计信息
    5、sar -q 1 5
    输出进程队列长度和平均负载状态统计信息
    6、sar -r
    输出内存和交换空间的统计信息
    7、iostat
    tps 每秒钟物理设备的 I/O 传输总 量。
  • 相关阅读:
    反向代理实例
    nginx常用命令和配置
    nginx的安装
    Can Live View boot up images acquired from 64bit OS evidence?
    What is the behavior of lnk files?
    EnCase v7 search hits in compound files?
    How to search compound files
    iOS 8.3 JB ready
    Sunglasses
    现代福尔摩斯
  • 原文地址:https://www.cnblogs.com/sfnz/p/4724193.html
Copyright © 2011-2022 走看看