diff --git a/CHANGELOG b/CHANGELOG index c7153b2bb..88a20aecb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,11 @@ jc changelog 20240226 v1.25.2 -- Enhance `free` parser to add human readable output support -- Enhance `df` parser to include `_bytes` fields for `size`, `used`, and `available`. - This provides normalized output when human readable `df` output is used +- Enhance `df` parser to add human readable output support. Note: the `size` + field has been changed to an integer and all size values have been normalized + to bytes. +- Enhance `free` parser to add human readable output support. All size values + have been normalizd to bytes. - Fix `iwconfig` parser to handle more special characters in the SSID name - Documentation updates diff --git a/docs/parsers/df.md b/docs/parsers/df.md index 0c5f2ae16..06f17325d 100644 --- a/docs/parsers/df.md +++ b/docs/parsers/df.md @@ -5,6 +5,8 @@ jc - JSON Convert `df` command output parser +Values are normalized to bytes when using `df -h`. + Usage (cli): $ df | jc --df @@ -23,14 +25,11 @@ Schema: [ { "filesystem": string, - "size": string, - "size_bytes": integer, # [0] + "size": integer, "1k_blocks": integer, "512_blocks": integer, "used": integer, - "used_bytes": integer, # [0] "available": integer, - "available_bytes": integer, # [0] "capacity_percent": integer, "ifree": integer, "iused": integer, @@ -40,9 +39,6 @@ Schema: } ] - [0] It is recommended to use these fields as they are normalized to bytes - and will work even with human-readable `df` output. - Examples: $ df | jc --df -p @@ -51,9 +47,7 @@ Examples: "filesystem": "devtmpfs", "1k_blocks": 1918820, "used": 0, - "used_bytes": 0, "available": 1918820, - "available_bytes": 1918820, "use_percent": 0, "mounted_on": "/dev" }, @@ -61,9 +55,7 @@ Examples: "filesystem": "tmpfs", "1k_blocks": 1930668, "used": 0, - "used_bytes": 0, "available": 1930668, - "available_bytes": 1930668, "use_percent": 0, "mounted_on": "/dev/shm" }, @@ -71,9 +63,7 @@ Examples: "filesystem": "tmpfs", "1k_blocks": 1930668, "used": 11800, - "used_bytes": 11800, "available": 1918868, - "available_bytes": 1918868, "use_percent": 1, "mounted_on": "/run" }, @@ -134,4 +124,4 @@ Compatibility: linux, darwin, freebsd Source: [`jc/parsers/df.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/df.py) -Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com) +Version 2.0 by Kelly Brazil (kellyjonbrazil@gmail.com) diff --git a/jc/parsers/df.py b/jc/parsers/df.py index b108b310f..ca8ce3350 100644 --- a/jc/parsers/df.py +++ b/jc/parsers/df.py @@ -1,5 +1,7 @@ """jc - JSON Convert `df` command output parser +Values are normalized to bytes when using `df -h`. + Usage (cli): $ df | jc --df @@ -18,14 +20,11 @@ [ { "filesystem": string, - "size": string, - "size_bytes": integer, # [0] + "size": integer, "1k_blocks": integer, "512_blocks": integer, "used": integer, - "used_bytes": integer, # [0] "available": integer, - "available_bytes": integer, # [0] "capacity_percent": integer, "ifree": integer, "iused": integer, @@ -35,9 +34,6 @@ } ] - [0] It is recommended to use these fields as they are normalized to bytes - and will work even with human-readable `df` output. - Examples: $ df | jc --df -p @@ -46,9 +42,7 @@ "filesystem": "devtmpfs", "1k_blocks": 1918820, "used": 0, - "used_bytes": 0, "available": 1918820, - "available_bytes": 1918820, "use_percent": 0, "mounted_on": "/dev" }, @@ -56,9 +50,7 @@ "filesystem": "tmpfs", "1k_blocks": 1930668, "used": 0, - "used_bytes": 0, "available": 1930668, - "available_bytes": 1930668, "use_percent": 0, "mounted_on": "/dev/shm" }, @@ -66,9 +58,7 @@ "filesystem": "tmpfs", "1k_blocks": 1930668, "used": 11800, - "used_bytes": 11800, "available": 1918868, - "available_bytes": 1918868, "use_percent": 1, "mounted_on": "/run" }, @@ -111,7 +101,7 @@ class info(): """Provides parser metadata (version, author, etc.)""" - version = '1.12' + version = '2.0' description = '`df` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -135,8 +125,8 @@ def _process(proc_data): List of Dictionaries. Structured data to conform to the schema: """ - int_list = {'used', 'available', 'use_percent', 'capacity_percent', 'ifree', - 'iused', 'iused_percent'} + int_list = {'use_percent', 'capacity_percent', 'ifree', 'iused', 'iused_percent'} + size_list = {'size', 'used', 'available'} for entry in proc_data: if 'avail' in entry: @@ -166,15 +156,10 @@ def _process(proc_data): if 'iused_percent' in entry: entry['iused_percent'] = entry['iused_percent'].rstrip('%') - # parse the size, used, and available fields and create a 'x_bytes' fields - if 'size' in entry: - entry['size_bytes'] = jc.utils.convert_size_to_int(entry['size']) - - if 'used' in entry: - entry['used_bytes'] = jc.utils.convert_size_to_int(entry['used']) - - if 'available' in entry: - entry['available_bytes'] = jc.utils.convert_size_to_int(entry['available']) + # parse the size, used, and available fields to bytes + for key in entry: + if key in size_list: + entry[key] = jc.utils.convert_size_to_int(entry[key]) # convert integers for key in entry: diff --git a/tests/fixtures/centos-7.7/df-h.json b/tests/fixtures/centos-7.7/df-h.json index 145f2d0ea..54d0d0541 100644 --- a/tests/fixtures/centos-7.7/df-h.json +++ b/tests/fixtures/centos-7.7/df-h.json @@ -1 +1 @@ -[{"filesystem":"devtmpfs","size":"1.9G","used":0,"mounted_on":"/dev","available":1,"use_percent":0,"size_bytes":1900000000,"used_bytes":0,"available_bytes":1900000000},{"filesystem":"tmpfs","size":"1.9G","used":0,"mounted_on":"/dev/shm","available":1,"use_percent":0,"size_bytes":1900000000,"used_bytes":0,"available_bytes":1900000000},{"filesystem":"tmpfs","size":"1.9G","used":12,"mounted_on":"/run","available":1,"use_percent":1,"size_bytes":1900000000,"used_bytes":12000000,"available_bytes":1900000000},{"filesystem":"tmpfs","size":"1.9G","used":0,"mounted_on":"/sys/fs/cgroup","available":1,"use_percent":0,"size_bytes":1900000000,"used_bytes":0,"available_bytes":1900000000},{"filesystem":"/dev/mapper/centos-root","size":"17G","used":1,"mounted_on":"/","available":16,"use_percent":11,"size_bytes":17000000000,"used_bytes":1800000000,"available_bytes":16000000000},{"filesystem":"/dev/sda1","size":"1014M","used":233,"mounted_on":"/boot","available":782,"use_percent":23,"size_bytes":1014000000,"used_bytes":233000000,"available_bytes":782000000},{"filesystem":"tmpfs","size":"378M","used":0,"mounted_on":"/run/user/1000","available":378,"use_percent":0,"size_bytes":378000000,"used_bytes":0,"available_bytes":378000000}] +[{"filesystem":"devtmpfs","size":1900000000,"used":0,"mounted_on":"/dev","available":1900000000,"use_percent":0},{"filesystem":"tmpfs","size":1900000000,"used":0,"mounted_on":"/dev/shm","available":1900000000,"use_percent":0},{"filesystem":"tmpfs","size":1900000000,"used":12000000,"mounted_on":"/run","available":1900000000,"use_percent":1},{"filesystem":"tmpfs","size":1900000000,"used":0,"mounted_on":"/sys/fs/cgroup","available":1900000000,"use_percent":0},{"filesystem":"/dev/mapper/centos-root","size":17000000000,"used":1800000000,"mounted_on":"/","available":16000000000,"use_percent":11},{"filesystem":"/dev/sda1","size":1014000000,"used":233000000,"mounted_on":"/boot","available":782000000,"use_percent":23},{"filesystem":"tmpfs","size":378000000,"used":0,"mounted_on":"/run/user/1000","available":378000000,"use_percent":0}] diff --git a/tests/fixtures/centos-7.7/df.json b/tests/fixtures/centos-7.7/df.json index e228a6192..f19884117 100644 --- a/tests/fixtures/centos-7.7/df.json +++ b/tests/fixtures/centos-7.7/df.json @@ -1 +1 @@ -[{"filesystem":"devtmpfs","1k_blocks":1918816,"used":0,"available":1918816,"mounted_on":"/dev","use_percent":0,"used_bytes":0,"available_bytes":1918816},{"filesystem":"tmpfs","1k_blocks":1930664,"used":0,"available":1930664,"mounted_on":"/dev/shm","use_percent":0,"used_bytes":0,"available_bytes":1930664},{"filesystem":"tmpfs","1k_blocks":1930664,"used":11832,"available":1918832,"mounted_on":"/run","use_percent":1,"used_bytes":11832,"available_bytes":1918832},{"filesystem":"tmpfs","1k_blocks":1930664,"used":0,"available":1930664,"mounted_on":"/sys/fs/cgroup","use_percent":0,"used_bytes":0,"available_bytes":1930664},{"filesystem":"/dev/mapper/centos-root","1k_blocks":17811456,"used":1805580,"available":16005876,"mounted_on":"/","use_percent":11,"used_bytes":1805580,"available_bytes":16005876},{"filesystem":"/dev/sda1","1k_blocks":1038336,"used":237600,"available":800736,"mounted_on":"/boot","use_percent":23,"used_bytes":237600,"available_bytes":800736},{"filesystem":"tmpfs","1k_blocks":386136,"used":0,"available":386136,"mounted_on":"/run/user/1000","use_percent":0,"used_bytes":0,"available_bytes":386136}] +[{"filesystem":"devtmpfs","1k_blocks":1918816,"used":0,"available":1918816,"mounted_on":"/dev","use_percent":0},{"filesystem":"tmpfs","1k_blocks":1930664,"used":0,"available":1930664,"mounted_on":"/dev/shm","use_percent":0},{"filesystem":"tmpfs","1k_blocks":1930664,"used":11832,"available":1918832,"mounted_on":"/run","use_percent":1},{"filesystem":"tmpfs","1k_blocks":1930664,"used":0,"available":1930664,"mounted_on":"/sys/fs/cgroup","use_percent":0},{"filesystem":"/dev/mapper/centos-root","1k_blocks":17811456,"used":1805580,"available":16005876,"mounted_on":"/","use_percent":11},{"filesystem":"/dev/sda1","1k_blocks":1038336,"used":237600,"available":800736,"mounted_on":"/boot","use_percent":23},{"filesystem":"tmpfs","1k_blocks":386136,"used":0,"available":386136,"mounted_on":"/run/user/1000","use_percent":0}] diff --git a/tests/fixtures/generic/df-long-filesystem.json b/tests/fixtures/generic/df-long-filesystem.json index d22625cf0..dfe51152d 100644 --- a/tests/fixtures/generic/df-long-filesystem.json +++ b/tests/fixtures/generic/df-long-filesystem.json @@ -1 +1 @@ -[{"filesystem":"/dev/mapper/VolGroup00-LogVol00","type":"ext3","1024_blocks":6030784,"used":1147932,"available":4571556,"mounted_on":"/","capacity_percent":21,"used_bytes":1147932,"available_bytes":4571556},{"filesystem":"proc","type":"proc","1024_blocks":0,"used":0,"available":0,"mounted_on":"/proc","capacity_percent":null,"used_bytes":0,"available_bytes":0},{"filesystem":"sysfs","type":"sysfs","1024_blocks":0,"used":0,"available":0,"mounted_on":"/sys","capacity_percent":null,"used_bytes":0,"available_bytes":0}] +[{"filesystem":"/dev/mapper/VolGroup00-LogVol00","type":"ext3","1024_blocks":6030784,"used":1147932,"available":4571556,"mounted_on":"/","capacity_percent":21},{"filesystem":"proc","type":"proc","1024_blocks":0,"used":0,"available":0,"mounted_on":"/proc","capacity_percent":null},{"filesystem":"sysfs","type":"sysfs","1024_blocks":0,"used":0,"available":0,"mounted_on":"/sys","capacity_percent":null}] diff --git a/tests/fixtures/osx-10.11.6/df-h.json b/tests/fixtures/osx-10.11.6/df-h.json index f0df823ed..bcb76e374 100644 --- a/tests/fixtures/osx-10.11.6/df-h.json +++ b/tests/fixtures/osx-10.11.6/df-h.json @@ -1 +1 @@ -[{"filesystem":"/dev/disk1s1","size":"466Gi","used":137,"iused":674413,"ifree":9223372036854101394,"mounted_on":"/","available":326,"capacity_percent":30,"iused_percent":0,"size_bytes":466000000000,"used_bytes":137000000000,"available_bytes":326000000000},{"filesystem":"devfs","size":"188Ki","used":188,"iused":650,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100,"size_bytes":188000,"used_bytes":188000,"available_bytes":0},{"filesystem":"/dev/disk1s4","size":"466Gi","used":2,"iused":2,"ifree":9223372036854775805,"mounted_on":"/private/var/vm","available":326,"capacity_percent":1,"iused_percent":0,"size_bytes":466000000000,"used_bytes":2000000000,"available_bytes":326000000000},{"filesystem":"map -hosts","size":"0Bi","used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100,"size_bytes":0,"used_bytes":0,"available_bytes":0},{"filesystem":"map auto_home","size":"0Bi","used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100,"size_bytes":0,"used_bytes":0,"available_bytes":0},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":"3.5Ti","used":1,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2,"capacity_percent":32,"iused_percent":32,"size_bytes":3500000000000,"used_bytes":1100000000000,"available_bytes":2400000000000}] +[{"filesystem":"/dev/disk1s1","size":466000000000,"used":137000000000,"iused":674413,"ifree":9223372036854101394,"mounted_on":"/","available":326000000000,"capacity_percent":30,"iused_percent":0},{"filesystem":"devfs","size":188000,"used":188000,"iused":650,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","size":466000000000,"used":2000000000,"iused":2,"ifree":9223372036854775805,"mounted_on":"/private/var/vm","available":326000000000,"capacity_percent":1,"iused_percent":0},{"filesystem":"map -hosts","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":3500000000000,"used":1100000000000,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2400000000000,"capacity_percent":32,"iused_percent":32}] diff --git a/tests/fixtures/osx-10.11.6/df-h.out b/tests/fixtures/osx-10.11.6/df-h.out old mode 100755 new mode 100644 diff --git a/tests/fixtures/osx-10.11.6/df.json b/tests/fixtures/osx-10.11.6/df.json index e14c503d6..cb236b4eb 100644 --- a/tests/fixtures/osx-10.11.6/df.json +++ b/tests/fixtures/osx-10.11.6/df.json @@ -1 +1 @@ -[{"filesystem":"/dev/disk1s1","512_blocks":976490576,"used":286747768,"available":684150392,"iused":674410,"ifree":9223372036854101397,"mounted_on":"/","capacity_percent":30,"iused_percent":0,"used_bytes":286747768,"available_bytes":684150392},{"filesystem":"devfs","512_blocks":375,"used":375,"available":0,"iused":650,"ifree":0,"mounted_on":"/dev","capacity_percent":100,"iused_percent":100,"used_bytes":375,"available_bytes":0},{"filesystem":"/dev/disk1s4","512_blocks":976490576,"used":4194344,"available":684150392,"iused":2,"ifree":9223372036854775805,"mounted_on":"/private/var/vm","capacity_percent":1,"iused_percent":0,"used_bytes":4194344,"available_bytes":684150392},{"filesystem":"map -hosts","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/net","capacity_percent":100,"iused_percent":100,"used_bytes":0,"available_bytes":0},{"filesystem":"map auto_home","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/home","capacity_percent":100,"iused_percent":100,"used_bytes":0,"available_bytes":0},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","512_blocks":7604804600,"used":2409078672,"available":5195725928,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","capacity_percent":32,"iused_percent":32,"used_bytes":2409078672,"available_bytes":5195725928}] +[{"filesystem":"/dev/disk1s1","512_blocks":976490576,"used":286747768,"available":684150392,"iused":674410,"ifree":9223372036854101397,"mounted_on":"/","capacity_percent":30,"iused_percent":0},{"filesystem":"devfs","512_blocks":375,"used":375,"available":0,"iused":650,"ifree":0,"mounted_on":"/dev","capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","512_blocks":976490576,"used":4194344,"available":684150392,"iused":2,"ifree":9223372036854775805,"mounted_on":"/private/var/vm","capacity_percent":1,"iused_percent":0},{"filesystem":"map -hosts","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/net","capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/home","capacity_percent":100,"iused_percent":100},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","512_blocks":7604804600,"used":2409078672,"available":5195725928,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","capacity_percent":32,"iused_percent":32}] diff --git a/tests/fixtures/osx-10.11.6/df.out b/tests/fixtures/osx-10.11.6/df.out old mode 100755 new mode 100644 diff --git a/tests/fixtures/osx-10.14.6/df-h.json b/tests/fixtures/osx-10.14.6/df-h.json index 37a8a4522..790a3604b 100644 --- a/tests/fixtures/osx-10.14.6/df-h.json +++ b/tests/fixtures/osx-10.14.6/df-h.json @@ -1 +1 @@ -[{"filesystem":"/dev/disk1s1","size":"466Gi","used":144,"iused":1507697,"ifree":9223372036853268110,"mounted_on":"/","available":315,"capacity_percent":32,"iused_percent":0,"size_bytes":466000000000,"used_bytes":144000000000,"available_bytes":315000000000},{"filesystem":"devfs","size":"334Ki","used":334,"iused":1154,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100,"size_bytes":334000,"used_bytes":334000,"available_bytes":0},{"filesystem":"/dev/disk1s4","size":"466Gi","used":6,"iused":6,"ifree":9223372036854775801,"mounted_on":"/private/var/vm","available":315,"capacity_percent":2,"iused_percent":0,"size_bytes":466000000000,"used_bytes":6000000000,"available_bytes":315000000000},{"filesystem":"map -hosts","size":"0Bi","used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100,"size_bytes":0,"used_bytes":0,"available_bytes":0},{"filesystem":"map auto_home","size":"0Bi","used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100,"size_bytes":0,"used_bytes":0,"available_bytes":0},{"filesystem":"/dev/disk2s2","size":"6.9Gi","used":5,"iused":8,"ifree":4294967271,"mounted_on":"/Volumes/InstallESD","available":1,"capacity_percent":76,"iused_percent":0,"size_bytes":6900000000,"used_bytes":5200000000,"available_bytes":1700000000},{"filesystem":"com.apple.TimeMachine.2019-11-29-075900@/dev/disk1s1","size":"466Gi","used":132,"iused":1459164,"ifree":9223372036853316643,"mounted_on":"/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/kbrazil-mac/2019-11-29-075900/Macintosh HD","available":315,"capacity_percent":30,"iused_percent":0,"size_bytes":466000000000,"used_bytes":132000000000,"available_bytes":315000000000},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":"3.5Ti","used":1,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2,"capacity_percent":32,"iused_percent":32,"size_bytes":3500000000000,"used_bytes":1100000000000,"available_bytes":2400000000000}] +[{"filesystem":"/dev/disk1s1","size":466000000000,"used":144000000000,"iused":1507697,"ifree":9223372036853268110,"mounted_on":"/","available":315000000000,"capacity_percent":32,"iused_percent":0},{"filesystem":"devfs","size":334000,"used":334000,"iused":1154,"ifree":0,"mounted_on":"/dev","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","size":466000000000,"used":6000000000,"iused":6,"ifree":9223372036854775801,"mounted_on":"/private/var/vm","available":315000000000,"capacity_percent":2,"iused_percent":0},{"filesystem":"map -hosts","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/net","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","size":0,"used":0,"iused":0,"ifree":0,"mounted_on":"/home","available":0,"capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk2s2","size":6900000000,"used":5200000000,"iused":8,"ifree":4294967271,"mounted_on":"/Volumes/InstallESD","available":1700000000,"capacity_percent":76,"iused_percent":0},{"filesystem":"com.apple.TimeMachine.2019-11-29-075900@/dev/disk1s1","size":466000000000,"used":132000000000,"iused":1459164,"ifree":9223372036853316643,"mounted_on":"/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/kbrazil-mac/2019-11-29-075900/Macintosh HD","available":315000000000,"capacity_percent":30,"iused_percent":0},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","size":3500000000000,"used":1100000000000,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","available":2400000000000,"capacity_percent":32,"iused_percent":32}] diff --git a/tests/fixtures/osx-10.14.6/df.json b/tests/fixtures/osx-10.14.6/df.json index 41c7f4127..2e88998e2 100644 --- a/tests/fixtures/osx-10.14.6/df.json +++ b/tests/fixtures/osx-10.14.6/df.json @@ -1 +1 @@ -[{"filesystem":"/dev/disk1s1","512_blocks":976490576,"used":302197928,"available":660310352,"iused":1507695,"ifree":9223372036853268112,"mounted_on":"/","capacity_percent":32,"iused_percent":0,"used_bytes":302197928,"available_bytes":660310352},{"filesystem":"devfs","512_blocks":667,"used":667,"available":0,"iused":1154,"ifree":0,"mounted_on":"/dev","capacity_percent":100,"iused_percent":100,"used_bytes":667,"available_bytes":0},{"filesystem":"/dev/disk1s4","512_blocks":976490576,"used":12583000,"available":660310352,"iused":6,"ifree":9223372036854775801,"mounted_on":"/private/var/vm","capacity_percent":2,"iused_percent":0,"used_bytes":12583000,"available_bytes":660310352},{"filesystem":"map -hosts","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/net","capacity_percent":100,"iused_percent":100,"used_bytes":0,"available_bytes":0},{"filesystem":"map auto_home","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/home","capacity_percent":100,"iused_percent":100,"used_bytes":0,"available_bytes":0},{"filesystem":"/dev/disk2s2","512_blocks":14463464,"used":10887304,"available":3576160,"iused":8,"ifree":4294967271,"mounted_on":"/Volumes/InstallESD","capacity_percent":76,"iused_percent":0,"used_bytes":10887304,"available_bytes":3576160},{"filesystem":"com.apple.TimeMachine.2019-11-29-075900@/dev/disk1s1","512_blocks":976490576,"used":277166752,"available":660310352,"iused":1459164,"ifree":9223372036853316643,"mounted_on":"/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/kbrazil-mac/2019-11-29-075900/Macintosh HD","capacity_percent":30,"iused_percent":0,"used_bytes":277166752,"available_bytes":660310352},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","512_blocks":7604804600,"used":2409078672,"available":5195725928,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","capacity_percent":32,"iused_percent":32,"used_bytes":2409078672,"available_bytes":5195725928}] +[{"filesystem":"/dev/disk1s1","512_blocks":976490576,"used":302197928,"available":660310352,"iused":1507695,"ifree":9223372036853268112,"mounted_on":"/","capacity_percent":32,"iused_percent":0},{"filesystem":"devfs","512_blocks":667,"used":667,"available":0,"iused":1154,"ifree":0,"mounted_on":"/dev","capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk1s4","512_blocks":976490576,"used":12583000,"available":660310352,"iused":6,"ifree":9223372036854775801,"mounted_on":"/private/var/vm","capacity_percent":2,"iused_percent":0},{"filesystem":"map -hosts","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/net","capacity_percent":100,"iused_percent":100},{"filesystem":"map auto_home","512_blocks":0,"used":0,"available":0,"iused":0,"ifree":0,"mounted_on":"/home","capacity_percent":100,"iused_percent":100},{"filesystem":"/dev/disk2s2","512_blocks":14463464,"used":10887304,"available":3576160,"iused":8,"ifree":4294967271,"mounted_on":"/Volumes/InstallESD","capacity_percent":76,"iused_percent":0},{"filesystem":"com.apple.TimeMachine.2019-11-29-075900@/dev/disk1s1","512_blocks":976490576,"used":277166752,"available":660310352,"iused":1459164,"ifree":9223372036853316643,"mounted_on":"/Volumes/com.apple.TimeMachine.localsnapshots/Backups.backupdb/kbrazil-mac/2019-11-29-075900/Macintosh HD","capacity_percent":30,"iused_percent":0},{"filesystem":"//brazil@MyCloudEX2Ultra._afpovertcp._tcp.local/brazil","512_blocks":7604804600,"used":2409078672,"available":5195725928,"iused":301134832,"ifree":649465741,"mounted_on":"/Volumes/brazil","capacity_percent":32,"iused_percent":32}] diff --git a/tests/fixtures/ubuntu-18.04/df-h.json b/tests/fixtures/ubuntu-18.04/df-h.json index 493d7828f..a297c8549 100644 --- a/tests/fixtures/ubuntu-18.04/df-h.json +++ b/tests/fixtures/ubuntu-18.04/df-h.json @@ -1 +1 @@ -[{"filesystem":"udev","size":"955M","used":0,"mounted_on":"/dev","available":955,"use_percent":0,"size_bytes":955000000,"used_bytes":0,"available_bytes":955000000},{"filesystem":"tmpfs","size":"198M","used":1,"mounted_on":"/run","available":196,"use_percent":1,"size_bytes":198000000,"used_bytes":1200000,"available_bytes":196000000},{"filesystem":"/dev/sda2","size":"20G","used":5,"mounted_on":"/","available":14,"use_percent":30,"size_bytes":20000000000,"used_bytes":5500000000,"available_bytes":14000000000},{"filesystem":"tmpfs","size":"986M","used":0,"mounted_on":"/dev/shm","available":986,"use_percent":0,"size_bytes":986000000,"used_bytes":0,"available_bytes":986000000},{"filesystem":"tmpfs","size":"5.0M","used":0,"mounted_on":"/run/lock","available":5,"use_percent":0,"size_bytes":5000000,"used_bytes":0,"available_bytes":5000000},{"filesystem":"tmpfs","size":"986M","used":0,"mounted_on":"/sys/fs/cgroup","available":986,"use_percent":0,"size_bytes":986000000,"used_bytes":0,"available_bytes":986000000},{"filesystem":"/dev/loop0","size":"55M","used":55,"mounted_on":"/snap/core18/1223","available":0,"use_percent":100,"size_bytes":55000000,"used_bytes":55000000,"available_bytes":0},{"filesystem":"/dev/loop1","size":"11M","used":11,"mounted_on":"/snap/slcli/383","available":0,"use_percent":100,"size_bytes":11000000,"used_bytes":11000000,"available_bytes":0},{"filesystem":"/dev/loop2","size":"89M","used":89,"mounted_on":"/snap/core/7396","available":0,"use_percent":100,"size_bytes":89000000,"used_bytes":89000000,"available_bytes":0},{"filesystem":"/dev/loop3","size":"67M","used":67,"mounted_on":"/snap/google-cloud-sdk/103","available":0,"use_percent":100,"size_bytes":67000000,"used_bytes":67000000,"available_bytes":0},{"filesystem":"/dev/loop5","size":"55M","used":55,"mounted_on":"/snap/core18/1074","available":0,"use_percent":100,"size_bytes":55000000,"used_bytes":55000000,"available_bytes":0},{"filesystem":"/dev/loop7","size":"8.7M","used":8,"mounted_on":"/snap/doctl/187","available":0,"use_percent":100,"size_bytes":8700000,"used_bytes":8700000,"available_bytes":0},{"filesystem":"/dev/loop8","size":"3.2M","used":3,"mounted_on":"/snap/stress-ng/847","available":0,"use_percent":100,"size_bytes":3200000,"used_bytes":3200000,"available_bytes":0},{"filesystem":"/dev/loop10","size":"90M","used":90,"mounted_on":"/snap/core/7917","available":0,"use_percent":100,"size_bytes":90000000,"used_bytes":90000000,"available_bytes":0},{"filesystem":"/dev/loop11","size":"3.3M","used":3,"mounted_on":"/snap/stress-ng/924","available":0,"use_percent":100,"size_bytes":3300000,"used_bytes":3300000,"available_bytes":0},{"filesystem":"tmpfs","size":"197M","used":0,"mounted_on":"/run/user/1000","available":197,"use_percent":0,"size_bytes":197000000,"used_bytes":0,"available_bytes":197000000},{"filesystem":"/dev/loop9","size":"8.7M","used":8,"mounted_on":"/snap/doctl/215","available":0,"use_percent":100,"size_bytes":8700000,"used_bytes":8700000,"available_bytes":0},{"filesystem":"/dev/loop4","size":"67M","used":67,"mounted_on":"/snap/google-cloud-sdk/104","available":0,"use_percent":100,"size_bytes":67000000,"used_bytes":67000000,"available_bytes":0}] +[{"filesystem":"udev","size":955000000,"used":0,"mounted_on":"/dev","available":955000000,"use_percent":0},{"filesystem":"tmpfs","size":198000000,"used":1200000,"mounted_on":"/run","available":196000000,"use_percent":1},{"filesystem":"/dev/sda2","size":20000000000,"used":5500000000,"mounted_on":"/","available":14000000000,"use_percent":30},{"filesystem":"tmpfs","size":986000000,"used":0,"mounted_on":"/dev/shm","available":986000000,"use_percent":0},{"filesystem":"tmpfs","size":5000000,"used":0,"mounted_on":"/run/lock","available":5000000,"use_percent":0},{"filesystem":"tmpfs","size":986000000,"used":0,"mounted_on":"/sys/fs/cgroup","available":986000000,"use_percent":0},{"filesystem":"/dev/loop0","size":55000000,"used":55000000,"mounted_on":"/snap/core18/1223","available":0,"use_percent":100},{"filesystem":"/dev/loop1","size":11000000,"used":11000000,"mounted_on":"/snap/slcli/383","available":0,"use_percent":100},{"filesystem":"/dev/loop2","size":89000000,"used":89000000,"mounted_on":"/snap/core/7396","available":0,"use_percent":100},{"filesystem":"/dev/loop3","size":67000000,"used":67000000,"mounted_on":"/snap/google-cloud-sdk/103","available":0,"use_percent":100},{"filesystem":"/dev/loop5","size":55000000,"used":55000000,"mounted_on":"/snap/core18/1074","available":0,"use_percent":100},{"filesystem":"/dev/loop7","size":8700000,"used":8700000,"mounted_on":"/snap/doctl/187","available":0,"use_percent":100},{"filesystem":"/dev/loop8","size":3200000,"used":3200000,"mounted_on":"/snap/stress-ng/847","available":0,"use_percent":100},{"filesystem":"/dev/loop10","size":90000000,"used":90000000,"mounted_on":"/snap/core/7917","available":0,"use_percent":100},{"filesystem":"/dev/loop11","size":3300000,"used":3300000,"mounted_on":"/snap/stress-ng/924","available":0,"use_percent":100},{"filesystem":"tmpfs","size":197000000,"used":0,"mounted_on":"/run/user/1000","available":197000000,"use_percent":0},{"filesystem":"/dev/loop9","size":8700000,"used":8700000,"mounted_on":"/snap/doctl/215","available":0,"use_percent":100},{"filesystem":"/dev/loop4","size":67000000,"used":67000000,"mounted_on":"/snap/google-cloud-sdk/104","available":0,"use_percent":100}] diff --git a/tests/fixtures/ubuntu-18.04/df.json b/tests/fixtures/ubuntu-18.04/df.json index fcb6d70de..eda00ba94 100644 --- a/tests/fixtures/ubuntu-18.04/df.json +++ b/tests/fixtures/ubuntu-18.04/df.json @@ -1 +1 @@ -[{"filesystem":"udev","1k_blocks":977500,"used":0,"available":977500,"mounted_on":"/dev","use_percent":0,"used_bytes":0,"available_bytes":977500},{"filesystem":"tmpfs","1k_blocks":201732,"used":1204,"available":200528,"mounted_on":"/run","use_percent":1,"used_bytes":1204,"available_bytes":200528},{"filesystem":"/dev/sda2","1k_blocks":20508240,"used":5748028,"available":13695408,"mounted_on":"/","use_percent":30,"used_bytes":5748028,"available_bytes":13695408},{"filesystem":"tmpfs","1k_blocks":1008648,"used":0,"available":1008648,"mounted_on":"/dev/shm","use_percent":0,"used_bytes":0,"available_bytes":1008648},{"filesystem":"tmpfs","1k_blocks":5120,"used":0,"available":5120,"mounted_on":"/run/lock","use_percent":0,"used_bytes":0,"available_bytes":5120},{"filesystem":"tmpfs","1k_blocks":1008648,"used":0,"available":1008648,"mounted_on":"/sys/fs/cgroup","use_percent":0,"used_bytes":0,"available_bytes":1008648},{"filesystem":"/dev/loop0","1k_blocks":55936,"used":55936,"available":0,"mounted_on":"/snap/core18/1223","use_percent":100,"used_bytes":55936,"available_bytes":0},{"filesystem":"/dev/loop1","1k_blocks":11264,"used":11264,"available":0,"mounted_on":"/snap/slcli/383","use_percent":100,"used_bytes":11264,"available_bytes":0},{"filesystem":"/dev/loop2","1k_blocks":90880,"used":90880,"available":0,"mounted_on":"/snap/core/7396","use_percent":100,"used_bytes":90880,"available_bytes":0},{"filesystem":"/dev/loop3","1k_blocks":68096,"used":68096,"available":0,"mounted_on":"/snap/google-cloud-sdk/103","use_percent":100,"used_bytes":68096,"available_bytes":0},{"filesystem":"/dev/loop5","1k_blocks":55808,"used":55808,"available":0,"mounted_on":"/snap/core18/1074","use_percent":100,"used_bytes":55808,"available_bytes":0},{"filesystem":"/dev/loop7","1k_blocks":8832,"used":8832,"available":0,"mounted_on":"/snap/doctl/187","use_percent":100,"used_bytes":8832,"available_bytes":0},{"filesystem":"/dev/loop8","1k_blocks":3200,"used":3200,"available":0,"mounted_on":"/snap/stress-ng/847","use_percent":100,"used_bytes":3200,"available_bytes":0},{"filesystem":"/dev/loop10","1k_blocks":91264,"used":91264,"available":0,"mounted_on":"/snap/core/7917","use_percent":100,"used_bytes":91264,"available_bytes":0},{"filesystem":"/dev/loop11","1k_blocks":3328,"used":3328,"available":0,"mounted_on":"/snap/stress-ng/924","use_percent":100,"used_bytes":3328,"available_bytes":0},{"filesystem":"tmpfs","1k_blocks":201728,"used":0,"available":201728,"mounted_on":"/run/user/1000","use_percent":0,"used_bytes":0,"available_bytes":201728},{"filesystem":"/dev/loop9","1k_blocks":8832,"used":8832,"available":0,"mounted_on":"/snap/doctl/215","use_percent":100,"used_bytes":8832,"available_bytes":0},{"filesystem":"/dev/loop4","1k_blocks":68224,"used":68224,"available":0,"mounted_on":"/snap/google-cloud-sdk/104","use_percent":100,"used_bytes":68224,"available_bytes":0}] +[{"filesystem":"udev","1k_blocks":977500,"used":0,"available":977500,"mounted_on":"/dev","use_percent":0},{"filesystem":"tmpfs","1k_blocks":201732,"used":1204,"available":200528,"mounted_on":"/run","use_percent":1},{"filesystem":"/dev/sda2","1k_blocks":20508240,"used":5748028,"available":13695408,"mounted_on":"/","use_percent":30},{"filesystem":"tmpfs","1k_blocks":1008648,"used":0,"available":1008648,"mounted_on":"/dev/shm","use_percent":0},{"filesystem":"tmpfs","1k_blocks":5120,"used":0,"available":5120,"mounted_on":"/run/lock","use_percent":0},{"filesystem":"tmpfs","1k_blocks":1008648,"used":0,"available":1008648,"mounted_on":"/sys/fs/cgroup","use_percent":0},{"filesystem":"/dev/loop0","1k_blocks":55936,"used":55936,"available":0,"mounted_on":"/snap/core18/1223","use_percent":100},{"filesystem":"/dev/loop1","1k_blocks":11264,"used":11264,"available":0,"mounted_on":"/snap/slcli/383","use_percent":100},{"filesystem":"/dev/loop2","1k_blocks":90880,"used":90880,"available":0,"mounted_on":"/snap/core/7396","use_percent":100},{"filesystem":"/dev/loop3","1k_blocks":68096,"used":68096,"available":0,"mounted_on":"/snap/google-cloud-sdk/103","use_percent":100},{"filesystem":"/dev/loop5","1k_blocks":55808,"used":55808,"available":0,"mounted_on":"/snap/core18/1074","use_percent":100},{"filesystem":"/dev/loop7","1k_blocks":8832,"used":8832,"available":0,"mounted_on":"/snap/doctl/187","use_percent":100},{"filesystem":"/dev/loop8","1k_blocks":3200,"used":3200,"available":0,"mounted_on":"/snap/stress-ng/847","use_percent":100},{"filesystem":"/dev/loop10","1k_blocks":91264,"used":91264,"available":0,"mounted_on":"/snap/core/7917","use_percent":100},{"filesystem":"/dev/loop11","1k_blocks":3328,"used":3328,"available":0,"mounted_on":"/snap/stress-ng/924","use_percent":100},{"filesystem":"tmpfs","1k_blocks":201728,"used":0,"available":201728,"mounted_on":"/run/user/1000","use_percent":0},{"filesystem":"/dev/loop9","1k_blocks":8832,"used":8832,"available":0,"mounted_on":"/snap/doctl/215","use_percent":100},{"filesystem":"/dev/loop4","1k_blocks":68224,"used":68224,"available":0,"mounted_on":"/snap/google-cloud-sdk/104","use_percent":100}]