mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
doc update
This commit is contained in:
@ -5,26 +5,43 @@
|
||||
|
||||
jc - JSON Convert Proc file output parser
|
||||
|
||||
<<Short procfile description and caveats>>
|
||||
This parser automatically identifies the Proc file and calls the
|
||||
corresponding parser to peform the parsing. The specific parsers can also
|
||||
be called directly, if desired and have a naming convention of
|
||||
`proc-<name>` (cli) or `proc_<name>` (module).
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat /proc/<file> | jc --procfile
|
||||
$ cat /proc/meminfo | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/meminfo | jc --proc-memifno
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('procfile', proc_file)
|
||||
result = jc.parse('proc', proc_file)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"procfile": string,
|
||||
"bar": boolean,
|
||||
"baz": integer
|
||||
}
|
||||
]
|
||||
See the specific Proc parser for the schema:
|
||||
|
||||
$ jc --help --proc-<name>
|
||||
|
||||
For example:
|
||||
|
||||
$ jc --help --proc-meminfo
|
||||
|
||||
Specific Proc file parser names can be found with `jc -hh` or `jc -a`.
|
||||
|
||||
Schemas can also be found online at:
|
||||
|
||||
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
|
||||
|
||||
For example:
|
||||
|
||||
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_meminfo
|
||||
|
||||
Examples:
|
||||
|
||||
|
@ -9,28 +9,84 @@ Usage (cli):
|
||||
|
||||
$ cat /proc/meminfo | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/meminfo | jc --proc-meminfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc', proc_meminfo_file)
|
||||
|
||||
or
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc_meminfo', proc_meminfo_file)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"foo": string,
|
||||
"bar": boolean,
|
||||
"baz": integer
|
||||
}
|
||||
]
|
||||
All values are integers.
|
||||
|
||||
{
|
||||
<keyName> integer
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ foo | jc --foo -p
|
||||
[]
|
||||
|
||||
$ foo | jc --foo -p -r
|
||||
[]
|
||||
$ cat /proc/meminfo | jc --proc -p
|
||||
{
|
||||
"MemTotal": 3997272,
|
||||
"MemFree": 2760316,
|
||||
"MemAvailable": 3386876,
|
||||
"Buffers": 40452,
|
||||
"Cached": 684856,
|
||||
"SwapCached": 0,
|
||||
"Active": 475816,
|
||||
"Inactive": 322064,
|
||||
"Active(anon)": 70216,
|
||||
"Inactive(anon)": 148,
|
||||
"Active(file)": 405600,
|
||||
"Inactive(file)": 321916,
|
||||
"Unevictable": 19476,
|
||||
"Mlocked": 19476,
|
||||
"SwapTotal": 3996668,
|
||||
"SwapFree": 3996668,
|
||||
"Dirty": 152,
|
||||
"Writeback": 0,
|
||||
"AnonPages": 92064,
|
||||
"Mapped": 79464,
|
||||
"Shmem": 1568,
|
||||
"KReclaimable": 188216,
|
||||
"Slab": 288096,
|
||||
"SReclaimable": 188216,
|
||||
"SUnreclaim": 99880,
|
||||
"KernelStack": 5872,
|
||||
"PageTables": 1812,
|
||||
"NFS_Unstable": 0,
|
||||
"Bounce": 0,
|
||||
"WritebackTmp": 0,
|
||||
"CommitLimit": 5995304,
|
||||
"Committed_AS": 445240,
|
||||
"VmallocTotal": 34359738367,
|
||||
"VmallocUsed": 21932,
|
||||
"VmallocChunk": 0,
|
||||
"Percpu": 107520,
|
||||
"HardwareCorrupted": 0,
|
||||
"AnonHugePages": 0,
|
||||
"ShmemHugePages": 0,
|
||||
"ShmemPmdMapped": 0,
|
||||
"FileHugePages": 0,
|
||||
"FilePmdMapped": 0,
|
||||
"HugePages_Total": 0,
|
||||
"HugePages_Free": 0,
|
||||
"HugePages_Rsvd": 0,
|
||||
"HugePages_Surp": 0,
|
||||
"Hugepagesize": 2048,
|
||||
"Hugetlb": 0,
|
||||
"DirectMap4k": 192320,
|
||||
"DirectMap2M": 4001792,
|
||||
"DirectMap1G": 2097152
|
||||
}
|
||||
|
||||
<a id="jc.parsers.proc_meminfo.parse"></a>
|
||||
|
||||
|
@ -5,14 +5,21 @@
|
||||
|
||||
jc - JSON Convert `/proc/modules` command output parser
|
||||
|
||||
<<Short proc_modules description and caveats>>
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat /proc/modules | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/modules | jc --proc-modules
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc', proc_modules_file)
|
||||
|
||||
or
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc_modules', proc_modules_file)
|
||||
|
||||
|
@ -1,25 +1,42 @@
|
||||
"""jc - JSON Convert Proc file output parser
|
||||
|
||||
<<Short procfile description and caveats>>
|
||||
This parser automatically identifies the Proc file and calls the
|
||||
corresponding parser to peform the parsing. The specific parsers can also
|
||||
be called directly, if desired and have a naming convention of
|
||||
`proc-<name>` (cli) or `proc_<name>` (module).
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat /proc/<file> | jc --procfile
|
||||
$ cat /proc/meminfo | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/meminfo | jc --proc-memifno
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('procfile', proc_file)
|
||||
result = jc.parse('proc', proc_file)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"procfile": string,
|
||||
"bar": boolean,
|
||||
"baz": integer
|
||||
}
|
||||
]
|
||||
See the specific Proc parser for the schema:
|
||||
|
||||
$ jc --help --proc-<name>
|
||||
|
||||
For example:
|
||||
|
||||
$ jc --help --proc-meminfo
|
||||
|
||||
Specific Proc file parser names can be found with `jc -hh` or `jc -a`.
|
||||
|
||||
Schemas can also be found online at:
|
||||
|
||||
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_<name>
|
||||
|
||||
For example:
|
||||
|
||||
https://kellyjonbrazil.github.io/jc/docs/parsers/proc_meminfo
|
||||
|
||||
Examples:
|
||||
|
||||
@ -139,7 +156,7 @@ def parse(
|
||||
ioports_p: 'proc_ioports',
|
||||
loadavg_p: 'proc_loadavg',
|
||||
locks_p: 'proc_locks',
|
||||
meminfo_p: 'proc_meminfo', #######
|
||||
meminfo_p: 'proc_meminfo',
|
||||
modules_p: 'proc_modules',
|
||||
mtrr_p: 'proc_mtrr',
|
||||
pagetypeinfo_p: 'proc_pagetypeinfo',
|
||||
|
@ -4,28 +4,84 @@ Usage (cli):
|
||||
|
||||
$ cat /proc/meminfo | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/meminfo | jc --proc-meminfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc', proc_meminfo_file)
|
||||
|
||||
or
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc_meminfo', proc_meminfo_file)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"foo": string,
|
||||
"bar": boolean,
|
||||
"baz": integer
|
||||
}
|
||||
]
|
||||
All values are integers.
|
||||
|
||||
{
|
||||
<keyName> integer
|
||||
}
|
||||
|
||||
Examples:
|
||||
|
||||
$ foo | jc --foo -p
|
||||
[]
|
||||
|
||||
$ foo | jc --foo -p -r
|
||||
[]
|
||||
$ cat /proc/meminfo | jc --proc -p
|
||||
{
|
||||
"MemTotal": 3997272,
|
||||
"MemFree": 2760316,
|
||||
"MemAvailable": 3386876,
|
||||
"Buffers": 40452,
|
||||
"Cached": 684856,
|
||||
"SwapCached": 0,
|
||||
"Active": 475816,
|
||||
"Inactive": 322064,
|
||||
"Active(anon)": 70216,
|
||||
"Inactive(anon)": 148,
|
||||
"Active(file)": 405600,
|
||||
"Inactive(file)": 321916,
|
||||
"Unevictable": 19476,
|
||||
"Mlocked": 19476,
|
||||
"SwapTotal": 3996668,
|
||||
"SwapFree": 3996668,
|
||||
"Dirty": 152,
|
||||
"Writeback": 0,
|
||||
"AnonPages": 92064,
|
||||
"Mapped": 79464,
|
||||
"Shmem": 1568,
|
||||
"KReclaimable": 188216,
|
||||
"Slab": 288096,
|
||||
"SReclaimable": 188216,
|
||||
"SUnreclaim": 99880,
|
||||
"KernelStack": 5872,
|
||||
"PageTables": 1812,
|
||||
"NFS_Unstable": 0,
|
||||
"Bounce": 0,
|
||||
"WritebackTmp": 0,
|
||||
"CommitLimit": 5995304,
|
||||
"Committed_AS": 445240,
|
||||
"VmallocTotal": 34359738367,
|
||||
"VmallocUsed": 21932,
|
||||
"VmallocChunk": 0,
|
||||
"Percpu": 107520,
|
||||
"HardwareCorrupted": 0,
|
||||
"AnonHugePages": 0,
|
||||
"ShmemHugePages": 0,
|
||||
"ShmemPmdMapped": 0,
|
||||
"FileHugePages": 0,
|
||||
"FilePmdMapped": 0,
|
||||
"HugePages_Total": 0,
|
||||
"HugePages_Free": 0,
|
||||
"HugePages_Rsvd": 0,
|
||||
"HugePages_Surp": 0,
|
||||
"Hugepagesize": 2048,
|
||||
"Hugetlb": 0,
|
||||
"DirectMap4k": 192320,
|
||||
"DirectMap2M": 4001792,
|
||||
"DirectMap1G": 2097152
|
||||
}
|
||||
"""
|
||||
from typing import Dict
|
||||
import jc.utils
|
||||
|
@ -1,13 +1,20 @@
|
||||
"""jc - JSON Convert `/proc/modules` command output parser
|
||||
|
||||
<<Short proc_modules description and caveats>>
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat /proc/modules | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/modules | jc --proc-modules
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc', proc_modules_file)
|
||||
|
||||
or
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc_modules', proc_modules_file)
|
||||
|
||||
|
Reference in New Issue
Block a user