mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
add systemctl list parsers
This commit is contained in:
@ -26,6 +26,10 @@ pydocmd simple jc.parsers.route+ > ../docs/parsers/route.md
|
|||||||
pydocmd simple jc.parsers.ss+ > ../docs/parsers/ss.md
|
pydocmd simple jc.parsers.ss+ > ../docs/parsers/ss.md
|
||||||
pydocmd simple jc.parsers.stat+ > ../docs/parsers/stat.md
|
pydocmd simple jc.parsers.stat+ > ../docs/parsers/stat.md
|
||||||
pydocmd simple jc.parsers.systemctl+ > ../docs/parsers/systemctl.md
|
pydocmd simple jc.parsers.systemctl+ > ../docs/parsers/systemctl.md
|
||||||
|
pydocmd simple jc.parsers.systemctl_lj+ > ../docs/parsers/systemctl_lj.md
|
||||||
|
pydocmd simple jc.parsers.systemctl_lm+ > ../docs/parsers/systemctl_lm.md
|
||||||
|
pydocmd simple jc.parsers.systemctl_ls+ > ../docs/parsers/systemctl_ls.md
|
||||||
|
pydocmd simple jc.parsers.systemctl_luf+ > ../docs/parsers/systemctl_luf.md
|
||||||
pydocmd simple jc.parsers.uname+ > ../docs/parsers/uname.md
|
pydocmd simple jc.parsers.uname+ > ../docs/parsers/uname.md
|
||||||
pydocmd simple jc.parsers.uptime+ > ../docs/parsers/uptime.md
|
pydocmd simple jc.parsers.uptime+ > ../docs/parsers/uptime.md
|
||||||
pydocmd simple jc.parsers.w+ > ../docs/parsers/w.md
|
pydocmd simple jc.parsers.w+ > ../docs/parsers/w.md
|
||||||
|
94
docs/parsers/systemctl_lj.md
Normal file
94
docs/parsers/systemctl_lj.md
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# jc.parsers.systemctl_lj
|
||||||
|
jc - JSON CLI output utility systemctl-lj Parser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-jobs
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ systemctl list-jobs| jc --systemctl-lj -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"job": 3543,
|
||||||
|
"unit": "nginxAfterGlusterfs.service",
|
||||||
|
"type": "start",
|
||||||
|
"state": "waiting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"job": 3545,
|
||||||
|
"unit": "glusterReadyForLocalhostMount.service",
|
||||||
|
"type": "start",
|
||||||
|
"state": "running"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"job": 3506,
|
||||||
|
"unit": "nginx.service",
|
||||||
|
"type": "start",
|
||||||
|
"state": "waiting"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
$ systemctl list-jobs| jc --systemctl-lj -p -r
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"job": "3543",
|
||||||
|
"unit": "nginxAfterGlusterfs.service",
|
||||||
|
"type": "start",
|
||||||
|
"state": "waiting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"job": "3545",
|
||||||
|
"unit": "glusterReadyForLocalhostMount.service",
|
||||||
|
"type": "start",
|
||||||
|
"state": "running"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"job": "3506",
|
||||||
|
"unit": "nginx.service",
|
||||||
|
"type": "start",
|
||||||
|
"state": "waiting"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (dictionary) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
dictionary structured data with the following schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"job": integer,
|
||||||
|
"unit": string,
|
||||||
|
"type": string,
|
||||||
|
"state": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
dictionary raw or processed structured data
|
||||||
|
|
76
docs/parsers/systemctl_lm.md
Normal file
76
docs/parsers/systemctl_lm.md
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# jc.parsers.systemctl_lm
|
||||||
|
jc - JSON CLI output utility systemctl-lm Parser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-machines
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ systemctl -a | jc --systemctl -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"unit": "proc-sys-fs-binfmt_misc.automount",
|
||||||
|
"load": "loaded",
|
||||||
|
"active": "active",
|
||||||
|
"sub": "waiting",
|
||||||
|
"description": "Arbitrary Executable File Formats File System Automount Point"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unit": "dev-block-8:2.device",
|
||||||
|
"load": "loaded",
|
||||||
|
"active": "active",
|
||||||
|
"sub": "plugged",
|
||||||
|
"description": "LVM PV 3klkIj-w1qk-DkJi-0XBJ-y3o7-i2Ac-vHqWBM on /dev/sda2 2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unit": "dev-cdrom.device",
|
||||||
|
"load": "loaded",
|
||||||
|
"active": "active",
|
||||||
|
"sub": "plugged",
|
||||||
|
"description": "VMware_Virtual_IDE_CDROM_Drive"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (dictionary) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
dictionary structured data with the following schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"unit": string,
|
||||||
|
"load": string,
|
||||||
|
"active": string,
|
||||||
|
"sub": string,
|
||||||
|
"description": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
dictionary raw or processed structured data
|
||||||
|
|
68
docs/parsers/systemctl_ls.md
Normal file
68
docs/parsers/systemctl_ls.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# jc.parsers.systemctl_ls
|
||||||
|
jc - JSON CLI output utility systemctl-ls Parser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-sockets
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ systemctl list-sockets | jc --systemctl-ls -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"listen": "/dev/log",
|
||||||
|
"unit": "systemd-journald.socket",
|
||||||
|
"activates": "systemd-journald.service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"listen": "/run/dbus/system_bus_socket",
|
||||||
|
"unit": "dbus.socket",
|
||||||
|
"activates": "dbus.service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"listen": "/run/dmeventd-client",
|
||||||
|
"unit": "dm-event.socket",
|
||||||
|
"activates": "dm-event.service"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (dictionary) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
dictionary structured data with the following schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"listen": string,
|
||||||
|
"unit": string,
|
||||||
|
"activates": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
dictionary raw or processed structured data
|
||||||
|
|
64
docs/parsers/systemctl_luf.md
Normal file
64
docs/parsers/systemctl_luf.md
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# jc.parsers.systemctl_luf
|
||||||
|
jc - JSON CLI output utility systemctl-luf Parser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
specify --systemctl-luf as the first argument if the piped input is coming from systemctl list-unit-files
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ systemctl list-unit-files | jc --systemctl-luf -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"unit_file": "proc-sys-fs-binfmt_misc.automount",
|
||||||
|
"state": "static"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unit_file": "dev-hugepages.mount",
|
||||||
|
"state": "static"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unit_file": "dev-mqueue.mount",
|
||||||
|
"state": "static"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
|
||||||
|
## process
|
||||||
|
```python
|
||||||
|
process(proc_data)
|
||||||
|
```
|
||||||
|
|
||||||
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
proc_data: (dictionary) raw structured data to process
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
dictionary structured data with the following schema:
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"unit_file": string,
|
||||||
|
"state": string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
dictionary raw or processed structured data
|
||||||
|
|
Reference in New Issue
Block a user