1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

ignore re-printed header rows in output

This commit is contained in:
Kelly Brazil
2021-09-24 16:27:11 -07:00
parent 48cdabc3b0
commit 4aa7d81e11
3 changed files with 50 additions and 2 deletions

View File

@ -209,6 +209,9 @@ def parse(data, raw=False, quiet=False):
# skip header rows # skip header rows
if (procs or disk) and (line.startswith('procs') or line.startswith('disk')):
continue
if 'swpd' in line and 'free' in line and 'buff' in line and 'cache' in line: if 'swpd' in line and 'free' in line and 'buff' in line and 'cache' in line:
buff_cache = True buff_cache = True
tz = line.strip().split()[-1] if tstamp else None tz = line.strip().split()[-1] if tstamp else None

View File

@ -169,12 +169,15 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
# skip header rows # skip header rows
if 'swpd' in line and 'free' in line and 'buff' in line and 'cache' in line: if (procs or disk) and (line.startswith('procs') or line.startswith('disk')):
continue
if 'swpd' in line and 'free' in line and 'buff' in line and 'cache' in line:
buff_cache = True buff_cache = True
tz = line.strip().split()[-1] if tstamp else None tz = line.strip().split()[-1] if tstamp else None
continue continue
if 'swpd' in line and 'free' in line and 'inact' in line and 'active' in line: if 'swpd' in line and 'free' in line and 'inact' in line and 'active' in line:
buff_cache = False buff_cache = False
tz = line.strip().split()[-1] if tstamp else None tz = line.strip().split()[-1] if tstamp else None
continue continue

View File

@ -0,0 +1,42 @@
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 524 763388 147216 819640 0 0 288 108 195 2509 4 3 93 0 0
0 0 524 763388 147216 819640 0 0 0 0 57 96 0 1 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 85 198 0 1 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 62 122 0 0 100 0 0
0 0 524 763388 147216 819640 0 0 0 0 55 113 0 0 100 0 0
0 0 524 763388 147216 819640 0 0 0 0 103 242 1 1 98 0 0
0 0 524 763388 147216 819640 0 0 0 0 50 96 0 0 100 0 0
0 0 524 763388 147216 819640 0 0 0 0 67 119 0 1 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 102 247 0 1 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 68 119 1 0 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 55 105 0 1 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 98 227 0 1 99 0 0
0 0 524 763388 147216 819640 0 0 0 0 56 108 0 0 100 0 0
0 0 524 763388 147216 819640 0 0 0 0 58 106 0 0 100 0 0
0 0 524 763388 147216 819640 0 0 0 0 98 235 0 2 98 0 0
0 0 524 763388 147224 819640 0 0 0 24 71 134 1 0 99 0 0
0 0 524 763388 147224 819640 0 0 0 0 70 126 0 2 98 0 0
0 0 524 763388 147224 819640 0 0 0 0 98 214 1 0 99 0 0
0 0 524 763388 147224 819640 0 0 0 0 55 107 0 1 99 0 0
0 0 524 763388 147224 819640 0 0 0 0 63 114 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 96 222 1 1 98 0 0
0 0 524 763388 147224 819640 0 0 0 0 59 102 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 57 106 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 95 217 0 2 98 0 0
0 0 524 763388 147224 819640 0 0 0 0 80 175 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 58 102 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 84 209 1 1 98 0 0
0 0 524 763388 147224 819640 0 0 0 0 59 105 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 56 100 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 100 225 0 1 99 0 0
0 0 524 763388 147224 819640 0 0 0 0 52 98 0 1 99 0 0
0 0 524 763388 147224 819640 0 0 0 0 61 104 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 106 225 0 2 98 0 0
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 524 763388 147224 819640 0 0 0 0 69 120 0 0 100 0 0
0 0 524 763388 147224 819640 0 0 0 0 94 122 0 0 100 0 0
1 0 524 763388 147224 819640 0 0 0 0 111 228 1 1 98 0 0
0 0 524 763388 147224 819640 0 0 0 0 98 114 0 0 100 0 0