LoginSignup
2
2

More than 3 years have passed since last update.

CentOSでsarコマンドを使えるようにする(sysstatをインストール)

Posted at

1. 環境

  • OS:CentOS Linux release 7.7.1908 (Core)
[root@CENTOS7 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[root@CENTOS7 ~]#

2. yum-utilsをインストール

sarコマンドには関係ありませんが、パッケージに含まれるファイル等を調べるrepoqueryコマンドを使用するため、yum-utilsをインストールします。
yum-utilsをインストールしなくても、sysstatをインストールすれば、sarコマンドを使用できます。

yum install -y yum-utils

実行結果
[root@CENTOS7 ~]# yum install -y yum-utils
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ yum-utils.noarch 0:1.1.31-52.el7 を インストール
--> 依存性の処理をしています: python-kitchen のパッケージ: yum-utils-1.1.31-52.el7.noarch
--> 依存性の処理をしています: libxml2-python のパッケージ: yum-utils-1.1.31-52.el7.noarch
--> トランザクションの確認を実行しています。
---> パッケージ libxml2-python.x86_64 0:2.9.1-6.el7_2.3 を インストール
---> パッケージ python-kitchen.noarch 0:1.1.1-5.el7 を インストール
--> 依存性の処理をしています: python-chardet のパッケージ: python-kitchen-1.1.1-5.el7.noarch
--> トランザクションの確認を実行しています。
---> パッケージ python-chardet.noarch 0:2.2.1-3.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
 Package               アーキテクチャー
                                     バージョン               リポジトリー
                                                                           容量
================================================================================
インストール中:
 yum-utils             noarch        1.1.31-52.el7            base        121 k
依存性関連でのインストールをします:
 libxml2-python        x86_64        2.9.1-6.el7_2.3          base        247 k
 python-chardet        noarch        2.2.1-3.el7              base        227 k
 python-kitchen        noarch        1.1.1-5.el7              base        267 k

トランザクションの要約
================================================================================
インストール  1 パッケージ (+3 個の依存関係のパッケージ)

総ダウンロード容量: 862 k
インストール容量: 4.3 M
Downloading packages:
(1/4): python-chardet-2.2.1-3.el7.noarch.rpm               | 227 kB   00:01
(2/4): yum-utils-1.1.31-52.el7.noarch.rpm                  | 121 kB   00:01
(3/4): python-kitchen-1.1.1-5.el7.noarch.rpm               | 267 kB   00:02
(4/4): libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm           | 247 kB   00:02
--------------------------------------------------------------------------------
合計                                               326 kB/s | 862 kB  00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : python-chardet-2.2.1-3.el7.noarch               1/4
  インストール中          : python-kitchen-1.1.1-5.el7.noarch               2/4
  インストール中          : libxml2-python-2.9.1-6.el7_2.3.x86_64           3/4
  インストール中          : yum-utils-1.1.31-52.el7.noarch                  4/4
  検証中                  : python-kitchen-1.1.1-5.el7.noarch               1/4
  検証中                  : yum-utils-1.1.31-52.el7.noarch                  2/4
  検証中                  : libxml2-python-2.9.1-6.el7_2.3.x86_64           3/4
  検証中                  : python-chardet-2.2.1-3.el7.noarch               4/4

インストール:
  yum-utils.noarch 0:1.1.31-52.el7

依存性関連をインストールしました:
  libxml2-python.x86_64 0:2.9.1-6.el7_2.3  python-chardet.noarch 0:2.2.1-3.el7
  python-kitchen.noarch 0:1.1.1-5.el7

完了しました!
[root@CENTOS7 ~]#

3. sarコマンドを提供しているパッケージを検索する

以下のコマンドでsarコマンドを提供しているパッケージを検索します。
yum provides sar

実行結果
[root@CENTOS7 ~]# yum provides sar
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
sysstat-10.1.5-18.el7.x86_64 : Collection of performance monitoring tools for
                             : Linux
リポジトリー        : base
一致          :
ファイル名    : /usr/bin/sar



[root@CENTOS7 ~]#

sysstat-10.1.5-18.el7.x86_64sarコマンドが存在することがわかりました。

4. sysstatパッケージをインストール

以下のコマンドでsysstatパッケージをインストールします。

yum install -y sysstat

実行結果
[root@CENTOS7 ~]# yum install -y sysstat
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ sysstat.x86_64 0:10.1.5-18.el7 を インストール
--> 依存性の処理をしています: libsensors.so.4()(64bit) のパッケージ: sysstat-10.1.5-18.el7.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 を イン ストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
 Package            アーキテクチャー
                              バージョン                          リポジトリー
                                                                           容量
================================================================================
インストール中:
 sysstat            x86_64    10.1.5-18.el7                       base    315 k
依存性関連でのインストールをします:
 lm_sensors-libs    x86_64    3.4.0-8.20160601gitf9185e5.el7      base     42 k

トランザクションの要約
================================================================================
インストール  1 パッケージ (+1 個の依存関係のパッケージ)

総ダウンロード容量: 357 k
インストール容量: 1.2 M
Downloading packages:
(1/2): sysstat-10.1.5-18.el7.x86_64.rpm                    | 315 kB   00:00
(2/2): lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_ |  42 kB   00:01
--------------------------------------------------------------------------------
合計                                               254 kB/s | 357 kB  00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el   1/2
  インストール中          : sysstat-10.1.5-18.el7.x86_64                    2/2
  検証中                  : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el   1/2
  検証中                  : sysstat-10.1.5-18.el7.x86_64                    2/2

インストール:
  sysstat.x86_64 0:10.1.5-18.el7

依存性関連をインストールしました:
  lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7

完了しました!
[root@CENTOS7 ~]#

5. sysstatパッケージに含まれるファイルを確認

以下のコマンドでsysstatパッケージに含まれるファイルを確認します。
repoqueryコマンドを使用するにはyum-utilsパッケージのインストールが必要です。)

repoquery --list sysstat

実行結果
[root@CENTOS7 ~]# repoquery sysstat
sysstat-0:10.1.5-18.el7.x86_64
[root@CENTOS7 ~]# repoquery --list sysstat
/etc/cron.d/sysstat
/etc/sysconfig/sysstat
/etc/sysconfig/sysstat.ioconf
/usr/bin/cifsiostat
/usr/bin/iostat
/usr/bin/mpstat
/usr/bin/nfsiostat-sysstat
/usr/bin/pidstat
/usr/bin/sadf
/usr/bin/sar
/usr/bin/tapestat
/usr/lib/systemd/system/sysstat.service
/usr/lib64/sa
/usr/lib64/sa/sa1
/usr/lib64/sa/sa2
/usr/lib64/sa/sadc
/usr/share/doc/sysstat-10.1.5
/usr/share/doc/sysstat-10.1.5/CHANGES
/usr/share/doc/sysstat-10.1.5/COPYING
/usr/share/doc/sysstat-10.1.5/CREDITS
/usr/share/doc/sysstat-10.1.5/FAQ
/usr/share/doc/sysstat-10.1.5/README
/usr/share/doc/sysstat-10.1.5/sysstat-10.1.5.lsm
/usr/share/locale/af/LC_MESSAGES/sysstat.mo
/usr/share/locale/cs/LC_MESSAGES/sysstat.mo
/usr/share/locale/da/LC_MESSAGES/sysstat.mo
/usr/share/locale/de/LC_MESSAGES/sysstat.mo
/usr/share/locale/eo/LC_MESSAGES/sysstat.mo
/usr/share/locale/es/LC_MESSAGES/sysstat.mo
/usr/share/locale/eu/LC_MESSAGES/sysstat.mo
/usr/share/locale/fi/LC_MESSAGES/sysstat.mo
/usr/share/locale/fr/LC_MESSAGES/sysstat.mo
/usr/share/locale/hr/LC_MESSAGES/sysstat.mo
/usr/share/locale/id/LC_MESSAGES/sysstat.mo
/usr/share/locale/it/LC_MESSAGES/sysstat.mo
/usr/share/locale/ja/LC_MESSAGES/sysstat.mo
/usr/share/locale/ky/LC_MESSAGES/sysstat.mo
/usr/share/locale/lv/LC_MESSAGES/sysstat.mo
/usr/share/locale/mt/LC_MESSAGES/sysstat.mo
/usr/share/locale/nb/LC_MESSAGES/sysstat.mo
/usr/share/locale/nl/LC_MESSAGES/sysstat.mo
/usr/share/locale/nn/LC_MESSAGES/sysstat.mo
/usr/share/locale/pl/LC_MESSAGES/sysstat.mo
/usr/share/locale/pt/LC_MESSAGES/sysstat.mo
/usr/share/locale/pt_BR/LC_MESSAGES/sysstat.mo
/usr/share/locale/ro/LC_MESSAGES/sysstat.mo
/usr/share/locale/ru/LC_MESSAGES/sysstat.mo
/usr/share/locale/sk/LC_MESSAGES/sysstat.mo
/usr/share/locale/sr/LC_MESSAGES/sysstat.mo
/usr/share/locale/sv/LC_MESSAGES/sysstat.mo
/usr/share/locale/uk/LC_MESSAGES/sysstat.mo
/usr/share/locale/vi/LC_MESSAGES/sysstat.mo
/usr/share/locale/zh_CN/LC_MESSAGES/sysstat.mo
/usr/share/locale/zh_TW/LC_MESSAGES/sysstat.mo
/usr/share/man/man1/cifsiostat.1.gz
/usr/share/man/man1/iostat.1.gz
/usr/share/man/man1/mpstat.1.gz
/usr/share/man/man1/nfsiostat-sysstat.1.gz
/usr/share/man/man1/pidstat.1.gz
/usr/share/man/man1/sadf.1.gz
/usr/share/man/man1/sar.1.gz
/usr/share/man/man1/tapestat.1.gz
/usr/share/man/man5/sysstat.5.gz
/usr/share/man/man8/sa1.8.gz
/usr/share/man/man8/sa2.8.gz
/usr/share/man/man8/sadc.8.gz
/var/log/sa
[root@CENTOS7 ~]#

6. sysstatパッケージに含まれるファイルの中からコマンドのみを確認

以下のコマンドでsysstatパッケージに含まれるファイルの中からコマンドのみを確認します。
repoqueryコマンドを使用するにはyum-utilsパッケージのインストールが必要です。)

repoquery --list sysstat | grep bin

実行結果
[root@CENTOS7 ~]# repoquery --list sysstat | grep bin
/usr/bin/cifsiostat
/usr/bin/iostat
/usr/bin/mpstat
/usr/bin/nfsiostat-sysstat
/usr/bin/pidstat
/usr/bin/sadf
/usr/bin/sar
/usr/bin/tapestat
[root@CENTOS7 ~]#

sarコマンドの他にiostat等のコマンドも存在することがわかります。


以上

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2