diff --git a/docgen.sh b/docgen.sh index 7f5709fe..667ed0f1 100755 --- a/docgen.sh +++ b/docgen.sh @@ -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.stat+ > ../docs/parsers/stat.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.uptime+ > ../docs/parsers/uptime.md pydocmd simple jc.parsers.w+ > ../docs/parsers/w.md diff --git a/docs/parsers/systemctl_lj.md b/docs/parsers/systemctl_lj.md new file mode 100644 index 00000000..efc772ab --- /dev/null +++ b/docs/parsers/systemctl_lj.md @@ -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 + diff --git a/docs/parsers/systemctl_lm.md b/docs/parsers/systemctl_lm.md new file mode 100644 index 00000000..4f3e19f2 --- /dev/null +++ b/docs/parsers/systemctl_lm.md @@ -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 + diff --git a/docs/parsers/systemctl_ls.md b/docs/parsers/systemctl_ls.md new file mode 100644 index 00000000..ed6cb3c2 --- /dev/null +++ b/docs/parsers/systemctl_ls.md @@ -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 + diff --git a/docs/parsers/systemctl_luf.md b/docs/parsers/systemctl_luf.md new file mode 100644 index 00000000..65b5705d --- /dev/null +++ b/docs/parsers/systemctl_luf.md @@ -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 +