zsh completions: minor tweaks
[pcp.git] / qa / common.filter
blobe8573256cfecca358f236d6f84e798da8299384c
1 # standard PCP QA test output filters
3 # Copyright (c) 1997-2002 Silicon Graphics, Inc.  All Rights Reserved.
6 # pmcd log file
8 _filter_pmcd_log()
10     $PCP_AWK_PROG '
11 /^active/                               { state = 1 }
12 /_pmRead: timeout/ && state == 0        { next }
13 /pduread: timeout/ && state == 0        { next }
14 /assuming PCP 1.x PMDA/ && state == 0   { next }
15 /ok .* INADDR_ANY/                      { $2 = "FD" }
16 /ok .*pmcd.socket$/                     { $2 = "FD"; $4 = "UNIX_DOMAIN_SOCKET" }
17                                         { print }' \
18     | sed \
19         -e '/^__pmGetAddrInfo/d' \
20         -e '/:__pmHostEntFree(/d' \
21         -e '/^__pmHostEntGetName/d' \
22         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/' \
23         -e 's/^\[[A-Z].. [A-Z]..  *[0-9][0-9]* ..:..:..]/[DATE]/' \
24         -e '/pcp([0-9][0-9]*)/s//pcp(PID)/' \
25         -e '/pcp\[[0-9][0-9]*]/s//pcp[PID]/' \
26         -e '/pmcd([0-9][0-9]*)/s//pmcd(PID)/' \
27         -e '/^\(Log for pmcd on\) [^ ][^ ]*/s//\1 HOST/' \
28         -e '/^pmcd: PID/s/=.*/= PID/' \
29         -e '/started PMDA/s/=.*/= PID/' \
30         -e 's/ \[0x[0-9a-f]*]//' \
31         -e '/^->/s/->[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/->        /' \
32         -e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;" \
33         -e '/get_scsi_sn:/d' \
34         -e '/refresh_proc_scsi/d' \
35         -e '/Info: CleanupAgent/d' \
36         -e '/using .* kmem interface/d' \
37         -e '/pmcd_wait failed: exit status:/d' \
38         -e 's/: host-based access control/: access control/g' \
39         -e '/^User access list empty: user-based access control turned off$/d' \
40         -e '/^Group access list empty: group-based access control turned off$/d' \
41         -e '/pmcd caught SIG.* from pid=/s/=[0-9][0-9]*/=N/g' \
42         -e '/^linux.*pmda_linux/{
43 s/linux/[OS] /
44 s/60/??/
45 s/ i:[0-9] / i:? /
46 s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
47 s/entry=[^ ]*/entry=[OS]_init/
48 }' \
49         -e '/^linux.*pmdalinux/{
50 s/linux/[OS] /
51 s/60.*bin/??                 N dso/
52 s/ pipe / i:?  /
53 s/cmd=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX entry=[OS]_init/
54 }' \
55         -e '/^darwin.*pmda_darwin/{
56 s/darwin/[OS]  /
57 s/78/??/
58 s/ i:[0-9] / i:? /
59 s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
60 s/entry=[^ ]*/entry=[OS]_init/
61 }' \
62         -e '/^freebsd.*pmda_freebsd/{
63 s/freebsd/[OS]   /
64 s/85/??/
65 s/ i:[0-9] / i:? /
66 s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
67 s/entry=[^ ]*/entry=[OS]_init/
68 }' \
69         -e '/^solaris.*pmda_solaris/{
70 s/solaris/[OS]   /
71 s/75/??/
72 s/ i:[0-9] / i:? /
73 s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
74 s/entry=[^ ]*/entry=[OS]_init/
75 }' \
76         -e "/^pmcd.*pmda_pmcd/s/lib=.*pmda_pmcd.$DSO_SUFFIX/lib=...pmda_pmcd.\$DSO_SUFFIX/" \
77         -e '/Warning:.* linux .* Direct mapping/d' \
78         -e '/NOTICE: using \/proc\/partitions for disk I\/O stats/d' \
79         -e '/NOTICE: using \/proc\/diskstats for disk I\/O stats/d' \
80         -e '/NOTICE: detected slabinfo version/d' \
81         -e '/Warning: xfs metrics are not available/d' \
82         -e '/Warning: cihb_getstats: info+recv init: /d' \
83         -e '/Warning: cihb_getstats: V0 api probe: Not supported/d' \
84         -e '/Warning: cihb_getstats: V0 api probe: Invalid argument/d' \
85         -e '/Warning: cihb_getstats: V[01] api probe: Resource temporarily unavailable/d' \
86         -e '/Warning: cihb_getstats: no stats available in this kernel/d' \
87         -e '/Warning: cihb_getstats: no support for V0 or V1 api/d' \
88         -e '/Warning: common_init: NON-CXFS Kernel: disabling metrics/d' \
89         -e '/Warning: nfsd_init: direct map disabled/d' \
90         -e '/Warning: cxfs_.*: NON-CXFS Kernel: disabling metrics/d' \
91         -e '/Warning: cxfs_.*: NON-CXFS or incompatible Kernel: disabling metrics/d' \
92         -e '/Warning: cxfs_common_init: direct map disabled/d' \
93         -e '/Warning: cxfs_server_init: direct map disabled/d' \
94         -e '/Warning: kmeminit: cannot change to group "sys": Operation not permitted/d' \
95         -e '/Warning: cms_getstats: could not retrieve stats version Not supported/d' \
96         -e '/Warning: cms_getstats: could not retrieve stats version Invalid argument/d' \
97         -e '/Warning: cms_reload: No cms instrumentation in this kernel:/d' \
98         -e '/Error: Cannot open stat device \/hw\/tape/d' \
99         -e '/Note: computed HZ=/d' \
100         -e '/Warning: Symbol address mismatch between System.map/d' \
101         -e '/Warning: mismatch for .* between System.map/d' \
102         -e '/Warning: only reported first .* mismatches between System.map/d' \
103         -e '/Warning: proc.psinfo.wchan_s symbol names may not be accurate!/d' \
104         -e '/Warning: Valid System.map file not found!/d' \
105         -e '/Warning: proc.psinfo.wchan_s symbol names cannot be derived!/d' \
106         -e '/Warning: Addresses will be returned for proc.psinfo.wchan_s instead!/d' \
107         -e '/NOTICE: using ".*" for kernel symbols map/d' \
108         -e '/NOTICE: using kernel 2\.4 or earlier CPU types/d' \
109         -e '/NOTICE: using kernel 2\.6\.0 to 2\.6\.4 CPU types/d' \
110         -e '/NOTICE: using 64 bit CPU time types/d' \
111     | sed \
112         -e '/Connected from.*Operations denied/{
114 : more
116 s/^..*\n//
117 t more
118 }' \
119     | $PCP_AWK_PROG '
120 /^active agent/         { state = 1 }
121 state == 2 && NF == 0   { state = 0 }
122 state == 2              { print base,$0; next }
123                         { print NR,$0 }
124 state == 1 && /^=====/  { state = 2; base = NR+1 }' \
125     | LC_COLLATE=POSIX _POSIX2_VERSION=0 sort +0n -1 +2n -3 \
126     | sed -e 's/^[^ ]* //'
129 # pmlogger log file
131 _filter_pmlogger_log()
133     sed \
134         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/' \
135         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/DATE/' \
136         -e 's/pmlogger([1-9][0-9]*) Error:/pmlogger(PID) Error:/' \
137         -e '/^pmlogger: Signalled (signal=[1-9][0-9]*).*/d' \
138         -e '/^preprocessor cmd: /d' \
139         -e '/^\(Log for pmlogger on\) [^ ][^ ]*/s//\1 HOST/' \
140         -e '/^Starting logger/s/host ".*/host "HOST"/' \
141         -e '/^Archive basename: /s/:.*/: ARCHIVE/' \
142         -e '/^pmlc request/s/ from .*:/ from HOST:/'
145 # pmie log file
147 _filter_pmie_log()
149     sed \
150         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]/DATE/' \
151         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/TIMESTAMP/' \
152         -e '/^\(Log for pmie on\) [^ ][^ ]*/s//\1 HOST/' \
153         -e 's/^pmie: PID = [0-9][0-9]*, via .*/pmie: PID,HOST/g' \
154         -e 's/^pmie: PID = [0-9][0-9]*, default host = .*/pmie: PID,HOST/g' \
155         -e '/pmie(.*) Info: pmie caught SIGINT or SIGTERM/d' \
156         -e '/pmie([0-9][0-9]*)/s//pmie(PID)/' \
157         -e '/^pmie: /s/- on line/- near line/'
159 _show_pmie_exit()
161     fgrep "evaluator exiting" | \
162         sed -e 's/.* Info: evaluator exiting/pmie: note - evaluator exiting/g'
164 _show_pmie_errors()
166     egrep -v '^Log finished |^Log for pmie on ' \
167         | $PCP_AWK_PROG '{ if (NF > 0) print }' \
168         | sed \
169             -e 's/.*Info: evaluator exiting/pmie: note - evaluator exiting/g' \
170             -e '/^pmie: /s/- on line/- near line/'
173 # pmdumplog -a
175 _filter_pmdumplog()
177     sed \
178         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/' \
179         -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/' \
180         -e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*/TIMESTAMP/' \
181         -e '/^\(Performance metrics from host\) [^ ][^ ]*/s//\1 HOST/' \
182         -e '/^archive:/s/\(  *\).*/\1ARCHIVE/' \
183         -e '/^host:/s/\(  *\).*/\1HOST/'
186 # pmdumptext
188 _filter_pmdumptext()
190     sed \
191         -e 's/^[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/DATE/'
194 # some common -D diagnostics
196 _filter_dbg()
198     sed \
199         -e '/^__pmLogSetTime(/s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g' \
200         -e '/^__pmLogRead:/s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
203 # cull the optional PMDA
205 _filter_optional_pmdas()
207     sed \
208         -e '/pmdaroot/d' \
209         -e '/pmdaaconex/d' \
210         -e '/pmdaapache/d' \
211         -e '/pmdaarray/d' \
212         -e '/pmdaash/d' \
213         -e '/pmdabash/d' \
214         -e '/pmdabonding/d' \
215         -e '/pmdabrocade/d' \
216         -e '/pmdacisco/d' \
217         -e '/pmdadbping/d' \
218         -e '/pmdadm/d' \
219         -e '/pmdadmf/d' \
220         -e '/pmdads389/d' \
221         -e '/pmda_environ/d' \
222         -e '/pmdaelasticsearch/d' \
223         -e '/pmdaespping/d' \
224         -e '/pmdagfs2/d' \
225         -e '/pmdagluster/d' \
226         -e '/pmdahippi/d' \
227         -e '/pmdahotproc/d' \
228         -e '/pmdaib/d' \
229         -e '/pmdainfiniband/d' \
230         -e '/pmdainfmx7/d' \
231         -e '/pmdainfmxping/d' \
232         -e '/pmdajbd2/d' \
233         -e '/pmdajson/d' \
234         -e '/pmdajstat/d' \
235         -e '/pmdakvm/d' \
236         -e '/pmdalab/d' \
237         -e '/pmdalibvirt/d' \
238         -e '/pmdalinux/d' \
239         -e '/pmdalogger/d' \
240         -e '/pmdalmsensors/d' \
241         -e '/pmdalockstat/d' \
242         -e '/pmdalsf/d' \
243         -e '/pmdamaillog/d' \
244         -e '/pmdamailq/d' \
245         -e '/pmdamemcache/d' \
246         -e '/pmdammv/d' \
247         -e '/pmdamounts/d' \
248         -e '/pmdampi/d' \
249         -e '/pmdamysql/d' \
250         -e '/pmdanamed/d' \
251         -e '/pmdanasavg/d' \
252         -e '/pmdanetfilter/d' \
253         -e '/pmdanetprobe/d' \
254         -e '/pmdanews/d' \
255         -e '/pmdanfsclient/d' \
256         -e '/pmdanginx/d' \
257         -e '/pmdanvidia/d' \
258         -e '/pmdaperfevent/d' \
259         -e '/pmdapipe/d' \
260         -e '/pmdaoracle/d' \
261         -e '/pmdaoraping/d' \
262         -e '/pmdapapi/d' \
263         -e '/pmdapdns/d' \
264         -e '/pmdapmcd/d' \
265         -e '/pmdaproc/d' \
266         -e '/pmdaprocess/d' \
267         -e '/pmdarpm/d' \
268         -e '/pmdarsyslog/d' \
269         -e '/pmdaroomtemp/d' \
270         -e '/pmdasamba/d' \
271         -e '/pmdasendmail/d' \
272         -e '/pmdashping/d' \
273         -e '/pmda_simple/d' \
274         -e '/pmdasimple/d' \
275         -e '/pmdasnia/d' \
276         -e '/pmdasnmp/d' \
277         -e '/pmdassping/d' \
278         -e '/pmdasummary/d' \
279         -e '/pmdasystemd/d' \
280         -e '/pmdasystemtap/d' \
281         -e '/pmdasyb10/d' \
282         -e '/pmdasybping/d' \
283         -e '/pmdatrace/d' \
284         -e '/pmdatrivial/d' \
285         -e '/pmdatxmon/d' \
286         -e '/pmdavmware/d' \
287         -e '/pmdawatch/d' \
288         -e '/pmdaweblog/d' \
289         -e '/pmdawebping/d' \
290         -e '/pmdaxfs/d' \
291         -e '/pmdaxvm/d' \
292         -e '/pmdazimbra/d' \
293         -e '/pmdazswap/d' \
297 # cull the optional top-level PMNS entries
299 _filter_top_pmns()
301     sed \
302         -e 's/$/ /' \
303         -e '/^    aim /d' \
304         -e '/^    array /d' \
305         -e '/^    ash /d' \
306         -e '/^    bash /d' \
307         -e '/^    bonding /d' \
308         -e '/^    brocade /d' \
309         -e '/^    broken /d' \
310         -e '/^    cgroup /d' \
311         -e '/^    containers /d' \
312         -e '/^    cisco /d' \
313         -e '/^    datatape /d' \
314         -e '/^    dbping /d' \
315         -e '/^    dmcache /d' \
316         -e '/^    dmthin /d' \
317         -e '/^    dmf /d' \
318         -e '/^    ds389 /d' \
319         -e '/^    elasticsearch /d' \
320         -e '/^    environ /d' \
321         -e '/^    gfs2 /d' \
322         -e '/^    gluster /d' \
323         -e '/^    hippi /d' \
324         -e '/^    hotproc /d' \
325         -e '/^    hw /d' \
326         -e '/^    infmxping /d' \
327         -e '/^    informix /d' \
328         -e '/^    jbd2 /d' \
329         -e '/^    json /d' \
330         -e '/^    jstat /d' \
331         -e '/^    kvm /d' \
332         -e '/^    lab /d' \
333         -e '/^    libvirt /d' \
334         -e '/^    lmsensors /d' \
335         -e '/^    logger /d' \
336         -e '/^    lsf /d' \
337         -e '/^    mailq /d' \
338         -e '/^    memcache /d' \
339         -e '/^    mmv /d' \
340         -e '/^    mpi /d' \
341         -e '/^    mysql /d' \
342         -e '/^    named /d' \
343         -e '/^    netfilter /d' \
344         -e '/^    netprobe /d' \
345         -e '/^    news /d' \
346         -e '/^    nfsclient /d' \
347         -e '/^    nginx /d' \
348         -e '/^    nvidia /d' \
349         -e '/^    papi /d' \
350         -e '/^    perfevent /d' \
351         -e '/^    pipe /d' \
352         -e '/^    oracle /d' \
353         -e '/^    oraping /d' \
354         -e '/^    pdns /d' \
355         -e '/^    postfix /d' \
356         -e '/^    postgresql /d' \
357         -e '/^    proc /d' \
358         -e '/^    rpm /d' \
359         -e '/^    rsyslog /d' \
360         -e '/^    samba /d' \
361         -e '/^    sendmail /d' \
362         -e '/^    shping /d' \
363         -e '/^    simple /d' \
364         -e '/^    snmp /d' \
365         -e '/^    ssping /d' \
366         -e '/^    espping /d' \
367         -e '/^    summary /d' \
368         -e '/^    sybase /d' \
369         -e '/^    sybping /d' \
370         -e '/^    sysother /d' \
371         -e '/^    systemd /d' \
372         -e '/^    systemtap /d' \
373         -e '/^    trace /d' \
374         -e '/^    trivial /d' \
375         -e '/^    txmon /d' \
376         -e '/^    vmware /d' \
377         -e '/^    web /d' \
378         -e '/^    webping /d' \
379         -e '/^    zimbra /d' \
380         -e '/^    zswap /d' \
381         -e 's/ $//'
385 # handle pmDumpResult() output
387 _filter_dumpresult()
389     sed \
390         -e '/pmResult/s/ .* numpmid/ ... numpmid/' \
391         -e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*/TIMESTAMP/' \
392         -e '/value /{
393 s/\(value.*\) 0x[0-9a-f][0-9a-f]*/\1 HEXNUMBER/
394 s/\(value.*\) -*[0-9][0-9]*\.[0-9][0-9]*e[+-]*[0-9][0-9]*/\1 NUMBER/
395 s/\(value.*\) -*[0-9][0-9]*\.[0-9][0-9]*/\1 NUMBER/
396 s/\(value.*\) -*[0-9][0-9]*\.[0-9][0-9]*/\1 NUMBER/
397 s/\(value.*\) -*[0-9][0-9]*e[+-]*[0-9][0-9]*/\1 NUMBER/
398 s/\(value.*\) -*[0-9][0-9]*/\1 NUMBER/
399 s/\(value.*\) \[.*]/\1 AGGREGATE/
400 s/\(value.*\) ".*"/\1 STRING/
401 }' \
402         -e '/inst /{
403 s/inst \[[0-9][0-9]* or "dks..."]/inst [DISK]/
404 s;inst \[[0-9][0-9]* or "/dev/[^"]*"];inst [DISK];
409 _filter_cron_scripts()
411     sed \
412         -e 's/cron\.pmcheck/PMLOGGER.CHECK/g' \
413         -e 's/pmlogger_check/PMLOGGER.CHECK/g' \
414         -e 's/pmlogger\.check/PMLOGGER.CHECK/g' \
415         -e 's/cron\.pmdaily/PMLOGGER.DAILY/g' \
416         -e 's/pmlogger_daily/PMLOGGER.DAILY/g' \
417         -e 's/pmlogger\.daily/PMLOGGER.DAILY/g' \
418         -e 's/cron\.logmerge/PMLOGGER.MERGE/g' \
419         -e 's/cron\.pmlogmerge/PMLOGGER.MERGE/g' \
420         -e 's/pmlogger\.merge/PMLOGGER.MERGE/g' \
421         -e 's/pmlogger_merge/PMLOGGER.MERGE/g' \
422         -e 's/cron\.pmsnap/pmsnap/g'
425 _filter_pcp_start()
427     sed \
428         -e "s;$PCP_LOG_DIR/pmcd/pmcd.log;\$PCP_LOG_DIR/pmcd.log;" \
429         -e "s;$PCP_LOG_DIR/pmcd.log;\$PCP_LOG_DIR/pmcd.log;" \
430         -e "s;$PCP_RC_DIR/pmcd;\$PCP_RC_DIR/pmcd;" \
431         -e "s;$PCP_RC_DIR/pmlogger;\$PCP_RC_DIR/pmlogger;" \
432         -e "s;$PCP_RC_DIR/pcp;\$PCP_RC_DIR/pmcd;" \
433         -e '/$PCP_RC_DIR\/pmcd/{
434 s/ PMCD / pmcd /
435 }' \
436         -e "s;$PCP_BINADM_DIR/pmcd;\$PCP_BINADM_DIR/pmcd;" \
437         -e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;" \
438         -e "s;$PCP_PMLOGGERCONTROL_PATH;\$PCP_PMLOGGERCONTROL_PATH;" \
439         -e "s;$PCP_PMLOGGERCONTROL_PATH.d/local;\$PCP_PMLOGGERCONTROL_PATH;" \
440         -e "s;$PCP_VAR_DIR/;\$PCP_VAR_DIR/;" \
441         -e "s;$PCP_SYSCONF_DIR/;\$PCP_SYSCONF_DIR/;" \
442         -e "s;/usr/etc/pmcd;\$PCP_BINADM_DIR/pmcd;" \
443         -e '/Warning: Forcing PMCD to terminate!/s/PMCD/pmcd/' \
444         -e '/^Starting PCP$/d' \
445         -e 's/^\(Performance Co-Pilot starting .*\.\.\.\) *\(\$PCP_RC_DIR\)/\1\
446 \2/' \
447         -e '/^Performance Co-Pilot/s/\.\.\. *$/.../' \
448         -e '/^Performance Co-Pilot starting/{
449 s/\.\.\.[. ]*done/.../
450 s/\.\.\.[. ]*failed/.../
451 s/Performance Co-Pilot starting PMCD (logfile is [^)]*) .../Starting pmcd ... /
452 s/Performance Co-Pilot starting archive loggers .../Starting pmlogger ... /
453 }' \
454         -e '/^Starting pmcd/{
455 s/\.\.\. \.\.done/... /
456 }' \
457         -e '/^Starting pmlogger/{
458 s/\.\.\. \.\.done/... /
459 }' \
460         -e '/^Performance Co-Pilot installing/s//Installing/' \
461         -e '/^\.[. ]*done$/d' \
462         -e '/^\.[. ]*failed$/d' \
463         -e '/^Waiting for PMCD/{
464 s/PMCD/pmcd/
465 s/\.\.\.[. ]*done/.../
466 s/\.\.\.\.*/.../
467 }' \
468         -e '/^Waiting for pmcd/{
469 s/\.\.\.[. ]*done/.../
470 s/\.\.\.\.*/.../
471 }' \
472         -e 's/^\(Waiting .*\.\.\.\)\(\$PCP_RC_DIR\)/\1\
473 \2/' \
474         -e '/^[         ]*$/d' \
475         -e '/is not a native service, redirecting to .*chkconfig/d' \
476         -e '/^Executing .*chkconfig pm.* --level=5/d' \
477         -e '/Failed to create avahi client: Daemon not running/s/\[.*] .* running//' \
478     | _filter_init_distro
481 _filter_pcp_stop()
483     sed \
484         -e '/Stopping pmlogger .../d' \
485         -e '/^Waiting for PMIE/s/PMIE/pmie/' \
486         -e '/^Waiting for pmie/s/\.\.\.[. ]*done/.../' \
487         -e '/^Waiting for PMCD/{
488 s/\.\.\.[. ]*done/.../
489 s/PMCD/pmcd/
490 s/\.\.\.\.*/.../
491 }' \
492         -e '/^Waiting for pmcd/{
493 s/\.\.\.[. ]*done/.../
494 s/\.\.\.\.*/.../
495 }' \
496         -e '/Warning: Forcing PMCD to terminate!/s/PMCD/pmcd/' \
497         -e '/^Waiting for pmie/s/\.\.\. *$/.../' \
498         -e '/^Performance Co-Pilot/s/\.\.\. *$/.../' \
499         -e '/^\.[. ]*done$/d' \
500         -e '/is not a native service, redirecting to .*chkconfig/d' \
501         -e '/^Executing .*chkconfig pm.* --level=5/d' \
502         -e "s;$PCP_RC_DIR/pmcd;\$PCP_RC_DIR/pmcd;" \
503         -e "s;$PCP_RC_DIR/pmlogger;\$PCP_RC_DIR/pmlogger;" \
504     | _filter_init_distro
507 _filterall_pcp_start()
509     _filter_pcp_start \
510     | sed \
511         -e '/rebuilding PMNS/d' \
512         -e '/installing /d'
515 _filter_pmie_start()
517     sed \
518         -e '/^Waiting for PMIE/s/PMIE/pmie/' \
519         -e '/^Waiting for pmie process(es) to terminate/d' \
520         -e "s;$PCP_RC_DIR/pmie;\$PCP_RC_DIR/pmie;g" \
521         -e '/(pmie) is disabled/d' \
522         -e '/To enable/d' \
523         -e '/update-rc.d -f pmie remove/d' \
524         -e '/update-rc.d pmie defaults/d' \
525         -e '/\/sbin\/chkconfig pmie on/d' \
526         -e '/\/usr\/sbin\/sysv-rc-conf pmie on/d' \
527         -e '/update-rc.d -f pmie defaults/d' \
528         -e '/ln -sf \.\.\/init.d\/pmie \/etc\/rc\.d\//d' \
529         -e '/systemctl enable pmie.service/d' \
530         -e "s;$PCP_PMIECONTROL_PATH;\$PCP_PMIECONTROL_PATH;" \
531         -e '/^\.\.*done$/d' \
532         -e "s;/private/tmp;/tmp;g" \
533         -e '/^$/d' \
534     | _filter_init_distro
537 _filter_pmie_stop()
539     sed \
540         -e "s;$PCP_RC_DIR/pmie;\$PCP_RC_DIR/pmie;g" \
541         -e '/^Waiting for PMIE/s/PMIE/pmie/' \
542         -e '/^Waiting for pmie/s/\.\.\.[. ]*done/.../' \
543         -e '/^Waiting for pmie/s/\.\.\. *$/.../' \
544     | _filter_init_distro
547 _filter_pmproxy_start()
549     sed \
550         -e '/^Waiting for pmproxy to terminate/d' \
551         -e "s;$PCP_RC_DIR/pmproxy;\$PCP_RC_DIR/pmproxy;g" \
552         -e '/(pmproxy) is disabled/d' \
553         -e '/To enable/d' \
554         -e '/update-rc.d -f pmproxy remove/d' \
555         -e '/update-rc.d pmproxy defaults/d' \
556         -e '/\/sbin\/chkconfig pmpmroxy on/d' \
557         -e '/\/usr\/sbin\/sysv-rc-conf pmproxy on/d' \
558         -e '/update-rc.d -f pmproxy defaults/d' \
559         -e '/ln -sf \.\.\/init.d\/pmproxy \/etc\/rc\.d\//d' \
560         -e '/systemctl enable pmproxy.service/d' \
561         -e '/^\.\.*done$/d' \
562         -e "s;/private/tmp;/tmp;g" \
563         -e '/^$/d' \
564     | _filter_init_distro
567 _filter_pmproxy_stop()
569     sed \
570         -e "s;$PCP_RC_DIR/pmproxy;\$PCP_RC_DIR/pmproxy;g" \
571         -e '/^Waiting for pmproxy/s/\.\.\.[. ]*done/.../' \
572         -e '/^Waiting for pmproxy/s/\.\.\. *$/.../' \
573     | _filter_init_distro
576 _sort_pmdumplog_d()
578     cat >$tmp.tmp
579     egrep '(^Descriptions)|(^$)' $tmp.tmp
580     $PCP_AWK_PROG <$tmp.tmp '
581 /^Descriptions/         { next }
582 NF == 0                 { next }
583 $1 == "PMID:"           { printf "%s|",$0; next }
584 $1 == "Data"            { printf "%s|",$0; next }
585                         { print }' \
586     | LC_COLLATE=POSIX _POSIX2_VERSION=0 sort -t'(' +1 -2 \
587     | tr '|' '\012' \
588     | src/hex2nbo
591 _filter_pmda_install()
593     sed \
594         -e 's/.* \(hash table entries\)/  NNN \1/' \
595         -e 's/.* \(non-leaf nodes\)/  NNN \1/' \
596         -e 's/.* \(leaf nodes\)/  NNN \1/' \
597         -e 's/.* \(bytes of symbol table\)/  NNN \1/' \
598         -e '/^Installing .mchart view*/d' \
599         -e '/Terminate PMDA/,/Updating the PMCD/c\
600 Terminate PMDA if already installed ...\
601 [...install files, make output...]\
602 Updating the PMCD control file, and notifying PMCD ...' \
603         -e '/Installing files/,/Updating the Performance Metrics/c\
604 Installing files ...\
605 [...install files, make output...]\
606 Updating the Performance Metrics Name Space (PMNS) ...'
609 _filter_pmda_remove()
611     _filter_pmda_install |
612     sed \
613         -e '/Removing files/d' \
614         -e '/Updating the PMCD control file/c\
615 Updating the PMCD control file, and notifying PMCD ...\
616 [...removing files...]'
619 # Make sure that quotes which span multiple lines get appended onto
620 # the one line, separated by \\n (instead of newlines).
621 # This allows for easier sed processing.
622 # BUG: problem handling a single " which isn't supposed to match,
623 #      say in a comment or pattern search
624 # Partial solution: filter out: /"/
626 _quote_filter()
628    sed -e 's#/"/#/dbl-quote/#g' |\
629    $PCP_AWK_PROG '
630         /"/ {  # unfinished quote - start or end
631             n = split($0, arr, /"/)
632             if ( (n % 2) == 0) { # odd number of quotes
633                     line[line_num++] = $0
634                     if (inquote) {      
635                         inquote = 0
636                         for(i=0;i<=line_num;i++){
637                             printf("%s\\n", line[i])
638                         }       
639                         printf("\n")
640                         line_num = 0
641                     }
642                     else {
643                         inquote = 1
644                     }
645                     next
646             }
647             else {
648                print; next
649             }
650         }
651         inquote == 1 {
652             line[line_num++] = $0
653             next
654         }
655         {print}
656     '
660 # concat lines between inst/value pairs
661 #    inst ... value
662 #    inst ... value XXXX
663 #        YYYYYYY
664 #    inst ... value
665 # becomes
666 #    inst ... value
667 #    inst ... value XXXX\\nYYYYYYY
668 #    inst ... value
670 _inst_value_filter()
672    $PCP_AWK_PROG '
673         function print_line() {
674             if (line_num > 0) {
675                 for(i=0;i<line_num-1;i++){
676                     printf("%s\\n", line[i])
677                 }       
678                 printf("%s", line[line_num-1]);
679                 printf("\n")
680                 line_num = 0
681             }
682         }
683 $1 == "inst" && $2 ~ /^\[/ {
684             print_line()
685             line[line_num++] = $0
686             next
687         }
688         # terminate run of inst...value ".... extending over multiple
689         # lines with a line ending in a ", or a line introducing new
690         # proc metric 
691         /"$/ && line_num > 0 {
692             line[line_num++] = $0
693             print_line()
694             next
695         }
696         ( (/proc\./ && /numval/ && /valfmt/) || /^proc\./ ) \
697            && line_num > 0 { 
698             x = $0
699             print_line()
700             print x
701             next
702         }
703         line_num>0 { # continuation of value
704             line[line_num++] = $0
705             next
706         }
707         {print}
708         END {
709             print_line()
710         }
711    '
714 _filter_torture_api()
716     sed \
717         -e '/Name space load/d' \
718         -e '/PMAPI operations/s/[0-9][0-9]* PMAPI/N PMAPI/' \
719     | _filter_top_pmns \
720     | _filter_dumpresult \
721     | sed -e '/PM_ID_NULL/{
722 /No values returned!/s//No PMDA, no values [filtered]/
723 /No PMCD agent for domain of request/s//No PMDA, no values [filtered]/
724 }' \
725         -e '/kernel\.all\.pswitch/s/valfmt: [01]/valfmt: 0-or-1/' \
726         -e '/kernel\.all\.cpu/s/valfmt: [01]/valfmt: 0-or-1/' \
727         -e '/^    hostname /d' \
728         -e '/^    license /d' \
729         -e '/^    services /d' \
730         -e '/^    aconex /d' \
731         -e '/^    apache /d' \
732         -e '/^    bonding /d' \
733         -e '/^    cihb /d' \
734         -e '/^    cms /d' \
735         -e '/^    cxfs /d' \
736         -e '/^    ds389 /d' \
737         -e '/^    dynamic /d' \
738         -e '/^    engr /d' \
739         -e '/^    feature /d' \
740         -e '/^    idiot /d' \
741         -e '/^    idl /d' \
742         -e '/^    infiniband /d' \
743         -e '/^    ipc /d' \
744         -e '/^    kaio /d' \
745         -e '/^    kpreempt /d' \
746         -e '/^    kswitch /d' \
747         -e '/^    kvm /d' \
748         -e '/^    maillog /d' \
749         -e '/^    mounts /d' \
750         -e '/^    mt /d' \
751         -e '/^    named /d' \
752         -e '/^    nasavg /d' \
753         -e '/^    netfilter /d' \
754         -e '/^    nfsclient /d' \
755         -e '/^    numa /d' \
756         -e '/^    nvidia /d' \
757         -e '/^    origin /d' \
758         -e '/^    pdns /d' \
759         -e '/^    p76 /d' \
760         -e '/^    process /d' \
761         -e '/^    roomtemp /d' \
762         -e '/^    rpm /d' \
763         -e '/^    rsyslog /d' \
764         -e '/^    samba /d' \
765         -e '/^    softtemp /d' \
766         -e '/^    stream /d' \
767         -e '/^    sysfs /d' \
768         -e '/^    sysioctl /d' \
769         -e '/^    tmpfs /d' \
770         -e '/^    udf /d' \
771         -e '/^    vfs /d' \
772         -e '/^    vmware /d' \
773         -e '/^    waitio /d' \
774         -e '/^    xvm /d' \
775     # end
778 _filter_install()
780     sed \
781         -e 's/.* \(hash table entries\)/  NNN \1/' \
782         -e 's/.* \(non-leaf nodes\)/  NNN \1/' \
783         -e 's/.* \(leaf nodes\)/  NNN \1/' \
784         -e 's/.* \(bytes of symbol table\)/  NNN \1/' \
785         -e '/Performance Co-Pilot starting/d'
788 _filter_post()
790     sed \
791         -e 's/^host [^ :]*:/host <host>:/'
794 _filter_console()
796     sed \
797         -e 's/^ *[0-9]*\.[0-9][0-9]/<timestamp>/' \
798         -e 's/0x0$/(nil)/' \
799         -e 's/0x[0-9a-f]*/<addr>/' \
800         -e 's/src=[^ ]*/src=<host>/' \
801         -e '/Tab::updateTimeAxis:/s/used .*/used .../'
804 _filter_views()
806     sed \
807         -e "s,^Load View: $PCP_VAR_DIR,Load View: PCP_VAR_DIR," \
808         -e '/QGtkStyle was unable to detect the current GTK+ theme\./d' \
809         -e '/GConf-WARNING \*\*: Client failed to connect to the D-BUS/d' \
810         -e '/Failed to connect to socket .*dbus.*: Connection refused/d' \
811         -e '/^$/d'