Incorrect values on iostat command when using JSON output
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sysstat (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Bionic |
Invalid
|
Undecided
|
Miriam España Acebal | ||
Focal |
Fix Released
|
Low
|
Miriam España Acebal |
Bug Description
[SRU]
[Impact]
In iostat (Focal), when using output option JSON, the values for the number of megabytes written to the device per second (wMB/s) are wrong (they are expressed in blocks/s instead).
[Test Case]
Using the command "iostat <device> -dmx 1 -o JSON" in one terminal and the same command whithout "-o JSON" in another one, and you'll see that all the values match except wMB/s (<device> can be from lsblk output in case of doubt).
Results for Focal (VM):
Before (spoiler: 0.23 vs 483.45 wMB/s):
- Non JSON output: https:/
- JSON output: https:/
After (spoiler: 0.03 vs 0.03 wMB/s):
- Non JSON output: https:/
- JSON output: https:/
PPA with built package with fix for testing: https:/
[Where Problems Could Occur]
This patch is cherry picked from upstream, so the bug is corrected in following sysstat package versions, only affects iostat commad.
If the problem was not noticed by a Focal user could be led to strangeness if this output is used in custom scripts.
[Other Info]
Fixed upstream in version 12.3.1, commit id:404eee1417da
Commit description: iostat: Fix wrong unit used in JSON output
The values for the amount of data read/written or discarded were always
expressed in blocks/s in the JSON output generated by iostat. It should
take into account the unit (blocks, kB, MB) selected by the user.
Bug on upstream: https:/
[Original Report]
---
We are migrating our servers to Ubuntu Focal and we have noticed that our custom charts show unreal values for disk usage.
The issue only happens when you choose the JSON output flag. We have already open an issue on github and the maintainer confirmed the bug. https:/
I have checked that on version 12.3.4 it's solved, but Ubuntu Focal uses 12.2.0 and this version is affected by the issue.
This is the commit with the fix: https:/
These are the steps to reproduce the issue. We use the command "iostat /dev/sdb -dmx 1 -o JSON" in one terminal and the same command whithout "-o JSON" in another one, and you'll see that all the values match except wMB/s, I attach three examples below:
"disk": [
{"disk_device": "nvme0n1", "r/s": 0.00, "w/s": 31.00, "d/s": 0.00, "rMB/s": 0.00, "wMB/s": 248.00, "dMB/s": 0.00, "rrqm/s": 0.00, "wrqm/s": 0.00, "drqm/s": 0.00, "rrqm": 0.00, "wrqm": 0.00, "drqm": 0.00, "r_await": 0.00, "w_await": 1.87, "d_await": 0.00, "rareq-sz": 0.00, "wareq-sz": 4.00, "dareq-sz": 0.00, "aqu-sz": 0.00, "util": 0.80}
]
Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
nvme0n1 0,00 0,00 0,00 0,00 0,00 0,00 31,00 0,12 0,00 0,00 1,87 4,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,80
-------
"disk": [
{"disk_device": "sdc", "r/s": 0.00, "w/s": 2.00, "d/s": 0.00, "rMB/s": 0.00, "wMB/s": 24.00, "dMB/s": 0.00, "rrqm/s": 0.00, "wrqm/s": 1.00, "drqm/s": 0.00, "rrqm": 0.00, "wrqm": 33.33, "drqm": 0.00, "r_await": 0.00, "w_await": 2.00, "d_await": 0.00, "rareq-sz": 0.00, "wareq-sz": 6.00, "dareq-sz": 0.00, "aqu-sz": 0.00, "util": 0.40}
]
Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
sdc 0.00 0.00 0.00 0.00 0.00 0.00 2.00 0.01 1.00 33.33 2.00 6.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.40
-------
"disk": [
{"disk_device": "sdb", "r/s": 0.00, "w/s": 35.00, "d/s": 0.00, "rMB/s": 0.00, "wMB/s": 280.00, "dMB/s": 0.00, "rrqm/s": 0.00, "wrqm/s": 0.00, "drqm/s": 0.00, "rrqm": 0.00, "wrqm": 0.00, "drqm": 0.00, "r_await": 0.00, "w_await": 0.11, "d_await": 0.00, "rareq-sz": 0.00, "wareq-sz": 4.00, "dareq-sz": 0.00, "aqu-sz": 0.00, "util": 0.40}
]
Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
sdb 0.00 0.00 0.00 0.00 0.00 0.00 35.00 0.14 0.00 0.00 0.11 4.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.40
Related branches
- Christian Ehrhardt (community): Approve
- Bryce Harrington (community): Needs Fixing
-
Diff: 95 lines (+61/-1)4 files modifieddebian/changelog (+9/-0)
debian/control (+2/-1)
debian/patches/12-fix-wMB-json-output.patch (+49/-0)
debian/patches/series (+1/-0)
description: | updated |
no longer affects: | sysstat (Ubuntu Groovy) |
Changed in sysstat (Ubuntu): | |
importance: | Undecided → Low |
Changed in sysstat (Ubuntu Focal): | |
importance: | Undecided → Low |
Changed in sysstat (Ubuntu): | |
status: | New → Triaged |
Changed in sysstat (Ubuntu Focal): | |
status: | New → Triaged |
tags: | added: bitesize |
Changed in sysstat (Ubuntu Focal): | |
assignee: | nobody → Miriam España Acebal (mirespace) |
Changed in sysstat (Ubuntu Focal): | |
status: | Triaged → In Progress |
description: | updated |
description: | updated |
Changed in sysstat (Ubuntu Bionic): | |
assignee: | nobody → Miriam España Acebal (mirespace) |
I'm changing the main bug task to Fix Released as IIUC this is fixed in >= Groovy.
Still valid and in our queue for Focal, needs a SRU.