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
|
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):
|
Usage (cli):
|
||||||
|
|
||||||
$ cat /proc/<file> | jc --procfile
|
$ cat /proc/meminfo | jc --proc
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ cat /proc/meminfo | jc --proc-memifno
|
||||||
|
|
||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
result = jc.parse('procfile', proc_file)
|
result = jc.parse('proc', proc_file)
|
||||||
|
|
||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
[
|
See the specific Proc parser for the schema:
|
||||||
{
|
|
||||||
"procfile": string,
|
$ jc --help --proc-<name>
|
||||||
"bar": boolean,
|
|
||||||
"baz": integer
|
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:
|
Examples:
|
||||||
|
|
||||||
|
@ -9,28 +9,84 @@ Usage (cli):
|
|||||||
|
|
||||||
$ cat /proc/meminfo | jc --proc
|
$ cat /proc/meminfo | jc --proc
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ cat /proc/meminfo | jc --proc-meminfo
|
||||||
|
|
||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
|
import jc
|
||||||
|
result = jc.parse('proc', proc_meminfo_file)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
result = jc.parse('proc_meminfo', proc_meminfo_file)
|
result = jc.parse('proc_meminfo', proc_meminfo_file)
|
||||||
|
|
||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
[
|
All values are integers.
|
||||||
|
|
||||||
{
|
{
|
||||||
"foo": string,
|
<keyName> integer
|
||||||
"bar": boolean,
|
|
||||||
"baz": integer
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ foo | jc --foo -p
|
$ cat /proc/meminfo | jc --proc -p
|
||||||
[]
|
{
|
||||||
|
"MemTotal": 3997272,
|
||||||
$ foo | jc --foo -p -r
|
"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>
|
<a id="jc.parsers.proc_meminfo.parse"></a>
|
||||||
|
|
||||||
|
@ -5,14 +5,21 @@
|
|||||||
|
|
||||||
jc - JSON Convert `/proc/modules` command output parser
|
jc - JSON Convert `/proc/modules` command output parser
|
||||||
|
|
||||||
<<Short proc_modules description and caveats>>
|
|
||||||
|
|
||||||
Usage (cli):
|
Usage (cli):
|
||||||
|
|
||||||
$ cat /proc/modules | jc --proc
|
$ cat /proc/modules | jc --proc
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ cat /proc/modules | jc --proc-modules
|
||||||
|
|
||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
|
import jc
|
||||||
|
result = jc.parse('proc', proc_modules_file)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
result = jc.parse('proc_modules', proc_modules_file)
|
result = jc.parse('proc_modules', proc_modules_file)
|
||||||
|
|
||||||
|
@ -1,25 +1,42 @@
|
|||||||
"""jc - JSON Convert Proc file output parser
|
"""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):
|
Usage (cli):
|
||||||
|
|
||||||
$ cat /proc/<file> | jc --procfile
|
$ cat /proc/meminfo | jc --proc
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ cat /proc/meminfo | jc --proc-memifno
|
||||||
|
|
||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
result = jc.parse('procfile', proc_file)
|
result = jc.parse('proc', proc_file)
|
||||||
|
|
||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
[
|
See the specific Proc parser for the schema:
|
||||||
{
|
|
||||||
"procfile": string,
|
$ jc --help --proc-<name>
|
||||||
"bar": boolean,
|
|
||||||
"baz": integer
|
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:
|
Examples:
|
||||||
|
|
||||||
@ -139,7 +156,7 @@ def parse(
|
|||||||
ioports_p: 'proc_ioports',
|
ioports_p: 'proc_ioports',
|
||||||
loadavg_p: 'proc_loadavg',
|
loadavg_p: 'proc_loadavg',
|
||||||
locks_p: 'proc_locks',
|
locks_p: 'proc_locks',
|
||||||
meminfo_p: 'proc_meminfo', #######
|
meminfo_p: 'proc_meminfo',
|
||||||
modules_p: 'proc_modules',
|
modules_p: 'proc_modules',
|
||||||
mtrr_p: 'proc_mtrr',
|
mtrr_p: 'proc_mtrr',
|
||||||
pagetypeinfo_p: 'proc_pagetypeinfo',
|
pagetypeinfo_p: 'proc_pagetypeinfo',
|
||||||
|
@ -4,28 +4,84 @@ Usage (cli):
|
|||||||
|
|
||||||
$ cat /proc/meminfo | jc --proc
|
$ cat /proc/meminfo | jc --proc
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ cat /proc/meminfo | jc --proc-meminfo
|
||||||
|
|
||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
|
import jc
|
||||||
|
result = jc.parse('proc', proc_meminfo_file)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
result = jc.parse('proc_meminfo', proc_meminfo_file)
|
result = jc.parse('proc_meminfo', proc_meminfo_file)
|
||||||
|
|
||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
[
|
All values are integers.
|
||||||
|
|
||||||
{
|
{
|
||||||
"foo": string,
|
<keyName> integer
|
||||||
"bar": boolean,
|
|
||||||
"baz": integer
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ foo | jc --foo -p
|
$ cat /proc/meminfo | jc --proc -p
|
||||||
[]
|
{
|
||||||
|
"MemTotal": 3997272,
|
||||||
$ foo | jc --foo -p -r
|
"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
|
from typing import Dict
|
||||||
import jc.utils
|
import jc.utils
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
"""jc - JSON Convert `/proc/modules` command output parser
|
"""jc - JSON Convert `/proc/modules` command output parser
|
||||||
|
|
||||||
<<Short proc_modules description and caveats>>
|
|
||||||
|
|
||||||
Usage (cli):
|
Usage (cli):
|
||||||
|
|
||||||
$ cat /proc/modules | jc --proc
|
$ cat /proc/modules | jc --proc
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ cat /proc/modules | jc --proc-modules
|
||||||
|
|
||||||
Usage (module):
|
Usage (module):
|
||||||
|
|
||||||
|
import jc
|
||||||
|
result = jc.parse('proc', proc_modules_file)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
import jc
|
import jc
|
||||||
result = jc.parse('proc_modules', proc_modules_file)
|
result = jc.parse('proc_modules', proc_modules_file)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user