LoginSignup
0
1

More than 5 years have passed since last update.

sadf コマンド

Posted at

概要

sadf コマンドを利用することで、sar の結果を別フォーマットで取得できる。

手順

インストール

[vagrant@localhost ~]$ yum -y install sysstat

コマンド実行

[vagrant@localhost ~]$ sadf -T -j
{"sysstat": {
    "sysdata-version": 2.16,
    "hosts": [
        {
            "nodename": "localhost.localdomain",
            "sysname": "Linux",
            "release": "3.10.0-229.el7.x86_64",
            "machine": "x86_64",
            "number-of-cpus": 1,
            "file-date": "2019-02-27",
            "statistics": [
                {
                    "timestamp": {"date": "2019-02-27", "time": "14:30:01", "utc": 0, "interval": 599},
                    "cpu-load": [
                        {"cpu": "all", "user": 0.01, "nice": 0.00, "system": 0.03, "iowait": 0.01, "steal": 0.00, "idle": 99.96}
                    ]
                },
                {
                    "timestamp": {"date": "2019-02-27", "time": "14:40:01", "utc": 0, "interval": 599},
                    "cpu-load": [
                        {"cpu": "all", "user": 0.01, "nice": 0.00, "system": 0.04, "iowait": 0.00, "steal": 0.00, "idle": 99.96}
                    ]
                },
                {
                    "timestamp": {"date": "2019-02-27", "time": "14:50:01", "utc": 0, "interval": 599},
                    "cpu-load": [
                        {"cpu": "all", "user": 0.01, "nice": 0.00, "system": 0.03, "iowait": 0.00, "steal": 0.00, "idle": 99.96}
                    ]
                }
            ],
            "restarts": [
            ]
        }
    ]
}}

## jq と併用
[vagrant@localhost ~]$ sadf -T -j | jq -c
{"sysstat":{"sysdata-version":2.16,"hosts":[{"nodename":"localhost.localdomain","sysname":"Linux","release":"3.10.0-229.el7.x86_64","machine":"x86_64","number-of-cpus":1,"file-date":"2019-02-27","statistics":[{"timestamp":{"date":"2019-02-27","time":"14:30:01","utc":0,"interval":599},"cpu-load":[{"cpu":"all","user":0.01,"nice":0,"system":0.03,"iowait":0.01,"steal":0,"idle":99.96}]},{"timestamp":{"date":"2019-02-27","time":"14:40:01","utc":0,"interval":599},"cpu-load":[{"cpu":"all","user":0.01,"nice":0,"system":0.04,"iowait":0,"steal":0,"idle":99.96}]},{"timestamp":{"date":"2019-02-27","time":"14:50:01","utc":0,"interval":599},"cpu-load":[{"cpu":"all","user":0.01,"nice":0,"system":0.03,"iowait":0,"steal":0,"idle":99.96}]},{"timestamp":{"date":"2019-02-27","time":"15:00:01","utc":0,"interval":599},"cpu-load":[{"cpu":"all","user":0.44,"nice":0,"system":0.17,"iowait":0.02,"steal":0,"idle":99.36}]}],"restarts":[]}]}}

複数台のsar の結果を扱いやすい形で取得できて便利!

性能試験等で、複数台サーバのsar 結果をsummarize したりする際にとてもやくにたちそう。

0
1
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
0
1