File: common.filter

package info (click to toggle)
pcp 6.3.8-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 235,180 kB
  • sloc: ansic: 1,253,622; sh: 173,998; xml: 160,490; cpp: 83,331; python: 20,482; perl: 18,302; yacc: 6,886; makefile: 2,955; lex: 2,862; fortran: 60; java: 52
file content (1182 lines) | stat: -rw-r--r-- 33,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
# standard PCP QA test output filters
#
# Copyright (c) 1997-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

# pmcd log file
#
_filter_pmcd_log()
{
    $PCP_AWK_PROG '
/^active/				{ state = 1 }
/_pmRead: timeout/ && state == 0	{ next }
/pduread: timeout/ && state == 0	{ next }
/assuming PCP 1.x PMDA/ && state == 0	{ next }
/ok .* INADDR_ANY/			{ $2 = "FD" }
/ok .*pmcd.socket$/			{ $2 = "FD"; $4 = "UNIX_DOMAIN_SOCKET" }
					{ print }' \
    | sed \
	-e '/^__pmGetAddrInfo/d' \
	-e '/:__pmHostEntFree(/d' \
	-e '/^__pmHostEntGetName/d' \
	-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/' \
	-e 's/^\[[A-Z].. [A-Z]..  *[0-9][0-9]* ..:..:..]/[DATE]/' \
	-e '/pcp([0-9][0-9]*)/s//pcp(PID)/' \
	-e '/pcp\[[0-9][0-9]*]/s//pcp[PID]/' \
	-e '/pmcd([0-9][0-9]*)/s//pmcd(PID)/' \
        -e '/^\(Log for pmcd on\) [^ ][^ ]*/s//\1 HOST/' \
        -e '/^pmcd: PID/s/=.*/= PID/' \
	-e '/started PMDA/s/=.*/= PID/' \
	-e 's/ \[0x[0-9a-f]*]//' \
	-e '/^->/s/->[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/->        /' \
	-e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;" \
	-e '/get_scsi_sn:/d' \
	-e '/refresh_proc_scsi/d' \
	-e '/Info: CleanupAgent/d' \
	-e '/Info: OpenSSL /d' \
	-e '/Using cipher /d' \
	-e '/using .* kmem interface/d' \
	-e '/pmcd_wait failed: exit status:/d' \
	-e '/Failed to create avahi client:/d' \
	-e 's/: host-based access control/: access control/g' \
	-e '/^User access list empty: user-based access control turned off$/d' \
	-e '/^Group access list empty: group-based access control turned off$/d' \
	-e '/pmcd caught SIG.* from pid=/s/=[0-9][0-9]*/=N/g' \
	-e '/^linux.*pmda_linux/{
s/linux/[OS] /
s/60/??/
s/ i:[0-9] / i:? /
s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
s/entry=[^ ]*/entry=[OS]_init/
}' \
	-e '/^linux.*pmdalinux/{
s/linux/[OS] /
s/60.*bin/??                 N dso/
s/ pipe / i:?  /
s/cmd=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX entry=[OS]_init/
}' \
	-e '/^darwin.*pmda_darwin/{
s/darwin/[OS]  /
s/78/??/
s/ i:[0-9] / i:? /
s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
s/entry=[^ ]*/entry=[OS]_init/
}' \
	-e '/^freebsd.*pmda_freebsd/{
s/freebsd/[OS]   /
s/85/??/
s/ i:[0-9] / i:? /
s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
s/entry=[^ ]*/entry=[OS]_init/
}' \
	-e '/^netbsd.*pmda_netbsd/{
s/netbsd/[OS]  /
s/116/ ??/
s/ i:[0-9] / i:? /
s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
s/entry=[^ ]*/entry=[OS]_init/
}' \
	-e '/^openbsd.*pmda_openbsd/{
s/openbsd/[OS]   /
s/139/ ??/
s/ i:[0-9] / i:? /
s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
s/entry=[^ ]*/entry=[OS]_init/
}' \
	-e '/^solaris.*pmda_solaris/{
s/solaris/[OS]   /
s/75/??/
s/ i:[0-9] / i:? /
s/lib=[^ ]*/lib=[OS]pmda.$DSO_SUFFIX/
s/entry=[^ ]*/entry=[OS]_init/
}' \
	-e "/^pmcd.*pmda_pmcd/s/lib=.*pmda_pmcd.$DSO_SUFFIX/lib=...pmda_pmcd.\$DSO_SUFFIX/" \
	-e '/Warning:.* linux .* Direct mapping/d' \
	-e '/NOTICE: using \/proc\/partitions for disk I\/O stats/d' \
	-e '/NOTICE: using \/proc\/diskstats for disk I\/O stats/d' \
	-e '/NOTICE: detected slabinfo version/d' \
	-e '/Warning: xfs metrics are not available/d' \
	-e '/Warning: cihb_getstats: info+recv init: /d' \
	-e '/Warning: cihb_getstats: V0 api probe: Not supported/d' \
	-e '/Warning: cihb_getstats: V0 api probe: Invalid argument/d' \
	-e '/Warning: cihb_getstats: V[01] api probe: Resource temporarily unavailable/d' \
	-e '/Warning: cihb_getstats: no stats available in this kernel/d' \
	-e '/Warning: cihb_getstats: no support for V0 or V1 api/d' \
	-e '/Warning: common_init: NON-CXFS Kernel: disabling metrics/d' \
	-e '/Warning: nfsd_init: direct map disabled/d' \
	-e '/Warning: cxfs_.*: NON-CXFS Kernel: disabling metrics/d' \
	-e '/Warning: cxfs_.*: NON-CXFS or incompatible Kernel: disabling metrics/d' \
	-e '/Warning: cxfs_common_init: direct map disabled/d' \
	-e '/Warning: cxfs_server_init: direct map disabled/d' \
	-e '/Warning: kmeminit: cannot change to group "sys": Operation not permitted/d' \
	-e '/Warning: cms_getstats: could not retrieve stats version Not supported/d' \
	-e '/Warning: cms_getstats: could not retrieve stats version Invalid argument/d' \
	-e '/Warning: cms_reload: No cms instrumentation in this kernel:/d' \
	-e '/Error: Cannot open stat device \/hw\/tape/d' \
	-e '/Note: computed HZ=/d' \
	-e '/Warning: Symbol address mismatch between System.map/d' \
	-e '/Warning: mismatch for .* between System.map/d' \
	-e '/Warning: only reported first .* mismatches between System.map/d' \
	-e '/Warning: proc.psinfo.wchan_s symbol names may not be accurate!/d' \
	-e '/Warning: Valid System.map file not found!/d' \
	-e '/Warning: proc.psinfo.wchan_s symbol names cannot be derived!/d' \
	-e '/Warning: Addresses will be returned for proc.psinfo.wchan_s instead!/d' \
	-e '/NOTICE: using ".*" for kernel symbols map/d' \
        -e '/NOTICE: using kernel 2\.4 or earlier CPU types/d' \
        -e '/NOTICE: using kernel 2\.6\.0 to 2\.6\.4 CPU types/d' \
        -e '/NOTICE: using 64 bit CPU time types/d' \
	-e '/^\.\.\.[. ]*$/d' \
    | sed \
	-e '/Connected from.*Operations denied/{
P
: more
N
s/^..*\n//
t more
}' \
    | $PCP_AWK_PROG '
/^active agent/		{ state = 1 }
state == 2 && NF == 0	{ state = 0 }
state == 2		{ print base,$0; next }
			{ print NR,$0 }
state == 1 && /^=====/	{ state = 2; base = NR+1 }' \
    | LC_COLLATE=POSIX _POSIX2_VERSION=0 sort +0n -1 +2n -3 \
    | sed -e 's/^[^ ]* //'
}

# pmproxy log file
#
_filter_pmproxy_log()
{
    $PCP_AWK_PROG '
/ok .* INADDR_ANY/			{ $2 = "FD" }
/ok .*pmproxy.socket$/			{ $2 = "FD"; $4 = "UNIX_DOMAIN_SOCKET" }
					{ print }' \
    | sed \
	-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/' \
	-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/' \
	-e '/pmproxy([0-9][0-9]*)/s//pmproxy(PID)/' \
        -e '/^\(Log for pmproxy on\) [^ ][^ ]*/s//\1 HOST/' \
	-e '/^pmproxy: PID/s/=.*/= PID/' \
	-e 's/pmproxy([1-9][0-9]*) Error:/pmproxy(PID) Error:/' \
	-e '/^pmproxy: Signalled (signal[=][1-9][0-9]*).*/d' \
	-e '/^pmproxy: disabled time series,.*(missing)/d' \
	-e '/Error: .*unsupported key server (got v/d' \
	-e '/Info: TLS configured in pmproxy.conf/d' \
	-e '/Failed to create avahi client:/d' \
	-e '/Info: connected to .*key server.*/d' \
	-e '/Info: .* setup$/d' \
	-e '/Info: OpenSSL /d' \
	-e '/Using cipher /d' \
    #end
}

# pmlogger log file
#
_filter_pmlogger_log()
{
    sed \
	-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/' \
	-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/' \
	-e 's/pmlogger([1-9][0-9]*) Error:/pmlogger(PID) Error:/' \
	-e 's/pmlogger([1-9][0-9]*) Info:/pmlogger(PID) Info:/' \
	-e '/^preprocessor cmd: /d' \
        -e '/^\(Log for pmlogger on\) [^ ][^ ]*/s//\1 HOST/' \
	-e '/^Starting logger/s/host ".*/host "HOST"/' \
	-e '/^Archive basename: /s/:.*/: ARCHIVE/' \
	-e '/^pmlc request/s/ from .*:/ from HOST:/' \
	-e '/^__pmLogCreate(/s/([^,]*,/(HOST,/' \
	-e '/^pmlogger: Signalled (signal[=][1-9][0-9]*).*/d' \
    | $PCP_AWK_PROG '
BEGIN						{ skip = 0 }
/^-- Added by .* when SaveLogs dir found/	{ skip = 1 }
skip == 0					{ print }'
}

# pmie log file
#
_filter_pmie_log()
{
    sed \
	-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/' \
	-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/' \
	-e '/^\(Log for pmie on\) [^ ][^ ]*/s//\1 HOST/' \
	-e 's/^pmie: PID = [0-9][0-9]*, via .*/pmie: PID,HOST/g' \
	-e 's/^pmie: PID = [0-9][0-9]*, default host = .*/pmie: PID,HOST/g' \
	-e '/pmie(.*) Info: pmie caught SIGINT or SIGTERM/d' \
	-e '/pmie([0-9][0-9]*)/s//pmie(PID)/' \
	-e '/^pmie: /s/- on line/- near line/'
}
_show_pmie_exit()
{
    grep -F "evaluator exiting" | \
	sed -e 's/.* Info: evaluator exiting/pmie: note - evaluator exiting/g'
}
_show_pmie_errors()
{
    grep -E -v '^Log finished |^Log for pmie on ' \
	| $PCP_AWK_PROG '{ if (NF > 0) print }' \
	| sed \
	    -e 's/.*Info: evaluator exiting/pmie: note - evaluator exiting/g' \
	    -e '/^pmie: /s/- on line/- near line/'
}

# pmdumplog -a
#
_filter_pmdumplog()
{
    sed \
	-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/' \
	-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/' \
	-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*/TIMESTAMP/' \
	-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/TIMESTAMP/' \
	-e '/^\(Performance metrics from host\) [^ ][^ ]*/s//\1 HOST/' \
	-e '/^archive:/s/\(  *\).*/\1ARCHIVE/' \
	-e '/^host:/s/\(  *\).*/\1HOST/' \
    | if [ $# -eq 1 -a X"$1" = "X--any-version" ]
    then
	sed \
	    -e '/(Log Format Version [0-9][0-9]*)/s/ [23])/ OK)/' \
	    -e 's/^			Log Vol/		Log Vol/' \
	# end
    else
	cat
    fi
}

# pmdumptext
#
_filter_pmdumptext()
{
    sed \
	-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/'
}

# some common -D diagnostics
#
_filter_dbg()
{
    sed \
	-e '/^__pmLogSetTime(/s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*[0-9]/TIMESTAMP/g' \
	-e '/^__pmLogRead:/s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*[0-9]/TIMESTAMP/g'
}

# cull the optional PMDAs
#
_filter_optional_pmdas()
{
    sed \
	-e '/pmdaapache/d' \
	-e '/pmdaarray/d' \
	-e '/pmdaash/d' \
	-e '/pmdabash/d' \
	-e '/pmdabcc/d' \
	-e '/pmdabind2/d' \
	-e '/pmdabonding/d' \
	-e '/pmdabpf/d' \
	-e '/pmdabpftrace/d' \
	-e '/pmdabrocade/d' \
	-e '/pmdacisco/d' \
	-e '/pmdadbping/d' \
	-e '/pmdadenki/d' \
	-e '/pmdadm/d' \
	-e '/pmdadmf/d' \
	-e '/pmdadocker/d' \
	-e '/pmdads389/d' \
	-e '/pmdaelasticsearch/d' \
	-e '/pmda_environ/d' \
	-e '/pmdaespping/d' \
	-e '/pmdagfs2/d' \
	-e '/pmdagluster/d' \
	-e '/pmdahacluster/d' \
	-e '/pmdahippi/d' \
	-e '/pmdahotproc/d' \
	-e '/pmdaib/d' \
	-e '/pmdainfiniband/d' \
	-e '/pmdainfmx7/d' \
	-e '/pmdainfmxping/d' \
	-e '/pmdajbd2/d' \
	-e '/pmdajson/d' \
	-e '/pmdajstat/d' \
	-e '/pmdakvm/d' \
	-e '/pmdalab/d' \
	-e '/pmdalibvirt/d' \
	-e '/pmdalinux/d' \
	-e '/pmdalmsensors/d' \
	-e '/pmdalockstat/d' \
	-e '/pmdalogger/d' \
	-e '/pmdalsf/d' \
	-e '/pmdamaillog/d' \
	-e '/pmdamailq/d' \
	-e '/pmdamemcache/d' \
	-e '/pmdammv/d' \
	-e '/pmdamongodb/d' \
	-e '/pmdamounts/d' \
	-e '/pmdampi/d' \
	-e '/pmdamssql/d' \
	-e '/pmdamysql/d' \
	-e '/pmdanamed/d' \
	-e '/pmdanasavg/d' \
	-e '/pmdanetcheck/d' \
	-e '/pmdanetfilter/d' \
	-e '/pmdanetprobe/d' \
	-e '/pmdanews/d' \
	-e '/pmdanfsclient/d' \
	-e '/pmdanginx/d' \
	-e '/pmdanutcracker/d' \
	-e '/pmdanvidia/d' \
	-e '/pmdaopenmetrics/d' \
	-e '/pmdaoracle/d' \
	-e '/pmdaoraping/d' \
	-e '/pmdaoverhead/d' \
	-e '/pmdapdns/d' \
	-e '/pmdaperfevent/d' \
	-e '/pmdapipe/d' \
	-e '/pmdapmcd/d' \
	-e '/pmdapodman/d' \
	-e '/pmdaproc/d' \
	-e '/pmdaprocess/d' \
	-e '/pmdarabbitmq/d' \
	-e '/pmdarabbitmq/d' \
	-e '/pmdaredis/d' \
	-e '/pmdaroomtemp/d' \
	-e '/pmdaroot/d' \
	-e '/pmdarpm/d' \
	-e '/pmdarsyslog/d' \
	-e '/pmdasamba/d' \
	-e '/pmdasendmail/d' \
	-e '/pmdashping/d' \
	-e '/pmda_simple/d' \
	-e '/pmdasimple/d' \
	-e '/pmdasmart/d' \
	-e '/pmdasmart/d' \
	-e '/pmdasnia/d' \
	-e '/pmdasnmp/d' \
	-e '/pmdasockets/d' \
	-e '/pmdassping/d' \
	-e '/pmdastatsd/d' \
	-e '/pmdasummary/d' \
	-e '/pmdasyb10/d' \
	-e '/pmdasybping/d' \
	-e '/pmdasystemd/d' \
	-e '/pmdatrace/d' \
	-e '/pmdatrivial/d' \
	-e '/pmdatxmon/d' \
	-e '/pmdauwsgi/d' \
	-e '/pmdavmware/d' \
	-e '/pmdawatch/d' \
	-e '/pmdaweblog/d' \
	-e '/pmdawebping/d' \
	-e '/pmdaxfs/d' \
	-e '/pmdaxvm/d' \
	-e '/pmdazfs/d' \
	-e '/pmdazimbra/d' \
	-e '/pmdazswap/d' \
	-e '/weblog/d' \
    # end
}

# cull lines for pmcd.pmda instances that are non-default.
#
_filter_optional_pmda_instances()
{
    sed \
	-e '/inst \[3 or "proc"]/d' \
	-e '/inst \[4 or "pmproxy"]/d' \
	-e '/inst \[10 or "trace"]/d' \
	-e '/inst \[11 or "xfs"]/d' \
	-e '/inst \[15 or "sendmail"]/d' \
	-e '/inst \[19 or "shping"]/d' \
        -e '/inst \[22 or "weblog"]/d' \
	-e '/inst \[24 or "redis"]/d' \
        -e '/inst \[25 or "bind2"]/d' \
	-e '/inst \[28 or "news"]/d' \
	-e '/inst \[33 or "podman"]/d' \
	-e '/inst \[35 or "mongodb"]/d' \
	-e '/inst \[57 or "statsd"]/d' \
	-e '/inst \[60 or "linux"]/d' \
	-e '/inst \[62 or "nfsclient"]/d' \
	-e '/inst \[66 or "mysql"]/d' \
	-e '/inst \[68 or "apache"]/d' \
        -e '/inst \[72 or "mounts"]/d' \
	-e '/inst \[74 or "lmsensors"]/d' \
	-e '/inst \[78 or "darwin"]/d' \
	-e '/inst \[95 or "kvm"]/d' \
	-e '/inst \[98 or "zimbra"]/d' \
	-e '/inst \[106 or "logger"]/d' \
	-e '/inst \[108 or "elasticsearch"]/d' \
	-e '/inst \[109 or "mssql"]/d' \
	-e '/inst \[110 or "postgresql"]/d' \
	-e '/inst \[114 or "systemd"]/d' \
        -e '/inst \[120 or "nvidia"]/d' \
        -e '/inst \[122 or "jbd2"]/d' \
	-e '/inst \[123 or "rpm"]/d' \
	-e '/inst \[125 or "zswap"]/d' \
	-e '/inst \[127 or "perfevent"]/d' \
	-e '/inst \[129 or "dm"]/d' \
	-e '/inst \[139 or "openbsd"]/d' \
        -e '/inst \[140 or "libvirt"]/d' \
        -e '/inst \[151 or "bpftrace"]/d' \
        -e '/inst \[153 or "zfs"]/d' \
        -e '/inst \[156 or "denki"]/d' \
        -e '/inst \[158 or "overhead"]/d' \
	-e '/inst \[142 or "lio"]/d' \
	-e '/inst \[144 or "openmetrics"]/d' \
	-e '/inst \[149 or "bcc"]/d' \
        -e '/inst \[152 or "netcheck"]/d' \
	-e '/inst \[154 or "sockets"]/d' \
	-e '/inst \[157 or "bpf"]/d' \
	-e '/inst \[161 or "uwsgi"]/d' \
	-e '/inst \[250 or "trivial"]/d' \
    # end
}

# cull the optional top-level PMNS entries
#
_filter_top_pmns()
{
    sed \
	-e 's/$/ /' \
	-e '/^    acct /d' \
	-e '/^    aim /d' \
	-e '/^    array /d' \
	-e '/^    ash /d' \
	-e '/^    bash /d' \
	-e '/^    bcc /d' \
	-e '/^    bind2 /d' \
	-e '/^    bonding /d' \
	-e '/^    bpf /d' \
	-e '/^    bpftrace /d' \
	-e '/^    brocade /d' \
	-e '/^    broken /d' \
	-e '/^    cgroup /d' \
	-e '/^    containers /d' \
	-e '/^    cisco /d' \
	-e '/^    datatape /d' \
	-e '/^    dbping /d' \
	-e '/^    dmcache /d' \
	-e '/^    dmstats /d' \
	-e '/^    dmthin /d' \
	-e '/^    dm /d' \
	-e '/^    dmf /d' \
	-e '/^    ds389 /d' \
	-e '/^    elasticsearch /d' \
	-e '/^    environ /d' \
	-e '/^    espping /d' \
	-e '/^    gfs2 /d' \
	-e '/^    gluster /d' \
	-e '/^    hippi /d' \
	-e '/^    hotproc /d' \
	-e '/^    hyperv /d' \
	-e '/^    hw /d' \
	-e '/^    infmxping /d' \
	-e '/^    informix /d' \
	-e '/^    jbd2 /d' \
	-e '/^    json /d' \
	-e '/^    jstat /d' \
	-e '/^    kvm /d' \
	-e '/^    lab /d' \
	-e '/^    libvirt /d' \
	-e '/^    lio /d' \
	-e '/^    lmsensors /d' \
	-e '/^    logger /d' \
	-e '/^    lsf /d' \
	-e '/^    mailq /d' \
	-e '/^    memcache /d' \
	-e '/^    mmv /d' \
	-e '/^    mongodb /d' \
	-e '/^    mpi /d' \
	-e '/^    mssql /d' \
	-e '/^    mysql /d' \
	-e '/^    named /d' \
	-e '/^    netcheck /d' \
	-e '/^    netfilter /d' \
	-e '/^    netprobe /d' \
	-e '/^    news /d' \
	-e '/^    nfsclient /d' \
	-e '/^    nginx /d' \
	-e '/^    nutcracker /d' \
	-e '/^    nvidia /d' \
	-e '/^    openmetrics /d' \
	-e '/^    oracle /d' \
	-e '/^    oraping /d' \
	-e '/^    pdns /d' \
	-e '/^    perfevent /d' \
	-e '/^    pipe /d' \
	-e '/^    pmproxy /d' \
	-e '/^    podman /d' \
	-e '/^    postfix /d' \
	-e '/^    postgresql /d' \
	-e '/^    proc /d' \
	-e '/^    rabbitmq /d' \
	-e '/^    redis /d' \
	-e '/^    rpm /d' \
	-e '/^    rsyslog /d' \
	-e '/^    samba /d' \
	-e '/^    sendmail /d' \
	-e '/^    shping /d' \
	-e '/^    simple /d' \
	-e '/^    smart /d' \
	-e '/^    snmp /d' \
	-e '/^    statsd /d' \
	-e '/^    ssping /d' \
	-e '/^    espping /d' \
	-e '/^    summary /d' \
	-e '/^    sybase /d' \
	-e '/^    sybping /d' \
	-e '/^    systemd /d' \
	-e '/^    trace /d' \
	-e '/^    trivial /d' \
	-e '/^    tty /d' \
	-e '/^    txmon /d' \
	-e '/^    uwsgi/d' \
	-e '/^    vdo /d' \
	-e '/^    vmware /d' \
	-e '/^    web /d' \
	-e '/^    webping /d' \
	-e '/^    zimbra /d' \
	-e '/^    zswap /d' \
	-e 's/ $//' \
    #end
}

# handle pmDumpResult() and pmDumpHighResResult() output
#
_filter_dumpresult()
{
    sed \
	-e '/pmResult/s/ .* numpmid/ ... numpmid/' \
	-e '/pmHighResResult/s/ .* numpmid/ ... numpmid/' \
	-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*/TIMESTAMP/' \
	-e '/value /{
s/\(value.*\) 0x[0-9a-f][0-9a-f]*/\1 HEXNUMBER/
s/\(value.*\) -*[0-9][0-9]*\.[0-9][0-9]*e[+-]*[0-9][0-9]*/\1 NUMBER/
s/\(value.*\) -*[0-9][0-9]*\.[0-9][0-9]*/\1 NUMBER/
s/\(value.*\) -*[0-9][0-9]*\.[0-9][0-9]*/\1 NUMBER/
s/\(value.*\) -*[0-9][0-9]*e[+-]*[0-9][0-9]*/\1 NUMBER/
s/\(value.*\) -*[0-9][0-9]*/\1 NUMBER/
s/\(value.*\) \[.*]/\1 AGGREGATE/
s/\(value.*\) ".*"/\1 STRING/
}' \
	-e '/inst /{
s/inst \[[0-9][0-9]* or "dks..."]/inst [DISK]/
s;inst \[[0-9][0-9]* or "/dev/[^"]*"];inst [DISK];
s;inst \[0 or "overlay"];inst [DISK];
}'

}

_filter_cron_scripts()
{
    sed \
	-e 's/cron\.pmcheck/PMLOGGER.CHECK/g' \
	-e 's/pmlogger_check/PMLOGGER.CHECK/g' \
	-e 's/pmlogger\.check/PMLOGGER.CHECK/g' \
	-e 's/cron\.pmdaily/PMLOGGER.DAILY/g' \
	-e 's/pmlogger_daily/PMLOGGER.DAILY/g' \
	-e 's/pmlogger\.daily/PMLOGGER.DAILY/g' \
	-e 's/cron\.logmerge/PMLOGGER.MERGE/g' \
	-e 's/cron\.pmlogmerge/PMLOGGER.MERGE/g' \
	-e 's/pmlogger\.merge/PMLOGGER.MERGE/g' \
	-e 's/pmlogger_merge/PMLOGGER.MERGE/g' \
	-e 's/cron\.pmsnap/pmsnap/g'
}

# from time to time, a specific distro can produce babble during PCP
# startup ... rather than wasting effort to find where this comes from,
# just filter it away here.
# Examples (both of these should now now be fixed):
# S on a line by itself after the "Starting pmcd ..." line
#     - bozo-vm, Debian bullseye/sid, Jan 2020
#     - fedora 32
# W on a line by itself after the "Updating the PMCD control file, ..." line
#     - bozo-vm, Debian bullseye/sid, Jan 2020
#     - fedora 32
#
_filter_pcp_start_distro()
{
    # if a filter has been chosen, it must return afterwards, so here
    # we need a noop fiter ...
    #
    cat
}

# besides rewriting platform-specific paths, we need to ensure that
# any chatter from the pcp/pmcd/pmlogger start scripts is removed ...
# this may come from the PCP scripts or the infrastructure that runs
# them, e.g. systemctl
#
_filter_pcp_start()
{
    sed \
	-e "s;$PCP_LOG_DIR/pmcd/pmcd.log;\$PCP_LOG_DIR/pmcd.log;" \
	-e "s;$PCP_LOG_DIR/pmcd.log;\$PCP_LOG_DIR/pmcd.log;" \
	-e "s;$PCP_RC_DIR/pmcd;\$PCP_RC_DIR/pmcd;" \
	-e "s;$PCP_RC_DIR/pmlogger;\$PCP_RC_DIR/pmlogger;" \
	-e "s;$PCP_RC_DIR/pcp;\$PCP_RC_DIR/pmcd;" \
	-e '/$PCP_RC_DIR\/pmcd/{
s/ PMCD / pmcd /
}' \
	-e "s;$PCP_BINADM_DIR/pmcd;\$PCP_BINADM_DIR/pmcd;" \
	-e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;" \
	-e "s;$PCP_PMLOGGERCONTROL_PATH;\$PCP_PMLOGGERCONTROL_PATH;" \
	-e "s;$PCP_PMLOGGERCONTROL_PATH.d/local;\$PCP_PMLOGGERCONTROL_PATH;" \
	-e "s;$PCP_VAR_DIR/;\$PCP_VAR_DIR/;" \
	-e "s;$PCP_SYSCONF_DIR/;\$PCP_SYSCONF_DIR/;" \
	-e "s;/usr/etc/pmcd;\$PCP_BINADM_DIR/pmcd;" \
	-e '/Warning: Forcing PMCD to terminate!/s/PMCD/pmcd/' \
        -e '/^Starting PCP$/d' \
        -e '/^Stopping pmlogger/d' \
	-e 's/^\(Performance Co-Pilot starting .*\.\.\.\) *\(\$PCP_RC_DIR\)/\1\
\2/' \
	-e '/^Performance Co-Pilot/s/\.\.\. *$/.../' \
        -e '/^Performance Co-Pilot starting/{
s/\.\.\.[. ]*done/.../
s/\.\.\.[. ]*failed/.../
s/Performance Co-Pilot starting PMCD (logfile is [^)]*) .../Starting pmcd ... /
s/Performance Co-Pilot starting archive loggers .../Starting pmlogger ... /
}' \
	-e '/^Starting pmcd/d' \
	-e '/^pmcd\.service: Succeeded/d' \
	-e '/^Rebuilding PMNS /d' \
	-e '/^Starting pmlogger/d' \
	-e '/^Waiting for PMCD/d' \
	-e '/^Waiting for pmcd/d' \
	-e '/^Performance Co-Pilot installing/s//Installing/' \
	-e '/Installing .* PMDA/d' \
	-e '/Removing .* PMDA/d' \
        -e '/^\.[. ]*done$/d' \
        -e '/^\.[. ]*failed$/d' \
	-e 's/^\(Waiting .*\.\.\.\)\(\$PCP_RC_DIR\)/\1\
\2/' \
	-e '/^[ 	]*$/d' \
	-e '/is not a native service, redirecting to .*chkconfig/d' \
	-e '/^Executing .*chkconfig pm.* --level=5/d' \
	-e '/Failed to create avahi client:/d' \
	-e '/pmsignal.* kill: [0-9][0-9]*: No such process/d' \
    | _filter_pcp_start_distro \
    | _filter_init_distro
}

_filter_pcp_stop()
{
    sed \
	-e '/^Stopping pmlogger/d' \
	-e '/^Waiting for PMCD/s/PMCD/pmcd/' \
	-e '/^Waiting for pmcd/d' \
	-e '/^pmcd\.service: Succeeded/d' \
	-e '/^Waiting for PMIE/s/PMIE/pmie/' \
	-e '/^Waiting for pmie/d' \
	-e '/Warning: Forcing PMCD to terminate!/s/PMCD/pmcd/' \
	-e '/^Performance Co-Pilot/s/\.\.\. *$/.../' \
        -e '/^\.[. ]*done$/d' \
	-e '/is not a native service, redirecting to .*chkconfig/d' \
	-e '/^Executing .*chkconfig pm.* --level=5/d' \
	-e "s;$PCP_RC_DIR/pmcd;\$PCP_RC_DIR/pmcd;" \
	-e "s;$PCP_RC_DIR/pmlogger;\$PCP_RC_DIR/pmlogger;" \
    | _filter_init_distro
}

_filterall_pcp_start()
{
    _filter_pcp_start \
    | sed \
        -e '/rebuilding PMNS/d' \
        -e '/installing /d'
}

_filter_pmie_start()
{
    sed \
	-e 's/PMIE/pmie/g' \
	-e '/^Stopping pmie/d' \
	-e '/^Starting pmie/d' \
	-e '/^Waiting for pmie/d' \
	-e "s;$PCP_RC_DIR/pmie;\$PCP_RC_DIR/pmie;g" \
	-e "s;$PCP_ETC_DIR/pcp/pmie;\$PCP_ETC_DIR/pcp/pmie;g" \
	-e '/(pmie) is disabled/d' \
	-e '/(pmie) not permanently enabled/d' \
	-e '/To enable/d' \
	-e '/update-rc.d -f pmie remove/d' \
	-e '/update-rc.d pmie defaults/d' \
	-e '/\/sbin\/chkconfig pmie on/d' \
	-e '/\/usr\/sbin\/sysv-rc-conf pmie on/d' \
        -e '/update-rc.d -f pmie defaults/d' \
	-e '/ln -sf \.\.\/init.d\/pmie \/etc\/rc\.d\//d' \
	-e '/systemctl enable pmie.service/d' \
	-e "s;$PCP_PMIECONTROL_PATH;\$PCP_PMIECONTROL_PATH;" \
        -e '/^\.\.*done$/d' \
	-e "s;/private/tmp;/tmp;g" \
	-e '/^$/d' \
    | _filter_init_distro
}

_filter_pmie_stop()
{
    sed \
	-e "s;$PCP_RC_DIR/pmie;\$PCP_RC_DIR/pmie;g" \
	-e '/^Waiting for PMIE/s/PMIE/pmie/' \
	-e '/^Waiting for pmie/s/\.\.\.[. ]*done/.../' \
	-e '/^Waiting for pmie/s/\.\.\. *$/.../' \
    | _filter_init_distro
}

_filter_pmproxy_start()
{
    sed \
	-e '/^Stopping pmproxy/d' \
	-e '/^Starting pmproxy/d' \
	-e '/^Waiting for pmproxy/d' \
	-e "s;$PCP_RC_DIR/pmproxy;\$PCP_RC_DIR/pmproxy;g" \
	-e '/(pmproxy) is disabled/d' \
	-e '/To enable/d' \
	-e '/update-rc.d -f pmproxy remove/d' \
	-e '/update-rc.d pmproxy defaults/d' \
	-e '/\/sbin\/chkconfig pmpmroxy on/d' \
	-e '/\/usr\/sbin\/sysv-rc-conf pmproxy on/d' \
        -e '/update-rc.d -f pmproxy defaults/d' \
	-e '/ln -sf \.\.\/init.d\/pmproxy \/etc\/rc\.d\//d' \
	-e '/systemctl enable pmproxy.service/d' \
        -e '/^\.\.*done$/d' \
	-e "s;/private/tmp;/tmp;g" \
	-e '/^$/d' \
    | _filter_init_distro
}

_filter_pmproxy_stop()
{
    sed \
	-e "s;$PCP_RC_DIR/pmproxy;\$PCP_RC_DIR/pmproxy;g" \
	-e '/^Waiting for pmproxy/d' \
	-e '/Warning: Forcing pmproxy to terminate!/d' \
	-e '/^\.\.*$/d' \
	-e '/^Process \.\.\./d' \
	-e '/^UID/d' \
	-e '/^pcp .*\/pmproxy/d' \
    | _filter_init_distro
}

_sort_pmdumplog_d()
{
    cat >$tmp.tmp
    grep -E '(^Descriptions)|(^$)' $tmp.tmp
    $PCP_AWK_PROG <$tmp.tmp '
/^Descriptions/		{ next }
NF == 0			{ next }
$1 == "PMID:"		{ printf "%s|",$0; next }
$1 == "Data"		{ printf "%s|",$0; next }
			{ print }' \
    | LC_COLLATE=POSIX _POSIX2_VERSION=0 sort -t'(' +1 -2 \
    | tr '|' '\012' \
    | src/hex2nbo
}

_filter_pmda_install()
{
    sed \
	-e 's/.* \(hash table entries\)/  NNN \1/' \
	-e 's/.* \(non-leaf nodes\)/  NNN \1/' \
	-e 's/.* \(leaf nodes\)/  NNN \1/' \
	-e 's/.* \(bytes of symbol table\)/  NNN \1/' \
	-e '/^Installing .mchart view*/d' \
	-e '/Terminate PMDA/,/Updating the PMCD/c\
Terminate PMDA if already installed ...\
[...install files, make output...]\
Updating the PMCD control file, and notifying PMCD ...
' \
	-e '/Installing files/,/Updating the Performance Metrics/c\
Installing files ...\
[...install files, make output...]\
Updating the Performance Metrics Name Space (PMNS) ...
' \
	-e '/^S$/d' \
    | _filter_pcp_start
}

# and of course sed(1) on OpenBSD has to be different ...
#
_filter_pmda_remove()
{
    _filter_pmda_install |
    sed \
	-e '/Removing files/d' \
	-e '/Job for pmcd.service canceled/d' \
    | case "$PCP_PLATFORM"
      in
        openbsd)
	    sed -e '/Updating the PMCD control file/c\
Updating the PMCD control file, and notifying PMCD ...\
[...removing files...]\
'
	    ;;
	*)
	    sed -e '/Updating the PMCD control file/c\
Updating the PMCD control file, and notifying PMCD ...\
[...removing files...]'
      esac
}

# Make sure that quotes which span multiple lines get appended onto
# the one line, separated by \\n (instead of newlines).
# This allows for easier sed processing.
# BUG: problem handling a single " which isn't supposed to match,
#      say in a comment or pattern search
# Partial solution: filter out: /"/
#
_quote_filter()
{
   sed -e 's#/"/#/dbl-quote/#g' |\
   $PCP_AWK_PROG '
	/"/ {  # unfinished quote - start or end
	    n = split($0, arr, /"/)
	    if ( (n % 2) == 0) { # odd number of quotes
		    line[line_num++] = $0
		    if (inquote) {      
			inquote = 0
			for (i = 0; i <= line_num; i++){
			    printf("%s\\n", line[i])
			}       
			printf("\n")
			line_num = 0
		    }
		    else {
			inquote = 1
		    }
		    next
	    }
	    else {
	       print; next
	    }
        }
        inquote == 1 {
            line[line_num++] = $0
            next
        }
        {print}
    '
}

#
# concat lines between inst/value pairs
#    inst ... value
#    inst ... value XXXX
#        YYYYYYY
#    inst ... value
# becomes
#    inst ... value
#    inst ... value XXXX\\nYYYYYYY
#    inst ... value
#
_inst_value_filter()
{
   $PCP_AWK_PROG '
	function print_line() {
	    if (line_num > 0) {
		for(i = 0; i < line_num-1; i++){
		    printf("%s\\n", line[i])
		}       
		printf("%s", line[line_num-1]);
		printf("\n")
		line_num = 0
	    }
	}
$1 == "inst" && $2 ~ /^\[/ {
	    print_line()
	    line[line_num++] = $0
	    next
	}
        # terminate run of inst...value ".... extending over multiple
	# lines with a line ending in a ", or a line introducing new
	# proc metric 
	/"$/ && line_num > 0 {
	    line[line_num++] = $0
	    # count quotes (") ... need to end on an even number ...
	    # this could easily be defeated by backslash quoting or
	    # even nested quoting, but these are unlikely in proc
	    # metric values, even for psinfo.environ or psinfo.psargs
	    #
	    nq = 0
	    for (x = 0; x < line_num; x++) {
		nq += gsub(/"/, "\"", line[x])
	    }
	    if ((nq % 2) == 0) {
		# balanced quotes we are done accumulating
		print_line()
	    }
	    next
	}
	( (/proc\./ && /numval/ && /valfmt/) || /^proc\./ ) \
           && line_num > 0 { 
	    x = $0
            print_line()
	    print x
	    next
	}
	line_num>0 { # continuation of value
	    line[line_num++] = $0
	    next
	}
	{print}
	END {
	    print_line()
	}
   '
}

# for src/torture_api, filter out lines like:
#     hostname             <s = 1>
# for the top-level PMNS nodes that come from optionaly PMDAs
# or are not present on every platform
#
_filter_torture_api()
{
    sed \
	-e '/Name space load/d' \
	-e '/PMAPI operations/s/[0-9][0-9]* PMAPI/N PMAPI/' \
    | _filter_top_pmns \
    | _filter_dumpresult \
    | sed -e '/PM_ID_NULL/{
/No values returned!/s//No PMDA, no values [filtered]/
/No PMCD agent for domain of request/s//No PMDA, no values [filtered]/
}' \
	-e '/kernel\.all\.pswitch/s/valfmt: [01]/valfmt: 0-or-1/' \
	-e '/kernel\.all\.cpu/s/valfmt: [01]/valfmt: 0-or-1/' \
	-e '/^    hostname /d' \
	-e '/^    license /d' \
	-e '/^    services /d' \
	-e '/^    apache /d' \
	-e '/^    bonding /d' \
	-e '/^    cihb /d' \
	-e '/^    cms /d' \
	-e '/^    cxfs /d' \
	-e '/^    denki /d' \
	-e '/^    ds389 /d' \
	-e '/^    dynamic /d' \
	-e '/^    engr /d' \
	-e '/^    fchost /d' \
	-e '/^    feature /d' \
	-e '/^    ha_cluster /d' \
	-e '/^    haproxy /d' \
	-e '/^    idiot /d' \
	-e '/^    idl /d' \
	-e '/^    infiniband /d' \
	-e '/^    ipc /d' \
	-e '/^    kaio /d' \
	-e '/^    kpreempt /d' \
	-e '/^    kswitch /d' \
	-e '/^    kvm /d' \
	-e '/^    lustre /d' \
	-e '/^    maillog /d' \
	-e '/^    mounts /d' \
	-e '/^    mt /d' \
	-e '/^    named /d' \
	-e '/^    nasavg /d' \
	-e '/^    netfilter /d' \
	-e '/^    nfsclient /d' \
	-e '/^    numa /d' \
	-e '/^    nvidia /d' \
	-e '/^    origin /d' \
	-e '/^    overhead /d' \
	-e '/^    pdns /d' \
	-e '/^    p76 /d' \
	-e '/^    process /d' \
	-e '/^    quota /d' \
	-e '/^    resctrl /d' \
	-e '/^    roomtemp /d' \
	-e '/^    rpm /d' \
	-e '/^    rsyslog /d' \
	-e '/^    samba /d' \
	-e '/^    sighups /d' \
	-e '/^    smart /d' \
	-e '/^    softtemp /d' \
	-e '/^    stream /d' \
	-e '/^    sysfs /d' \
	-e '/^    sysioctl /d' \
	-e '/^    tape /d' \
	-e '/^    tmpfs /d' \
	-e '/^    udf /d' \
	-e '/^    vfs /d' \
	-e '/^    vmware /d' \
	-e '/^    waitio /d' \
	-e '/^    xfs /d' \
	-e '/^    xvm /d' \
	-e '/^    zfs /d' \
	-e '/^    zram /d' \
    # end
}

_filter_install()
{
    sed \
        -e 's/.* \(hash table entries\)/  NNN \1/' \
        -e 's/.* \(non-leaf nodes\)/  NNN \1/' \
        -e 's/.* \(leaf nodes\)/  NNN \1/' \
        -e 's/.* \(bytes of symbol table\)/  NNN \1/' \
        -e '/Performance Co-Pilot starting/d'
}

_filter_post()
{
    sed \
	-e 's/local:/host/' \
	-e 's/^host [^ :]*:/host <host>:/'
}

_filter_console()
{
    sed \
	-e 's/^ *[0-9]*\.[0-9][0-9]/<timestamp>/' \
	-e 's/0x0$/(nil)/' \
	-e 's/0x[0-9a-f]*/<addr>/' \
	-e 's/src=[^ ]*/src=<host>/' \
	-e '/Tab::updateTimeAxis:/s/used .*/used .../'
}

_filter_views()
{
    sed \
	-e "s,^Load View: $PCP_VAR_DIR,Load View: PCP_VAR_DIR," \
	-e '/QGtkStyle was unable to detect the current GTK+ theme\./d' \
	-e '/GConf-WARNING \*\*: Client failed to connect to the D-BUS/d' \
	-e '/Failed to connect to socket .*dbus.*: Connection refused/d' \
	-e '/^Qt: Session management error: Authentication Rejected/d' \
	-e '/^$/d'
}

_value_filter_any()
{
    sed -E -e "s/value .+/value OK/g"
}

_value_filter_nonzero()
{
    sed -e "s/value [1-9][0-9]*/value OK/g"
}

_instances_filter_any()
{
    awk '/value .+/ {print "OK"; exit}'
}

_instances_filter_nonzero()
{
    awk '/value [1-9][0-9]*/ {print "OK"; exit}'
}

_instances_filter_exact()
{
    grep "value $1" > /dev/null && echo OK
}

# remove valgrind output for "possibly lost" memory, e.g.
#
# 4 bytes in 1 blocks are possibly lost in loss record 7 of 723
# at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
# ...
# {
#    <insert_a_suppression_name_here>
#    Memcheck:Leak
#    match-leak-kinds: possible
#    fun:malloc
# ...
# }
#
_filter_valgrind_possibly()
{
    $PCP_AWK_PROG '
/blocks are possibly lost in loss record/	{ skip = 1 }
skip == 1 && $1 == "}"				{ skip = 0; next }
skip == 1					{ next }
						{ print }' \
    | sed \
	-e '/ERROR SUMMARY/s/[0-9][0-9]*/N/g' \
    # end
}

# strip out this sort of stuff ...
# run: schedule eval (1660671537.224214) > now (1660671536.724049) + delta (0.500000) ... reset
# Task dump @ 0x55a8b08e8940
#   nth=0 delta=0.500 tick=4 next=(nil) prev=(nil)
#   eval time: Wed Aug 17 03:38:57.224214 2022
#   retry delta: N/A host: bozo-vm.localdomain
#   via=local: (up)
#   rules:
#     expr_1
#     expr_2
#
_filter_slow_pmie()
{
    sed \
	-e '/^run: schedule eval/d' \
    | $PCP_AWK_PROG '
BEGIN				{ skip = 0 }
$1 == "Task" && $2 == "dump"	{ skip = 1; next }
skip == 1 && /^[^ ]/		{ skip = 0 }
skip == 0			{ print }'
}

# some context labels in archives are optional ... our tests do not
# expect them to be present but if they are in /etc/pcp/labels/optional
# then we need to filter 'em out
#
_filter_optional_labels()
{
    if [ ! -f $tmp.filter.optional.labels ]
    then
	# one-trip set up for this QA test ...
	#
	touch $tmp.filter.optional.labels
	find /etc/pcp/labels/optional -type f \
	| while read f
	do
	    cat $f \
	    | sed -e 's/^{//' -e 's/}$//' \
	    | tr ',' '\012' \
	    | while read label
	    do
		echo "s@${label},*@@g" >>$tmp.filter.optional.labels
	    done
	done
	echo "=== optional context label filter ===" >>$here/$seq.full
	cat $tmp.filter.optional.labels >>$here/$seq.full
    fi

    if [ -s $tmp.filter.optional.labels ]
    then
	sed -f $tmp.filter.optional.labels
    else
	cat
    fi
}

# some versions of the C compiler are just plain wrong and emit warning
# babble when re-compiling the sample PMDA
#
# For example in Fedora 40 (aka rawhide) circa Feb 2024 ...
# sample.c: In function ‘sample_fetch’:
# sample.c:1963:13: warning: array subscript ‘pmValueSet[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Warray-bounds=]
#  1963 |         vset->pmid = pmidlist[i];
#       |             ^~
# sample.c:1954:49: note: object of size 16 allocated by ‘malloc’
#  1954 |             res->vset[i] = vset = (pmValueSet *)malloc(sizeof(pmValueSet) -
#       |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#  1955 |                                             sizeof(pmValue));
#       |                                             ~~~~~~~~~~~~~~~~
#
_filter_compiler_babble()
{
    sed \
	-e '/^sample.c: In function .sample_fetch.:/d' \
	-e '/^sample.c:.* array subscript .pmValueSet.0.. is partly outside/d' \
	-e '/^sample.c:.* note: object of size [0-9][0-9]* allocated by /d' \
	-e '/^  *[0-9][0-9]*  *| /d' \
	-e '/^  *| /d' \
    # end
}

# remove repeated (duplicate) lines from input
#
_cull_dup_lines()
{
    $PCP_AWK_PROG 'NR == 1 || last != $0 { print; last = $0 }'
}