Linux中sysstat服务,Linux 性能优化工具包 sysstat 以及 sysstat 服务

1. sysstat 服务

1.1. /etc/cron.d/sysstat

Linux 下的性能分析,少不了要使用 sysstat 工具包中的命令。同时 sysstat 服务会自动每个10分钟收集一次系统状态信息,并将它们存储到 /var/log/sa目录下。每天一个文件,文件名分别是sa1, sa2,... sa30..

[root@localhost sa]#pwd

/var/log/sa

[root@localhost sa]#ls

sa01 sa03 sa05 sa06 sa07 sa08 sa09 sa10 sa11 sa12 sa13 sa14 sa15 sa25 sa26 sa27 sa28 sa29 sa30 sar25

自动收集系统信息,是通过 /etc/cron.d/sysstat 来实现的:

[root@localhost sa]#cat /etc/cron.d/sysstat

# Run system activity accounting tool every 10 minutes

*/10 * * * * root /usr/lib/sa/sa1 1 1

#0 * * * * root /usr/lib/sa/sa1 600 6 &

# Generate a daily summary of process accounting at 23:53

53 23 * * * root /usr/lib/sa/sa2 -A

上面标示每个10分钟,运行一次 /usr/lib/sa/sa1 1 1, 该命令 man sa1:

sa1 - Collect and store binary data in the system activity daily data file.

SYNOPSIS:/usr/lib/sa/sa1 [ --boot | interval count ]

sa1 收集到的是 binary data. 所以 sa2 -A 负责将当天的二进制文件转换成文本文件。

sa2 - Write a daily report in the /var/log/sa directory

其中的收集信息的频率我们可以根据需要进行修改。

1.2. /etc/sysconfig/sysstat

/var/log/sa/目录下的文件保存时间等相关配置存在于文件 /etc/sysconfig/sysstat中:

[root@localhost ~]#cat /etc/sysconfig/sysstat

# sysstat-9.0.4 configuration file.

# How long to keep log files (in days).

# If value is greater than 28, then log files are kept in

# multiple directories, one for each month.

HISTORY=28

#Compress (using gzip or bzip2) sa and sar files older than (in days):

COMPRESSAFTER=31

#Parameters for the system activity data collector (see sadc manual page)

# which are used for the generation of log files.

SADC_OPTIONS="-S DISK"

#Compression program to use.

ZIP="bzip2"

其中的 HISTORY=28 表示最多保存28天的数据。保存时间,我们可以根据需要进行修改。

1.3. 确保 sysstat 服务启动:

[root@localhost ~]#chkconfig --level 3 --level 5 sysstat on

[root@localhost ~]#chkconfig |grep sysstat

sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off

上面是 sysstat 服务运行的知识。下面是 sysstat 工具包中的命令行如何使用收集到的信息,来了解系统的运行情况。

2. sysstat 工具包中的命令

原文:http://www.cnblogs.com/digdeep/p/4878138.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值