I. 安装

有两种方式,第1是 使用安装包管理器,如yum,apt,rpm等。第2是 二进制方式安装。两种方式均可。

  1. 根据发行版安装。
yum install -y sysstat
(or)
sudo apt-get install sysstat
(or)
rpm -ivh rpm -ivh sysstat-10.0.0-1.i586.rpm
  1. 二进制方式安装
# 获取包并解压搜
wget http://pagesperso-orange.fr/sebastien.godard/sysstat-10.0.0.tar.bz2
bunzip2 sysstat-10.0.0.tar.gz
tar xvf sysstat-10.0.0.tar

# 制作makefile,编译,安装。
cd /sysstat-10.0.0.tar
./configure --enable-install-cron
make
make install 

二进制安装结果如下所示:

[root@localhost sysstat-10.0.0]# ./configure --enable-install-cron
.
Check programs:
.
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for chmod... chmod
checking for chown... chown
checking for ar... ar
checking for install... install
checking for msgfmt... msgfmt
checking for xgettext... xgettext
checking for msgmerge... msgmerge
checking for bzip2... bzip2
checking for cp... /bin/cp
checking for chkconfig... /sbin/chkconfig
.
Check header files:
.
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking net/if.h usability... yes
checking net/if.h presence... yes
checking for net/if.h... yes
checking regex.h usability... yes
checking regex.h presence... yes
checking for regex.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking for sys/stat.h... (cached) yes
.
Check typedefs, structures and compiler characteristics:
.
checking return type of signal handlers... void
checking for size_t... yes
checking for off_t... yes
.
Check library functions:
.
checking for strchr... yes
checking for strcspn... yes
checking for strspn... yes
checking for strstr... yes
checking for sensors support... yes
checking for sensors_get_detected_chips in -lsensors... no
checking for sensors lib... no
.
Check system services:
.
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
.
Check configuration:
.
checking run-commands directory... /etc/rc.d
checking sadc directory... /usr/local/lib/sa
INFO: Directory /usr/local/lib/sa will be created during installation stage.
checking system activity directory... /var/log/sa
INFO: Directory /var/log/sa will be created during installation stage.
checking sysstat configuration directory... /etc/sysconfig
checking National Language Support... yes
checking whether sa2 should process data file of the day before... no
checking number of daily data files to keep... 7
checking number of days after which data files are compressed... 10
checking group for manual pages... man
checking whether man_group variable should be ignored... no
checking whether manual pages should be compressed... no
checking whether isag script should be installed... no
checking whether system activity directory should be cleaned... no
checking whether cron should start sar automatically... yes
checking crontab owner... root
INFO: Crontab for root will be saved in current directory if necessary
checking crontab interval... 10
checking whether documentation should be installed... yes
.
Now create files:
.
configure: creating ./config.status
config.status: creating sa1
config.status: creating sa2
config.status: creating cron/crontab
config.status: creating sysstat.sysconfig
config.status: creating version.h
config.status: creating sysconfig.h
config.status: creating cron/sysstat.cron.daily
config.status: creating cron/sysstat.cron.hourly
config.status: creating cron/sysstat.crond
config.status: creating cron/sysstat.crond.sample.in
config.status: creating sysstat
config.status: creating man/sa1.8
config.status: creating man/sa2.8
config.status: creating man/sadc.8
config.status: creating man/sadf.1
config.status: creating man/sar.1
config.status: creating man/sysstat.5
config.status: creating man/iostat.1
config.status: creating man/cifsiostat.1
config.status: creating man/nfsiostat.1
config.status: creating contrib/isag/isag
config.status: creating Makefile

   Sysstat version:             10.0.0
   Installation prefix:         /usr/local
   rc directory:                /etc/rc.d
   Init directory:              /etc/rc.d/init.d
   Configuration directory:     /etc/sysconfig
   Man pages directory:         ${datarootdir}/man
   Compiler:                    gcc
   Compiler flags:              -g -O2

[root@localhost sysstat-10.0.0]# make
gcc -o sadc.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" sadc.c
gcc -o act_sadc.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2 -DSOURCE_SADC  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" activity.c
gcc -o sa_wrap.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" sa_wrap.c
gcc -o sa_common.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" sa_common.c
gcc -o rd_stats.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" rd_stats.c
ar rv librdstats.a rd_stats.o
ar: creating librdstats.a
a - rd_stats.o
gcc -o rd_sensors.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" rd_sensors.c
ar rv librdsensors.a rd_sensors.o
ar: creating librdsensors.a
a - rd_sensors.o
gcc -o common.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" common.c
gcc -o ioconf.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" ioconf.c
ar rvs libsyscom.a common.o ioconf.o
ar: creating libsyscom.a
a - common.o
a - ioconf.o
gcc -o sadc -g -O2 -Wall -Wstrict-prototypes -pipe -O2 sadc.o act_sadc.o sa_wrap.o sa_common.o librdstats.a librdsensors.a libsyscom.a -s
gcc -o sar.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" sar.c
gcc -o act_sar.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2 -DSOURCE_SAR  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" activity.c
gcc -o pr_stats.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" pr_stats.c
gcc -o sar -g -O2 -Wall -Wstrict-prototypes -pipe -O2 sar.o act_sar.o sa_common.o pr_stats.o libsyscom.a -s
gcc -o sadf.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" sadf.c
gcc -o act_sadf.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2 -DSOURCE_SADF  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" activity.c
gcc -o rndr_stats.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" rndr_stats.c
gcc -o xml_stats.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" xml_stats.c
gcc -o sadf -g -O2 -Wall -Wstrict-prototypes -pipe -O2 sadf.o act_sadf.o rndr_stats.o xml_stats.o sa_common.o libsyscom.a -s
gcc -o iostat.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" iostat.c
gcc -o iostat -g -O2 -Wall -Wstrict-prototypes -pipe -O2 iostat.o librdstats.a libsyscom.a -s
gcc -o mpstat.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" mpstat.c
gcc -o mpstat -g -O2 -Wall -Wstrict-prototypes -pipe -O2 mpstat.o librdstats.a libsyscom.a -s
gcc -o pidstat.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" pidstat.c
gcc -o pidstat -g -O2 -Wall -Wstrict-prototypes -pipe -O2 pidstat.o librdstats.a libsyscom.a -s
gcc -o nfsiostat.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" nfsiostat.c
gcc -o nfsiostat -g -O2 -Wall -Wstrict-prototypes -pipe -O2 nfsiostat.o librdstats.a libsyscom.a -s
gcc -o cifsiostat.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2  -DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"  -DUSE_NLS -DPACKAGE=\"sysstat\" -DLOCALEDIR=\"/usr/local/share/locale\" cifsiostat.c
gcc -o cifsiostat -g -O2 -Wall -Wstrict-prototypes -pipe -O2 cifsiostat.o librdstats.a libsyscom.a -s
msgfmt -o nls/de.gmo nls/de.po
msgfmt -o nls/nn.gmo nls/nn.po
msgfmt -o nls/ja.gmo nls/ja.po
msgfmt -o nls/mt.gmo nls/mt.po
msgfmt -o nls/fr.gmo nls/fr.po
msgfmt -o nls/vi.gmo nls/vi.po
msgfmt -o nls/da.gmo nls/da.po
msgfmt -o nls/ru.gmo nls/ru.po
msgfmt -o nls/id.gmo nls/id.po
msgfmt -o nls/pt.gmo nls/pt.po
msgfmt -o nls/nb.gmo nls/nb.po
msgfmt -o nls/sv.gmo nls/sv.po
msgfmt -o nls/ky.gmo nls/ky.po
msgfmt -o nls/fi.gmo nls/fi.po
msgfmt -o nls/es.gmo nls/es.po
msgfmt -o nls/eu.gmo nls/eu.po
msgfmt -o nls/pl.gmo nls/pl.po
msgfmt -o nls/cs.gmo nls/cs.po
msgfmt -o nls/it.gmo nls/it.po
msgfmt -o nls/uk.gmo nls/uk.po
msgfmt -o nls/pt_BR.gmo nls/pt_BR.po
msgfmt -o nls/ro.gmo nls/ro.po
msgfmt -o nls/nl.gmo nls/nl.po
msgfmt -o nls/af.gmo nls/af.po
msgfmt -o nls/zh_CN.gmo nls/zh_CN.po
msgfmt -o nls/sk.gmo nls/sk.po
msgfmt -o nls/lv.gmo nls/lv.po
msgfmt -o nls/zh_TW.gmo nls/zh_TW.po


[root@localhost sysstat-10.0.0]# make install
mkdir -p /usr/local/share/man/man1
mkdir -p /usr/local/share/man/man5
mkdir -p /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sa1.8*
install -m 644 -g man man/sa1.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sa2.8*
install -m 644 -g man man/sa2.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sadc.8*
install -m 644 -g man man/sadc.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man1/sar.1*
install -m 644 -g man man/sar.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/sadf.1*
install -m 644 -g man man/sadf.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man5/sysstat.5*
install -m 644 -g man man/sysstat.5 /usr/local/share/man/man5
rm -f /usr/local/share/man/man1/iostat.1*
install -m 644 -g man man/iostat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/mpstat.1*
install -m 644 -g man man/mpstat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/pidstat.1*
install -m 644 -g man man/pidstat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/nfsiostat.1*
install -m 644 -g man man/nfsiostat.1 /usr/local/share/man/man1
rm -f /usr/local/share/man/man1/cifsiostat.1*
install -m 644 -g man man/cifsiostat.1 /usr/local/share/man/man1
mkdir -p /usr/local/share/locale/af/LC_MESSAGES
mkdir -p /usr/local/share/locale/cs/LC_MESSAGES
mkdir -p /usr/local/share/locale/da/LC_MESSAGES
mkdir -p /usr/local/share/locale/de/LC_MESSAGES
mkdir -p /usr/local/share/locale/es/LC_MESSAGES
mkdir -p /usr/local/share/locale/eu/LC_MESSAGES
mkdir -p /usr/local/share/locale/fi/LC_MESSAGES
mkdir -p /usr/local/share/locale/fr/LC_MESSAGES
mkdir -p /usr/local/share/locale/id/LC_MESSAGES
mkdir -p /usr/local/share/locale/it/LC_MESSAGES
mkdir -p /usr/local/share/locale/ja/LC_MESSAGES
mkdir -p /usr/local/share/locale/ky/LC_MESSAGES
mkdir -p /usr/local/share/locale/lv/LC_MESSAGES
mkdir -p /usr/local/share/locale/mt/LC_MESSAGES
mkdir -p /usr/local/share/locale/nb/LC_MESSAGES
mkdir -p /usr/local/share/locale/nl/LC_MESSAGES
mkdir -p /usr/local/share/locale/nn/LC_MESSAGES
mkdir -p /usr/local/share/locale/pl/LC_MESSAGES
mkdir -p /usr/local/share/locale/pt/LC_MESSAGES
mkdir -p /usr/local/share/locale/pt_BR/LC_MESSAGES
mkdir -p /usr/local/share/locale/ro/LC_MESSAGES
mkdir -p /usr/local/share/locale/ru/LC_MESSAGES
mkdir -p /usr/local/share/locale/sk/LC_MESSAGES
mkdir -p /usr/local/share/locale/sv/LC_MESSAGES
mkdir -p /usr/local/share/locale/uk/LC_MESSAGES
mkdir -p /usr/local/share/locale/vi/LC_MESSAGES
mkdir -p /usr/local/share/locale/zh_CN/LC_MESSAGES
mkdir -p /usr/local/share/locale/zh_TW/LC_MESSAGES
install -m 644 nls/af.gmo /usr/local/share/locale/af/LC_MESSAGES/sysstat.mo
install -m 644 nls/cs.gmo /usr/local/share/locale/cs/LC_MESSAGES/sysstat.mo
install -m 644 nls/da.gmo /usr/local/share/locale/da/LC_MESSAGES/sysstat.mo
install -m 644 nls/de.gmo /usr/local/share/locale/de/LC_MESSAGES/sysstat.mo
install -m 644 nls/es.gmo /usr/local/share/locale/es/LC_MESSAGES/sysstat.mo
install -m 644 nls/eu.gmo /usr/local/share/locale/eu/LC_MESSAGES/sysstat.mo
install -m 644 nls/fi.gmo /usr/local/share/locale/fi/LC_MESSAGES/sysstat.mo
install -m 644 nls/fr.gmo /usr/local/share/locale/fr/LC_MESSAGES/sysstat.mo
install -m 644 nls/id.gmo /usr/local/share/locale/id/LC_MESSAGES/sysstat.mo
install -m 644 nls/it.gmo /usr/local/share/locale/it/LC_MESSAGES/sysstat.mo
install -m 644 nls/ja.gmo /usr/local/share/locale/ja/LC_MESSAGES/sysstat.mo
install -m 644 nls/ky.gmo /usr/local/share/locale/ky/LC_MESSAGES/sysstat.mo
install -m 644 nls/lv.gmo /usr/local/share/locale/lv/LC_MESSAGES/sysstat.mo
install -m 644 nls/mt.gmo /usr/local/share/locale/mt/LC_MESSAGES/sysstat.mo
install -m 644 nls/nb.gmo /usr/local/share/locale/nb/LC_MESSAGES/sysstat.mo
install -m 644 nls/nl.gmo /usr/local/share/locale/nl/LC_MESSAGES/sysstat.mo
install -m 644 nls/nn.gmo /usr/local/share/locale/nn/LC_MESSAGES/sysstat.mo
install -m 644 nls/pl.gmo /usr/local/share/locale/pl/LC_MESSAGES/sysstat.mo
install -m 644 nls/pt.gmo /usr/local/share/locale/pt/LC_MESSAGES/sysstat.mo
install -m 644 nls/pt_BR.gmo /usr/local/share/locale/pt_BR/LC_MESSAGES/sysstat.mo
install -m 644 nls/ro.gmo /usr/local/share/locale/ro/LC_MESSAGES/sysstat.mo
install -m 644 nls/ru.gmo /usr/local/share/locale/ru/LC_MESSAGES/sysstat.mo
install -m 644 nls/sk.gmo /usr/local/share/locale/sk/LC_MESSAGES/sysstat.mo
install -m 644 nls/sv.gmo /usr/local/share/locale/sv/LC_MESSAGES/sysstat.mo
install -m 644 nls/uk.gmo /usr/local/share/locale/uk/LC_MESSAGES/sysstat.mo
install -m 644 nls/vi.gmo /usr/local/share/locale/vi/LC_MESSAGES/sysstat.mo
install -m 644 nls/zh_CN.gmo /usr/local/share/locale/zh_CN/LC_MESSAGES/sysstat.mo
install -m 644 nls/zh_TW.gmo /usr/local/share/locale/zh_TW/LC_MESSAGES/sysstat.mo
mkdir -p /usr/local/lib/sa
mkdir -p /var/log/sa
mkdir -p /usr/local/bin
mkdir -p /usr/local/share/doc/sysstat-10.0.0
mkdir -p /etc/sysconfig
install -m 755 sa1 /usr/local/lib/sa
install -m 755 sa2 /usr/local/lib/sa
install -m 755 sadc /usr/local/lib/sa
install -m 755 sar /usr/local/bin
install -m 755 sadf /usr/local/bin
install -m 755 iostat /usr/local/bin
install -m 755 mpstat /usr/local/bin
install -m 755 pidstat /usr/local/bin
install -m 755 nfsiostat /usr/local/bin
install -m 755 cifsiostat /usr/local/bin
install -m 644 sysstat.ioconf /etc/sysconfig
install -m 644 sysstat.sysconfig /etc/sysconfig/sysstat
install -m 644 CHANGES /usr/local/share/doc/sysstat-10.0.0
install -m 644 COPYING /usr/local/share/doc/sysstat-10.0.0
install -m 644 CREDITS /usr/local/share/doc/sysstat-10.0.0
install -m 644 README /usr/local/share/doc/sysstat-10.0.0
install -m 644 FAQ /usr/local/share/doc/sysstat-10.0.0
install -m 644 *.lsm /usr/local/share/doc/sysstat-10.0.0
chown root /var/log/sa
if [ -d /etc/cron.d ]; then \
   install -m 644 cron/sysstat.crond /etc/cron.d/sysstat; \
elif [ -d /etc/cron.hourly -a -d /etc/cron.daily ]; then \
   install -m 755 cron/sysstat.cron.hourly /etc/cron.hourly/sysstat; \
   install -m 755 cron/sysstat.cron.daily /etc/cron.daily/sysstat; \
else \
   su root -c "crontab -l > /tmp/crontab-root.save"; \
   /bin/cp -a /tmp/crontab-root.save ./crontab-root.`date '+%Y%m%d.%H%M%S'`.save; \
   echo "USER'S PREVIOUS CRONTAB SAVED IN CURRENT DIRECTORY (USING .save SUFFIX)."; \
   su root -c "crontab cron/crontab"; \
fi
if [ -d /etc/rc.d/init.d ]; then \
   install -m 755 sysstat /etc/rc.d/init.d/sysstat; \
   if [ -x /sbin/chkconfig ]; then \
      cd /etc/rc.d/init.d && /sbin/chkconfig --add sysstat; \
   else \
      cd /etc/rc.d/rc2.d && ln -s -f ../init.d/sysstat S01sysstat; \
      cd /etc/rc.d/rc3.d && ln -s -f ../init.d/sysstat S01sysstat; \
      cd /etc/rc.d/rc5.d && ln -s -f ../init.d/sysstat S01sysstat; \
   fi \
elif [ -d /etc/rc.d ]; then \
   install -m 755 sysstat /etc/rc.d/rc.sysstat; \
   if [ -x /sbin/chkconfig ]; then \
      cd /etc/rc.d && /sbin/chkconfig --add sysstat; \
   else \
      [ -d /etc/rc.d/rc2.d ] || mkdir -p /etc/rc.d/rc2.d; \
      [ -d /etc/rc.d/rc3.d ] || mkdir -p /etc/rc.d/rc3.d; \
      [ -d /etc/rc.d/rc5.d ] || mkdir -p /etc/rc.d/rc5.d; \
      cd /etc/rc.d/rc2.d && ln -s -f ../rc.sysstat S01sysstat; \
      cd /etc/rc.d/rc3.d && ln -s -f ../rc.sysstat S01sysstat; \
      cd /etc/rc.d/rc5.d && ln -s -f ../rc.sysstat S01sysstat; \
   fi \
fi

II. 测试版本

  1. 查看版本
[root@localhost ~]# sar -V
sysstat version 10.0.0
(C) Sebastien Godard (sysstat <at> orange.fr)
  1. 查看CPU统计信息 3次,每次间隔1s。

[root@localhost  ~]# sar 1 3
Linux 3.10.0-1160.25.1.el7.x86_64 (ecs-lwq-test)        12/04/2022      _x86_64_        (2 CPU)

06:40:43 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
06:40:44 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
06:40:45 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
06:40:46 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
Average:        all      0.00      0.00      0.17      0.00      0.00     99.83

Logo

更多推荐