mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
2
.github/workflows/pythonapp.yml
vendored
2
.github/workflows/pythonapp.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0]
|
python-version: [3.7, 3.8, 3.9, 3.10.0]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
|
20211202 v1.17.3
|
||||||
|
- Update parsers to exit with error if non-string input is detected (raise TypeError)
|
||||||
|
- Update streaming parsers to exit with error if non-iterable input is detected (raise TypeError)
|
||||||
|
- Simplify quiet-checking in parsers
|
||||||
|
- Add iostat parser tested on linux
|
||||||
|
- Add iostat streaming parser tested on linux
|
||||||
|
|
||||||
20211117 v1.17.2
|
20211117 v1.17.2
|
||||||
- Fix ping parser to add Alpine linux support
|
- Fix ping parser to add Alpine linux support
|
||||||
- Fix netstat parser for older versions of netstat on linux
|
- Fix netstat parser for older versions of netstat on linux
|
||||||
|
44
EXAMPLES.md
44
EXAMPLES.md
@ -1516,6 +1516,50 @@ cat example.ini | jc --ini -p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
### iostat
|
||||||
|
```bash
|
||||||
|
$ iostat | jc --iostat -p # or: jc -p iostat
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"percent_user": 0.15,
|
||||||
|
"percent_nice": 0.0,
|
||||||
|
"percent_system": 0.18,
|
||||||
|
"percent_iowait": 0.0,
|
||||||
|
"percent_steal": 0.0,
|
||||||
|
"percent_idle": 99.67,
|
||||||
|
"type": "cpu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "sda",
|
||||||
|
"tps": 0.29,
|
||||||
|
"kb_read_s": 7.22,
|
||||||
|
"kb_wrtn_s": 1.25,
|
||||||
|
"kb_read": 194341,
|
||||||
|
"kb_wrtn": 33590,
|
||||||
|
"type": "device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "dm-0",
|
||||||
|
"tps": 0.29,
|
||||||
|
"kb_read_s": 5.99,
|
||||||
|
"kb_wrtn_s": 1.17,
|
||||||
|
"kb_read": 161361,
|
||||||
|
"kb_wrtn": 31522,
|
||||||
|
"type": "device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "dm-1",
|
||||||
|
"tps": 0.0,
|
||||||
|
"kb_read_s": 0.08,
|
||||||
|
"kb_wrtn_s": 0.0,
|
||||||
|
"kb_read": 2204,
|
||||||
|
"kb_wrtn": 0,
|
||||||
|
"type": "device"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
### iptables
|
### iptables
|
||||||
```bash
|
```bash
|
||||||
iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
|
iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
|
||||||
|
@ -138,6 +138,8 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
|||||||
- `--id` enables the `id` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/id))
|
- `--id` enables the `id` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/id))
|
||||||
- `--ifconfig` enables the `ifconfig` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig))
|
- `--ifconfig` enables the `ifconfig` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ifconfig))
|
||||||
- `--ini` enables the INI file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ini))
|
- `--ini` enables the INI file parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ini))
|
||||||
|
- `--iostat` enables the `iostat` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat))
|
||||||
|
- `--iostat-s` enables the `iostat` command streaming parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iostat_s))
|
||||||
- `--iptables` enables the `iptables` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables))
|
- `--iptables` enables the `iptables` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iptables))
|
||||||
- `--iw-scan` enables the `iw dev [device] scan` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan))
|
- `--iw-scan` enables the `iw dev [device] scan` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/iw_scan))
|
||||||
- `--jobs` enables the `jobs` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs))
|
- `--jobs` enables the `jobs` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/jobs))
|
||||||
|
@ -252,4 +252,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -105,4 +105,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: darwin
|
Compatibility: darwin
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -133,4 +133,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: darwin
|
Compatibility: darwin
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -142,4 +142,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, aix, freebsd, darwin
|
Compatibility: linux, aix, freebsd, darwin
|
||||||
|
|
||||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -145,4 +145,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -79,4 +79,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -195,4 +195,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -191,4 +191,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -99,4 +99,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -82,4 +82,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -96,4 +96,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -122,4 +122,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -341,4 +341,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
|
Compatibility: linux, aix, freebsd, darwin, win32, cygwin
|
||||||
|
|
||||||
Version 2.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 2.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -143,4 +143,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: win32
|
Compatibility: win32
|
||||||
|
|
||||||
Version 1.3 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
|
Version 1.4 by Rasheed Elsaleh (rasheed@rebelliondefense.com)
|
||||||
|
@ -150,4 +150,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -155,4 +155,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -112,4 +112,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -95,4 +95,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -87,4 +87,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, aix, freebsd, darwin
|
Compatibility: linux, aix, freebsd, darwin
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -115,4 +115,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, freebsd
|
Compatibility: linux, darwin, cygwin, freebsd
|
||||||
|
|
||||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -97,4 +97,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -110,4 +110,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, freebsd
|
Compatibility: linux, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -134,4 +134,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -102,4 +102,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, aix, freebsd
|
Compatibility: linux, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -62,4 +62,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -93,4 +93,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -342,4 +342,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -85,4 +85,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -99,4 +99,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -130,4 +130,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -211,4 +211,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, aix, freebsd, darwin
|
Compatibility: linux, aix, freebsd, darwin
|
||||||
|
|
||||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -90,4 +90,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
187
docs/parsers/iostat.md
Normal file
187
docs/parsers/iostat.md
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||||
|
|
||||||
|
# jc.parsers.iostat
|
||||||
|
jc - JSON CLI output utility `iostat` command output parser
|
||||||
|
|
||||||
|
Note: `iostat` version 11 and higher include a JSON output option
|
||||||
|
|
||||||
|
Usage (cli):
|
||||||
|
|
||||||
|
$ iostat | jc --iostat
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ jc iostat
|
||||||
|
|
||||||
|
Usage (module):
|
||||||
|
|
||||||
|
import jc.parsers.iostat
|
||||||
|
result = jc.parsers.iostat.parse(iostat_command_output)
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": string,
|
||||||
|
"percent_user": float,
|
||||||
|
"percent_nice": float,
|
||||||
|
"percent_system": float,
|
||||||
|
"percent_iowait": float,
|
||||||
|
"percent_steal": float,
|
||||||
|
"percent_idle": float,
|
||||||
|
"device": string,
|
||||||
|
"tps": float,
|
||||||
|
"kb_read_s": float,
|
||||||
|
"mb_read_s": float,
|
||||||
|
"kb_wrtn_s": float,
|
||||||
|
"mb_wrtn_s": float,
|
||||||
|
"kb_read": integer,
|
||||||
|
"mb_read": integer,
|
||||||
|
"kb_wrtn": integer,
|
||||||
|
"mb_wrtn": integer,
|
||||||
|
'kb_dscd': integer,
|
||||||
|
'mb_dscd': integer,
|
||||||
|
"rrqm_s": float,
|
||||||
|
"wrqm_s": float,
|
||||||
|
"r_s": float,
|
||||||
|
"w_s": float,
|
||||||
|
"rmb_s": float,
|
||||||
|
"rkb_s": float,
|
||||||
|
"wmb_s": float,
|
||||||
|
"wkb_s": float,
|
||||||
|
"avgrq_sz": float,
|
||||||
|
"avgqu_sz": float,
|
||||||
|
"await": float,
|
||||||
|
"r_await": float,
|
||||||
|
"w_await": float,
|
||||||
|
"svctm": float,
|
||||||
|
"aqu_sz": float,
|
||||||
|
"rareq_sz": float,
|
||||||
|
"wareq_sz": float,
|
||||||
|
"d_s": float,
|
||||||
|
"dkb_s": float,
|
||||||
|
"dmb_s": float,
|
||||||
|
"drqm_s": float,
|
||||||
|
"percent_drqm": float,
|
||||||
|
"d_await": float,
|
||||||
|
"dareq_sz": float,
|
||||||
|
"f_s": float,
|
||||||
|
"f_await": float,
|
||||||
|
"kb_dscd_s": float,
|
||||||
|
"mb_dscd_s": float,
|
||||||
|
"percent_util": float,
|
||||||
|
"percent_rrqm": float,
|
||||||
|
"percent_wrqm": float
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ iostat | jc --iostat -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"percent_user": 0.15,
|
||||||
|
"percent_nice": 0.0,
|
||||||
|
"percent_system": 0.18,
|
||||||
|
"percent_iowait": 0.0,
|
||||||
|
"percent_steal": 0.0,
|
||||||
|
"percent_idle": 99.67,
|
||||||
|
"type": "cpu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "sda",
|
||||||
|
"tps": 0.29,
|
||||||
|
"kb_read_s": 7.22,
|
||||||
|
"kb_wrtn_s": 1.25,
|
||||||
|
"kb_read": 194341,
|
||||||
|
"kb_wrtn": 33590,
|
||||||
|
"type": "device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "dm-0",
|
||||||
|
"tps": 0.29,
|
||||||
|
"kb_read_s": 5.99,
|
||||||
|
"kb_wrtn_s": 1.17,
|
||||||
|
"kb_read": 161361,
|
||||||
|
"kb_wrtn": 31522,
|
||||||
|
"type": "device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "dm-1",
|
||||||
|
"tps": 0.0,
|
||||||
|
"kb_read_s": 0.08,
|
||||||
|
"kb_wrtn_s": 0.0,
|
||||||
|
"kb_read": 2204,
|
||||||
|
"kb_wrtn": 0,
|
||||||
|
"type": "device"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
$ iostat | jc --iostat -p -r
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"percent_user": "0.15",
|
||||||
|
"percent_nice": "0.00",
|
||||||
|
"percent_system": "0.18",
|
||||||
|
"percent_iowait": "0.00",
|
||||||
|
"percent_steal": "0.00",
|
||||||
|
"percent_idle": "99.67",
|
||||||
|
"type": "cpu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "sda",
|
||||||
|
"tps": "0.29",
|
||||||
|
"kb_read_s": "7.22",
|
||||||
|
"kb_wrtn_s": "1.25",
|
||||||
|
"kb_read": "194341",
|
||||||
|
"kb_wrtn": "33590",
|
||||||
|
"type": "device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "dm-0",
|
||||||
|
"tps": "0.29",
|
||||||
|
"kb_read_s": "5.99",
|
||||||
|
"kb_wrtn_s": "1.17",
|
||||||
|
"kb_read": "161361",
|
||||||
|
"kb_wrtn": "31522",
|
||||||
|
"type": "device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"device": "dm-1",
|
||||||
|
"tps": "0.00",
|
||||||
|
"kb_read_s": "0.08",
|
||||||
|
"kb_wrtn_s": "0.00",
|
||||||
|
"kb_read": "2204",
|
||||||
|
"kb_wrtn": "0",
|
||||||
|
"type": "device"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
## info
|
||||||
|
```python
|
||||||
|
info()
|
||||||
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
|
## parse
|
||||||
|
```python
|
||||||
|
parse(data, raw=False, quiet=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
Main text parsing function
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
data: (string) text data to parse
|
||||||
|
raw: (boolean) output preprocessed JSON if True
|
||||||
|
quiet: (boolean) suppress warning messages if True
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
List of Dictionaries. Raw or processed structured data.
|
||||||
|
|
||||||
|
## Parser Information
|
||||||
|
Compatibility: linux
|
||||||
|
|
||||||
|
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
126
docs/parsers/iostat_s.md
Normal file
126
docs/parsers/iostat_s.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||||
|
|
||||||
|
# jc.parsers.iostat_s
|
||||||
|
jc - JSON CLI output utility `iostat` command output streaming parser
|
||||||
|
|
||||||
|
> This streaming parser outputs JSON Lines
|
||||||
|
|
||||||
|
Note: `iostat` version 11 and higher include a JSON output option
|
||||||
|
|
||||||
|
Usage (cli):
|
||||||
|
|
||||||
|
$ iostat | jc --iostat-s
|
||||||
|
|
||||||
|
Usage (module):
|
||||||
|
|
||||||
|
import jc.parsers.iostat_s
|
||||||
|
result = jc.parsers.iostat_s.parse(iostat_command_output.splitlines()) # result is an iterable object
|
||||||
|
for item in result:
|
||||||
|
# do something
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": string,
|
||||||
|
"percent_user": float,
|
||||||
|
"percent_nice": float,
|
||||||
|
"percent_system": float,
|
||||||
|
"percent_iowait": float,
|
||||||
|
"percent_steal": float,
|
||||||
|
"percent_idle": float,
|
||||||
|
"device": string,
|
||||||
|
"tps": float,
|
||||||
|
"kb_read_s": float,
|
||||||
|
"mb_read_s": float,
|
||||||
|
"kb_wrtn_s": float,
|
||||||
|
"mb_wrtn_s": float,
|
||||||
|
"kb_read": integer,
|
||||||
|
"mb_read": integer,
|
||||||
|
"kb_wrtn": integer,
|
||||||
|
"mb_wrtn": integer,
|
||||||
|
'kb_dscd': integer,
|
||||||
|
'mb_dscd': integer,
|
||||||
|
"rrqm_s": float,
|
||||||
|
"wrqm_s": float,
|
||||||
|
"r_s": float,
|
||||||
|
"w_s": float,
|
||||||
|
"rmb_s": float,
|
||||||
|
"rkb_s": float,
|
||||||
|
"wmb_s": float,
|
||||||
|
"wkb_s": float,
|
||||||
|
"avgrq_sz": float,
|
||||||
|
"avgqu_sz": float,
|
||||||
|
"await": float,
|
||||||
|
"r_await": float,
|
||||||
|
"w_await": float,
|
||||||
|
"svctm": float,
|
||||||
|
"aqu_sz": float,
|
||||||
|
"rareq_sz": float,
|
||||||
|
"wareq_sz": float,
|
||||||
|
"d_s": float,
|
||||||
|
"dkb_s": float,
|
||||||
|
"dmb_s": float,
|
||||||
|
"drqm_s": float,
|
||||||
|
"percent_drqm": float,
|
||||||
|
"d_await": float,
|
||||||
|
"dareq_sz": float,
|
||||||
|
"f_s": float,
|
||||||
|
"f_await": float,
|
||||||
|
"kb_dscd_s": float,
|
||||||
|
"mb_dscd_s": float,
|
||||||
|
"percent_util": float,
|
||||||
|
"percent_rrqm": float,
|
||||||
|
"percent_wrqm": float,
|
||||||
|
"_jc_meta": # This object only exists if using -qq or ignore_exceptions=True
|
||||||
|
{
|
||||||
|
"success": booean, # true if successfully parsed, false if error
|
||||||
|
"error": string, # exists if "success" is false
|
||||||
|
"line": string # exists if "success" is false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ iostat | jc --iostat-s
|
||||||
|
{"percent_user":0.14,"percent_nice":0.0,"percent_system":0.16,"percent_iowait":0.0,"percent_steal":0.0,"percent_idle":99.7,"type":"cpu"}
|
||||||
|
{"device":"sda","tps":0.24,"kb_read_s":5.28,"kb_wrtn_s":1.1,"kb_read":203305,"kb_wrtn":42368,"type":"device"}
|
||||||
|
...
|
||||||
|
|
||||||
|
$ iostat | jc --iostat-s -r
|
||||||
|
{"percent_user":"0.14","percent_nice":"0.00","percent_system":"0.16","percent_iowait":"0.00","percent_steal":"0.00","percent_idle":"99.70","type":"cpu"}
|
||||||
|
{"device":"sda","tps":"0.24","kb_read_s":"5.28","kb_wrtn_s":"1.10","kb_read":"203305","kb_wrtn":"42368","type":"device"}
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
## info
|
||||||
|
```python
|
||||||
|
info()
|
||||||
|
```
|
||||||
|
Provides parser metadata (version, author, etc.)
|
||||||
|
|
||||||
|
## parse
|
||||||
|
```python
|
||||||
|
parse(data, raw=False, quiet=False, ignore_exceptions=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
Main text parsing generator function. Returns an iterator object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
data: (iterable) line-based text data to parse (e.g. sys.stdin or str.splitlines())
|
||||||
|
raw: (boolean) output preprocessed JSON if True
|
||||||
|
quiet: (boolean) suppress warning messages if True
|
||||||
|
ignore_exceptions: (boolean) ignore parsing exceptions if True
|
||||||
|
|
||||||
|
Yields:
|
||||||
|
|
||||||
|
Dictionary. Raw or processed structured data.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
Iterator object
|
||||||
|
|
||||||
|
## Parser Information
|
||||||
|
Compatibility: linux
|
||||||
|
|
||||||
|
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
@ -188,4 +188,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -145,4 +145,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 0.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -117,4 +117,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -128,4 +128,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -131,4 +131,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -91,4 +91,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -293,4 +293,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -150,4 +150,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -144,4 +144,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -285,4 +285,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -100,4 +100,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -379,4 +379,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.11 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.12 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -231,4 +231,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, freebsd
|
Compatibility: linux, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -119,4 +119,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -181,4 +181,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -98,4 +98,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -72,4 +72,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -90,4 +90,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -231,4 +231,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -133,4 +133,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -181,4 +181,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -225,4 +225,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -126,4 +126,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, aix, freebsd
|
Compatibility: linux, darwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -303,4 +303,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -193,4 +193,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -79,4 +79,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -83,4 +83,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -100,4 +100,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -75,4 +75,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -71,4 +71,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -229,4 +229,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: win32
|
Compatibility: win32
|
||||||
|
|
||||||
Version 1.0 by Jon Smith (jon@rebelliondefense.com)
|
Version 1.1 by Jon Smith (jon@rebelliondefense.com)
|
||||||
|
@ -148,4 +148,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -88,4 +88,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -156,4 +156,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -142,4 +142,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -222,4 +222,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -155,4 +155,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -72,4 +72,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd
|
||||||
|
|
||||||
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -219,4 +219,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -90,4 +90,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -146,4 +146,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -111,4 +111,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 0.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 0.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -128,4 +128,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -79,4 +79,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -157,4 +157,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, aix, freebsd
|
Compatibility: linux, darwin, cygwin, aix, freebsd
|
||||||
|
|
||||||
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -95,4 +95,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -109,4 +109,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
Version 1.5 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.6 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -40,7 +40,7 @@ Returns:
|
|||||||
|
|
||||||
## compatibility
|
## compatibility
|
||||||
```python
|
```python
|
||||||
compatibility(mod_name, compatible)
|
compatibility(mod_name, compatible, quiet=False)
|
||||||
```
|
```
|
||||||
Checks for the parser's compatibility with the running OS platform.
|
Checks for the parser's compatibility with the running OS platform.
|
||||||
|
|
||||||
@ -52,6 +52,8 @@ Parameters:
|
|||||||
compatible options:
|
compatible options:
|
||||||
linux, darwin, cygwin, win32, aix, freebsd
|
linux, darwin, cygwin, win32, aix, freebsd
|
||||||
|
|
||||||
|
quiet: (bool) supress compatibility message if True
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
None - just prints output to STDERR
|
None - just prints output to STDERR
|
||||||
@ -135,6 +137,24 @@ Reraise the stream exception with annotation or print an error `_jc_meta`
|
|||||||
field if `ignore_exceptions=True`
|
field if `ignore_exceptions=True`
|
||||||
|
|
||||||
|
|
||||||
|
## input_type_check
|
||||||
|
```python
|
||||||
|
input_type_check(data)
|
||||||
|
```
|
||||||
|
Ensure input data is a string
|
||||||
|
|
||||||
|
## streaming_input_type_check
|
||||||
|
```python
|
||||||
|
streaming_input_type_check(data)
|
||||||
|
```
|
||||||
|
Ensure input data is an iterable, but not a string or bytes
|
||||||
|
|
||||||
|
## streaming_line_input_type_check
|
||||||
|
```python
|
||||||
|
streaming_line_input_type_check(line)
|
||||||
|
```
|
||||||
|
Ensure each line is a string
|
||||||
|
|
||||||
## timestamp
|
## timestamp
|
||||||
```python
|
```python
|
||||||
timestamp(datetime_string)
|
timestamp(datetime_string)
|
||||||
|
@ -73,4 +73,4 @@ Module Example:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
name = 'jc'
|
name = 'jc'
|
||||||
__version__ = '1.17.2'
|
__version__ = '1.17.3'
|
||||||
|
@ -76,6 +76,8 @@ parsers = [
|
|||||||
'id',
|
'id',
|
||||||
'ifconfig',
|
'ifconfig',
|
||||||
'ini',
|
'ini',
|
||||||
|
'iostat',
|
||||||
|
'iostat-s',
|
||||||
'iptables',
|
'iptables',
|
||||||
'iw-scan',
|
'iw-scan',
|
||||||
'jobs',
|
'jobs',
|
||||||
|
@ -227,7 +227,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.2'
|
version = '1.3'
|
||||||
description = '`acpi` command parser'
|
description = '`acpi` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -302,8 +302,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
output_line = {}
|
output_line = {}
|
||||||
|
@ -80,7 +80,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.3'
|
version = '1.4'
|
||||||
description = '`airport -I` command parser'
|
description = '`airport -I` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -130,8 +130,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
Dictionary. Raw or processed structured data.
|
Dictionary. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = {}
|
raw_output = {}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.4'
|
version = '1.5'
|
||||||
description = '`airport -s` command parser'
|
description = '`airport -s` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -166,8 +166,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
cleandata = list(filter(None, data.splitlines()))
|
cleandata = list(filter(None, data.splitlines()))
|
||||||
|
@ -118,7 +118,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.7'
|
version = '1.8'
|
||||||
description = '`arp` command parser'
|
description = '`arp` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -171,8 +171,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
cleandata = list(filter(None, data.splitlines()))
|
cleandata = list(filter(None, data.splitlines()))
|
||||||
|
@ -121,7 +121,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.4'
|
version = '1.5'
|
||||||
description = '`blkid` command parser'
|
description = '`blkid` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -176,8 +176,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.2'
|
version = '1.3'
|
||||||
description = '`cksum` and `sum` command parser'
|
description = '`cksum` and `sum` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -103,8 +103,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.5'
|
version = '1.6'
|
||||||
description = '`crontab` command and file parser'
|
description = '`crontab` command and file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -225,8 +225,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
Dictionary. Raw or processed structured data.
|
Dictionary. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = {}
|
raw_output = {}
|
||||||
cleandata = data.splitlines()
|
cleandata = data.splitlines()
|
||||||
|
@ -167,7 +167,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.6'
|
version = '1.7'
|
||||||
description = '`crontab` file parser with user support'
|
description = '`crontab` file parser with user support'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -220,8 +220,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
Dictionary. Raw or processed structured data.
|
Dictionary. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = {}
|
raw_output = {}
|
||||||
cleandata = data.splitlines()
|
cleandata = data.splitlines()
|
||||||
|
@ -75,7 +75,7 @@ import csv
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.2'
|
version = '1.3'
|
||||||
description = 'CSV file parser'
|
description = 'CSV file parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -119,8 +119,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = []
|
raw_output = []
|
||||||
cleandata = data.splitlines()
|
cleandata = data.splitlines()
|
||||||
|
@ -56,7 +56,7 @@ from jc.exceptions import ParseError
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.0'
|
version = '1.1'
|
||||||
description = 'CSV file streaming parser'
|
description = 'CSV file streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -103,8 +103,8 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
|
|
||||||
Iterator object
|
Iterator object
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.streaming_input_type_check(data)
|
||||||
|
|
||||||
# convert data to an iterable in case a sequence like a list is used as input.
|
# convert data to an iterable in case a sequence like a list is used as input.
|
||||||
# this allows the exhaustion of the input so we don't double-process later.
|
# this allows the exhaustion of the input so we don't double-process later.
|
||||||
|
@ -72,7 +72,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '2.1'
|
version = '2.2'
|
||||||
description = '`date` command parser'
|
description = '`date` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -115,8 +115,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
Dictionary. Raw or processed structured data.
|
Dictionary. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
if not quiet:
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
jc.utils.input_type_check(data)
|
||||||
|
|
||||||
raw_output = {}
|
raw_output = {}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.8'
|
version = '1.9'
|
||||||
description = '`df` command parser'
|
description = '`df` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -203,9 +203,8 @@ def parse(data, raw=False, quiet=False):
|
|||||||
|
|
||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
"""
|
"""
|
||||||
|
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||||
if not quiet:
|
jc.utils.input_type_check(data)
|
||||||
jc.utils.compatibility(__name__, info.compatible)
|
|
||||||
|
|
||||||
cleandata = data.splitlines()
|
cleandata = data.splitlines()
|
||||||
fix_data = []
|
fix_data = []
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user