iostat-tool


Nameiostat-tool JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/t2y/iostat-tool
Summaryparse and visualize iostat output
upload_time2024-01-13 04:39:58
maintainer
docs_urlNone
authorTetsuya Morimoto
requires_python
licenseApache License 2.0
keywords iostat
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # iostat-tool

parse and visualize iostat output

## Requirements

* [Matplotlib](https://matplotlib.org/)
* Support output of iostat for Linux only
  * `iostat` command needs `-t` argument to get timestamp, and `-ymxt 1` arguments are recommended
```bash
$ man iostat
  -t  Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below).
```

## How to install

### for user

```bash
$ pip install iostat-tool
```

### for developer

Create venv to install `iostat-tool`.

```bash
$ mkdir venvs
$ python3 -m venv venvs/venv
$ source venvs/venv/bin/activate
(venv) $
```

Install `iostat-tool` package from the repository.

```bash
(venv) $ git clone https://github.com/t2y/iostat-tool.git
(venv) $ cd iostat-tool
(venv) $ python setup.py develop
```

### Base CLI options

Confirm `iostat-cli` works as below.

```bash
(venv) $ iostat-cli --help
usage: iostat-cli [-h] [--backend BACKEND] [--data DATA]
                  [--fig-output FIGOUTPUT] [--fig-size FIGSIZE]
                  [--output OUTPUT] [--disks DISKS [DISKS ...]]
                  [--since SINCE] [--until UNTIL] [-v] [--version]
                  {csv,monitor,plot} ...

positional arguments:
  {csv,monitor,plot}

optional arguments:
  -h, --help            show this help message and exit
  --backend BACKEND     set backend for matplotlib, use TkAgg to monitor in
                        the foreground
  --data DATA           set path to iostat output file
  --fig-output FIGOUTPUT
                        set path to save graph
  --fig-size FIGSIZE    set figure size
  --output OUTPUT       set path to save output of iostat
  --disks DISKS [DISKS ...]
                        set disk name in iostat
  --since SINCE         set since datetime, format: yyyymmddHHMISS
  --until UNTIL         set until datetime, format: yyyymmddHHMISS
  -v, --verbose         set verbose mode
  --version             show program version
```

### Sub Commands

#### csv

Create csv/tsv file from output of iostat.

```bash
(venv) $ iostat-cli csv --help
usage: iostat-cli csv [-h] [--dialect {excel,excel-tab,unix}]
                      [--separator {comma,tab}]

optional arguments:
  -h, --help            show this help message and exit
  --dialect {excel,excel-tab,unix}
                        set dialect for csv writer, default is excel
  --separator {comma,tab}
                        set separator, default is comma
```

#### plot

Create image file rendered by matplotlib from output of iostat.

```bash
(venv) $ iostat-cli plot --help
usage: iostat-cli plot [-h] [--plot-type {plotter,scatter}]
                       [--subplots {io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} [{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} ...]]
                       [--vlines VLINES [VLINES ...]]

optional arguments:
  -h, --help            show this help message and exit
  --plot-type {plotter,scatter}
                        set plot type ("plotter" by default)
  --subplots {io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} [{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} ...]
                        set subplots to show
  --vlines VLINES [VLINES ...]
                        set vertical line, format: yyyymmddHHMISS
  --x-datetime-format X_DATETIME_FORMAT
                        set datetime format for devices x-axis
  --title TITLE         set title for graph
  --without-cpu         don't plot CPU data
  --cpu-only            plot only CPU data
```

#### monitor

Monitor and logging output of `iostat` command.

```bash
(venv) $ iostat-cli monitor --help
usage: iostat-cli monitor [-h] [--iostat-args IOSTAT_ARGS]
                          [--max-queue-size MAX_QUEUE_SIZE]

optional arguments:
  -h, --help            show this help message and exit
  --iostat-args IOSTAT_ARGS
                        set arguments for iostat
  --max-queue-size MAX_QUEUE_SIZE
                        set queue size to read iostat output
```

## How to use

This is sample image rendered by matplotlib.

![](https://github.com/t2y/iostat-tool/raw/master/tests/fixtures/sample-iostat.png)


### there is already an iostat.ouput as data file

#### plot

* show all subplots of /dev/sda and cpu average

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png plot
(venv) $ file my-iostat.png
my-iostat.png: PNG image data, 1800 x 1400, 8-bit/color RGBA, non-interlaced
```

* show any subplots of /dev/sda and cpu average
  * filter `io_rqm` and `iops` with `--subplots`

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \
  plot --subplots io_rqm iops
```

* show any range of date time
  * filter since 2018-06-13 14:11:00 with `--since`
  * filter until 2018-06-13 14:11:30 with `--until`

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \
  --since 20180613141100 --until 20180613141130 plot --subplots await svctm
```

* show vertical lines into graph
  * 2018-06-13 14:11:10 and 2018-06-13 14:11:20 with `--vlines`

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \
  --since 20180613141100 --until 20180613141130 plot --subplots await svctm --vlines 20180613141110 20180613141120
```

* show only CPU-related data

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \
  plot --cpu-only
```

* show only one subplot, without CPU information

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \
  plot --subplots await --without-cpu
```

* generate graph with custom title

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \
  plot --title 'my custom test'
```

#### csv

* output 2 csv files (iostat_cpu.csv and iostat_devices.csv)

```bash
(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --output iostat.csv csv
(venv) $ ls iostat_*.csv
iostat_cpu.csv		iostat_devices.csv
(venv) $ head -n 3 iostat_*.csv
==> iostat_cpu.csv <==
datetime,%user,%nice,%system,%iowait,%steal,%idle
2018-06-13 14:10:50,0.47,0.0,0.24,0.18,0.0,99.11
2018-06-13 14:10:51,3.07,0.0,0.66,0.09,0.0,96.18

==> iostat_devices.csv <==
datetime,device,rrqm/s,wrqm/s,r/s,w/s,rMB/s,wMB/s,avgrq-sz,avgqu-sz,await,r_await,w_await,svctm,%util
2018-06-13 14:10:50,sdd,0.07,45.88,1.57,0.59,0.08,0.18,246.55,0.26,121.04,1.28,436.94,2.07,0.45
2018-06-13 14:10:50,sdh,0.07,45.78,1.59,0.6,0.08,0.18,245.64,0.22,101.97,1.17,367.51,1.89,0.41
```

### run iostat and logging the output

* monitor iostat command running
  * almost the same as `iostat -yxmt 1 | tee my-iostat.log`

```bash
(venv) $ iostat-cli --output my-iostat.log --fig-output my-scatter.png monitor --iostat-args "-yxmt 1"
...
06/13/2018 10:11:07 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.94    0.00    0.03    0.00    0.00   99.03

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00

06/18/2018 10:11:08 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.16    0.00    0.06    0.00    0.00   99.78
...

(Ctrl + C) # stop to run iostat
```

```bash
(venv) $ file my-iostat.log my-scatter.png
my-iostat.log:  ASCII text
my-scatter.png: PNG image data, 1800 x 1300, 8-bit/color RGBA, non-interlaced
```

NOTE: Saving `my-scatter.png` is experimental feature when io-stat terminated, so it might fails to save the figure.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/t2y/iostat-tool",
    "name": "iostat-tool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "iostat",
    "author": "Tetsuya Morimoto",
    "author_email": "tetsuya.morimoto@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c0/f4/49ad4df5ea3d2860ff68dbd5f497d2a72654c3f67dacf8969492e31666c1/iostat-tool-0.3.1.tar.gz",
    "platform": "unix",
    "description": "# iostat-tool\n\nparse and visualize iostat output\n\n## Requirements\n\n* [Matplotlib](https://matplotlib.org/)\n* Support output of iostat for Linux only\n  * `iostat` command needs `-t` argument to get timestamp, and `-ymxt 1` arguments are recommended\n```bash\n$ man iostat\n  -t  Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below).\n```\n\n## How to install\n\n### for user\n\n```bash\n$ pip install iostat-tool\n```\n\n### for developer\n\nCreate venv to install `iostat-tool`.\n\n```bash\n$ mkdir venvs\n$ python3 -m venv venvs/venv\n$ source venvs/venv/bin/activate\n(venv) $\n```\n\nInstall `iostat-tool` package from the repository.\n\n```bash\n(venv) $ git clone https://github.com/t2y/iostat-tool.git\n(venv) $ cd iostat-tool\n(venv) $ python setup.py develop\n```\n\n### Base CLI options\n\nConfirm `iostat-cli` works as below.\n\n```bash\n(venv) $ iostat-cli --help\nusage: iostat-cli [-h] [--backend BACKEND] [--data DATA]\n                  [--fig-output FIGOUTPUT] [--fig-size FIGSIZE]\n                  [--output OUTPUT] [--disks DISKS [DISKS ...]]\n                  [--since SINCE] [--until UNTIL] [-v] [--version]\n                  {csv,monitor,plot} ...\n\npositional arguments:\n  {csv,monitor,plot}\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --backend BACKEND     set backend for matplotlib, use TkAgg to monitor in\n                        the foreground\n  --data DATA           set path to iostat output file\n  --fig-output FIGOUTPUT\n                        set path to save graph\n  --fig-size FIGSIZE    set figure size\n  --output OUTPUT       set path to save output of iostat\n  --disks DISKS [DISKS ...]\n                        set disk name in iostat\n  --since SINCE         set since datetime, format: yyyymmddHHMISS\n  --until UNTIL         set until datetime, format: yyyymmddHHMISS\n  -v, --verbose         set verbose mode\n  --version             show program version\n```\n\n### Sub Commands\n\n#### csv\n\nCreate csv/tsv file from output of iostat.\n\n```bash\n(venv) $ iostat-cli csv --help\nusage: iostat-cli csv [-h] [--dialect {excel,excel-tab,unix}]\n                      [--separator {comma,tab}]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --dialect {excel,excel-tab,unix}\n                        set dialect for csv writer, default is excel\n  --separator {comma,tab}\n                        set separator, default is comma\n```\n\n#### plot\n\nCreate image file rendered by matplotlib from output of iostat.\n\n```bash\n(venv) $ iostat-cli plot --help\nusage: iostat-cli plot [-h] [--plot-type {plotter,scatter}]\n                       [--subplots {io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} [{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} ...]]\n                       [--vlines VLINES [VLINES ...]]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --plot-type {plotter,scatter}\n                        set plot type (\"plotter\" by default)\n  --subplots {io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} [{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm} ...]\n                        set subplots to show\n  --vlines VLINES [VLINES ...]\n                        set vertical line, format: yyyymmddHHMISS\n  --x-datetime-format X_DATETIME_FORMAT\n                        set datetime format for devices x-axis\n  --title TITLE         set title for graph\n  --without-cpu         don't plot CPU data\n  --cpu-only            plot only CPU data\n```\n\n#### monitor\n\nMonitor and logging output of `iostat` command.\n\n```bash\n(venv) $ iostat-cli monitor --help\nusage: iostat-cli monitor [-h] [--iostat-args IOSTAT_ARGS]\n                          [--max-queue-size MAX_QUEUE_SIZE]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --iostat-args IOSTAT_ARGS\n                        set arguments for iostat\n  --max-queue-size MAX_QUEUE_SIZE\n                        set queue size to read iostat output\n```\n\n## How to use\n\nThis is sample image rendered by matplotlib.\n\n![](https://github.com/t2y/iostat-tool/raw/master/tests/fixtures/sample-iostat.png)\n\n\n### there is already an iostat.ouput as data file\n\n#### plot\n\n* show all subplots of /dev/sda and cpu average\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png plot\n(venv) $ file my-iostat.png\nmy-iostat.png: PNG image data, 1800 x 1400, 8-bit/color RGBA, non-interlaced\n```\n\n* show any subplots of /dev/sda and cpu average\n  * filter `io_rqm` and `iops` with `--subplots`\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \\\n  plot --subplots io_rqm iops\n```\n\n* show any range of date time\n  * filter since 2018-06-13 14:11:00 with `--since`\n  * filter until 2018-06-13 14:11:30 with `--until`\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \\\n  --since 20180613141100 --until 20180613141130 plot --subplots await svctm\n```\n\n* show vertical lines into graph\n  * 2018-06-13 14:11:10 and 2018-06-13 14:11:20 with `--vlines`\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \\\n  --since 20180613141100 --until 20180613141130 plot --subplots await svctm --vlines 20180613141110 20180613141120\n```\n\n* show only CPU-related data\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \\\n  plot --cpu-only\n```\n\n* show only one subplot, without CPU information\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \\\n  plot --subplots await --without-cpu\n```\n\n* generate graph with custom title\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --disk sda --fig-output my-iostat.png \\\n  plot --title 'my custom test'\n```\n\n#### csv\n\n* output 2 csv files (iostat_cpu.csv and iostat_devices.csv)\n\n```bash\n(venv) $ iostat-cli --data tests/fixtures/sample_iostat.output --output iostat.csv csv\n(venv) $ ls iostat_*.csv\niostat_cpu.csv\t\tiostat_devices.csv\n(venv) $ head -n 3 iostat_*.csv\n==> iostat_cpu.csv <==\ndatetime,%user,%nice,%system,%iowait,%steal,%idle\n2018-06-13 14:10:50,0.47,0.0,0.24,0.18,0.0,99.11\n2018-06-13 14:10:51,3.07,0.0,0.66,0.09,0.0,96.18\n\n==> iostat_devices.csv <==\ndatetime,device,rrqm/s,wrqm/s,r/s,w/s,rMB/s,wMB/s,avgrq-sz,avgqu-sz,await,r_await,w_await,svctm,%util\n2018-06-13 14:10:50,sdd,0.07,45.88,1.57,0.59,0.08,0.18,246.55,0.26,121.04,1.28,436.94,2.07,0.45\n2018-06-13 14:10:50,sdh,0.07,45.78,1.59,0.6,0.08,0.18,245.64,0.22,101.97,1.17,367.51,1.89,0.41\n```\n\n### run iostat and logging the output\n\n* monitor iostat command running\n  * almost the same as `iostat -yxmt 1 | tee my-iostat.log`\n\n```bash\n(venv) $ iostat-cli --output my-iostat.log --fig-output my-scatter.png monitor --iostat-args \"-yxmt 1\"\n...\n06/13/2018 10:11:07 PM\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           0.94    0.00    0.03    0.00    0.00   99.03\n\nDevice:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util\nsda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00\n\n06/18/2018 10:11:08 PM\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           0.16    0.00    0.06    0.00    0.00   99.78\n...\n\n(Ctrl + C) # stop to run iostat\n```\n\n```bash\n(venv) $ file my-iostat.log my-scatter.png\nmy-iostat.log:  ASCII text\nmy-scatter.png: PNG image data, 1800 x 1300, 8-bit/color RGBA, non-interlaced\n```\n\nNOTE: Saving `my-scatter.png` is experimental feature when io-stat terminated, so it might fails to save the figure.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "parse and visualize iostat output",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/t2y/iostat-tool"
    },
    "split_keywords": [
        "iostat"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0f449ad4df5ea3d2860ff68dbd5f497d2a72654c3f67dacf8969492e31666c1",
                "md5": "ef0ff6747a4a55749ff8cd27738a034e",
                "sha256": "6168387d05ab8c20f17a9ed9994052e83481a24c8c819d447813dfba4a96b6ed"
            },
            "downloads": -1,
            "filename": "iostat-tool-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ef0ff6747a4a55749ff8cd27738a034e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 600286,
            "upload_time": "2024-01-13T04:39:58",
            "upload_time_iso_8601": "2024-01-13T04:39:58.209594Z",
            "url": "https://files.pythonhosted.org/packages/c0/f4/49ad4df5ea3d2860ff68dbd5f497d2a72654c3f67dacf8969492e31666c1/iostat-tool-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-13 04:39:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "t2y",
    "github_project": "iostat-tool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "iostat-tool"
}
        
Elapsed time: 3.20835s