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
|
#! /bin/sh
# PCP QA Test No. 581
# pmie, #687355
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
signal=$PCP_BINADM_DIR/pmsignal
status=1 # failure is the default!
control=$PCP_PMDAS_DIR/sample/dynamic.indom
needclean=true
HOST=`hostname`
cat <<End-of-File >$tmp.pmie
// disk indom
some_inst disk.dev.total >= 0 -> print "\nDISK %i";
// cpu indom
some_inst kernel.percpu.cpu.user >= 0 -> print "\nCPU %i";
End-of-File
if [ $PCP_PLATFORM != solaris ]
then
cat <<End-of-File >>$tmp.pmie
// network interface indom
some_inst network.interface.total.packets >= 0 -> print "\nNETWORK %i";
// filesys indom
some_inst filesys.capacity >= 0 -> print "\nFILESYS %i";
End-of-File
fi
cat <<End-of-File >>$tmp.pmie
// sample.mirage
some_inst sample.mirage >= 0 -> print "\nMIRAGE %i";
// the dynamic ones ...
some_inst sample.dynamic.discrete >= 0 -> print "DYN_DISCRETE" " %i";
some_inst sample.dynamic.instant >= 0 -> print "DYN_INSTANT" " %i";
End-of-File
_cleanup()
{
_restore_auto_restart pmcd
_restore_auto_restart pmlogger
if $needclean
then
$sudo rm -f $control
[ -f $control.$seq ] && $sudo mv $control.$seq $control
_restore_loggers
_service pmcd restart 2>&1 | _filter_pcp_restart
_wait_for_pmcd
_service pmlogger restart 2>&1 | _filter_pcp_restart
_wait_for_pmlogger
needclean=false
fi
$sudo rm -f $tmp.*
}
_filter()
{
sed \
-e '/value/s/ [0-9]*$/ N/'
}
$sudo rm -f $control.$seq
trap "_cleanup; exit \$status" 0 1 2 3 15
[ -f $control ] && $sudo mv $control $control.$seq
# don't need to regenerate config.default with pmlogconf
#
PMLOGGER_CHECK_SKIP_LOGCONF=yes; export PMLOGGER_CHECK_SKIP_LOGCONF
PMCD_RECONNECT_TIMEOUT=1
export PMCD_RECONNECT_TIMEOUT
# instances - mk I
#
cat >$tmp.indom <<End-of-File
10 ten
20 twenty
30 thirty
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control
_stop_auto_restart pmcd
_stop_auto_restart pmlogger
_disable_loggers || _exit 1
if ! _service pmlogger stop; then _exit 1; fi \
| _filter_pcp_stop
if ! _service pmcd restart 2>&1; then _exit 1; fi | _filter_pcp_restart
_wait_for_pmcd || _exit 1
pminfo -f sample.dynamic.instant | _filter
echo
# real QA test starts here
pmie -t 250msec -c $tmp.pmie >$tmp.out 2>&1 &
pid_pmie=$!
# sleep_stop time to sleep before stopping pmcd
# sleep_start time to sleep before starting pmcd
sleep_start=4
sleep_stop=5
# and again with the same instances
#
sleep $sleep_stop
if ! _service pmcd stop; then _exit 1; fi \
| _filter_pcp_stop
sleep $sleep_start
if ! _service pmcd start 2>&1; then _exit 1; fi | _filter_pcp_start
_wait_for_pmcd || _exit 1
pminfo -f sample.dynamic.instant |_filter
echo
# instances - mk II
#
sleep $sleep_stop
if ! _service pmcd stop; then _exit 1; fi \
| _filter_pcp_stop
cat >$tmp.indom <<End-of-File
20 twenty
25 twenty-five
30 thirty
40 forty
49 forty-nine
50 fifty
58 fifty-eight
106 one-hundred-and-six
End-of-File
$sudo cp $tmp.indom $control
sleep $sleep_start
if ! _service pmcd start 2>&1; then _exit 1; fi | _filter_pcp_start
_wait_for_pmcd || _exit 1
pminfo -f sample.dynamic.instant |_filter
echo
# instances - mk III
#
sleep $sleep_stop
if ! _service pmcd stop; then _exit 1; fi \
| _filter_pcp_stop
cat >$tmp.indom <<End-of-File
07 seven
08 eight
10 ten
20 twenty
30 thirty-*
100 one-hundred
End-of-File
$sudo cp $tmp.indom $control
sleep $sleep_start
if ! _service pmcd start 2>&1; then _exit 1; fi | _filter_pcp_start
_wait_for_pmcd || _exit 1
pminfo -f sample.dynamic.instant |_filter
echo
# instances - mk IV
#
sleep $sleep_stop
if ! _service pmcd stop; then _exit 1; fi \
| _filter_pcp_stop
cat >$tmp.indom <<End-of-File
End-of-File
$sudo cp $tmp.indom $control
sleep $sleep_start
if ! _service pmcd start 2>&1; then _exit 1; fi | _filter_pcp_start
_wait_for_pmcd || _exit 1
pminfo -f sample.dynamic.instant |_filter
echo
sleep $sleep_stop
$signal -s TERM $pid_pmie
wait
cp $tmp.out $seq_full
echo
echo "Expect only connection lost/re-established and DYN_* lines ..."
echo
# In addition to the regular filtering, some versions of Linux return
# ECONNRESET on the write() when pmcd is signald, rather than waiting
# to return the error on the following read() ... as far as this test
# is concerned, these are synonyms.
# If some of the metrics in the pmie rules are unavailable (e.g.
# filesys.capacity on FreeBSD), then we'll also see
# ... warning - pmcd via ... does not respond
# ... Cannot connect to pmcd
#
# And we also have to dodge pmie scheduler warnings around pmcd
# reconnection ... the second awk script does this.
#
_filter_pmie_log <$tmp.out \
| sed \
-e "/ Error: /s/$HOST/HOST/g" \
-e "/ Error: /s/local:/HOST/g" \
-e "/ Error: /s/localhost/HOST/g" \
-e "/ Info: /s/$HOST/HOST/g" \
-e "/ Info: /s/localhost/HOST/g" \
-e "/ Info: /s/local:/HOST/g" \
-e '/ Error: __pmCloseChannelbyContext: /d' \
-e '/warning - pmcd via .* does not respond/d' \
-e '/Cannot connect to pmcd/d' \
-e 's/failed: Connection reset by peer/failed: IPC protocol failure/' \
-e '/not in namespace for pmcd/d' \
-e '/pmLookupName failed: Unknown metric name/d' \
-e '/pmie: warning - pmcd via local: is unreachable/d' \
-e '/^DATE: *$/d' \
-e '/^FILESYS \/dev\//d' \
-e '/^FILESYS \/dev$/d' \
-e '/^FILESYS none$/d' \
-e '/^FILESYS devfs$/d' \
-e '/^FILESYS map -hosts$/d' \
-e '/^FILESYS map auto_home$/d' \
-e '/^FILESYS overlay$/d' \
-e '/^FILESYS rootfs$/d' \
-e '/^MIRAGE m-[0-9][0-9]*$/d' \
-e '/^DISK dks[0-9][0-9]*d[0-9][0-9]*/d' \
-e '/^DISK [a-f0-9][a-f0-9]*\/lun[0-9][0-9]*\/c[0-9][0-9]*p[0-9][0-9]*/d' \
-e '/^DISK ada[0-9]$/d' \
-e '/^DISK cd[0-9][0-9]*$/d' \
-e '/^DISK da[0-9][0-9]*$/d' \
-e '/^DISK fd[0-9][0-9]*$/d' \
-e '/^DISK hd[a-z]/d' \
-e '/^DISK sd[a-z0-9]/d' \
-e '/^DISK sr[0-9]/d' \
-e '/^DISK dasd[a-z]/d' \
-e '/^DISK mmcblk[0-9]/d' \
-e '/^DISK cmdk[0-9]/d' \
-e '/^DISK rd\//d' \
-e '/^DISK scsi\/host/d' \
-e '/^DISK vd[a-z]/d' \
-e '/^DISK vtbd[0-9]/d' \
-e '/^DISK wd[0-9][0-9]*$/d' \
-e '/^DISK xscsi\/pci/d' \
-e '/^DISK xvm\//d' \
-e '/^DISK nvme[0-9]*n[0-9]*/d' \
-e '/^DISK disk[0-9][0-9]*$/d' \
-e '/^DISK rpool$/d' \
-e '/^CPU cpu[0-9][0-9]*$/d' \
-e '/^CPU cpu:[0-9][0-9]*\.[0-9][0-9]*\.[ab]$/d' \
-e '/^CPU cpu:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[a-d]$/d' \
-e '/^NETWORK dummy[0-9]/d' \
-e '/^NETWORK br[0-9][0-9]*$/d' \
-e '/^NETWORK cni[0-9][0-9]*$/d' \
-e '/^NETWORK cni-podman[0-9][0-9]*$/d' \
-e '/^NETWORK enc[0-9][0-9]*$/d' \
-e '/^NETWORK enccw[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/d' \
-e '/^NETWORK docker[0-9][0-9]*$/d' \
-e '/^NETWORK e[cfmnt][0-9][0-9]*$/d' \
-e '/^NETWORK eno[0-9]*d[0-9]*$/d' \
-e '/^NETWORK eno[0-9]*$/d' \
-e '/^NETWORK ens[0-9]*$/d' \
-e '/^NETWORK enp[0-9]*s[0-9]$/d' \
-e '/^NETWORK enP[0-9]*s[0-9]$/d' \
-e '/^NETWORK enp[0-9][0-9]*s[0-9][0-9]*.*[0-9]$/d' \
-e '/^NETWORK enP[0-9][0-9]*p[0-9][0-9]*.*[0-9]$/d' \
-e '/^NETWORK enP[0-9][0-9]*s[0-9][0-9]*.*[0-9]$/d' \
-e '/^NETWORK enP[0-9][0-9]*s[0-9][0-9]*.*[0-9]$/d' \
-e '/^NETWORK eth[0-9]/d' \
-e '/^NETWORK fw[0-9][0-9]*$/d' \
-e '/^NETWORK gif[0-9][0-9]*$/d' \
-e '/^NETWORK ip_vti[0-9][0-9]*$/d' \
-e '/^NETWORK lo[0-9][0-9]*$/d' \
-e '/^NETWORK lo$/d' \
-e '/^NETWORK p[0-9][0-9]*p[0-9][0-9]*$/d' \
-e '/^NETWORK pan[0-9][0-9]*$/d' \
-e '/^NETWORK pcn[0-9][0-9]*$/d' \
-e '/^NETWORK pflog[0-9][0-9]*$/d' \
-e '/^NETWORK ppp[0-9][0-9]*$/d' \
-e '/^NETWORK re[0-9]/d' \
-e '/^NETWORK sit[0-9]/d' \
-e '/^NETWORK sl[0-9][0-9]*$/d' \
-e '/^NETWORK stf[0-9][0-9]*$/d' \
-e '/^NETWORK tun[0-9][0-9]*$/d' \
-e '/^NETWORK usb[0-9][0-9]*$/d' \
-e '/^NETWORK vde[0-9][0-9]*$/d' \
-e '/^NETWORK veth[a-f0-9][a-f0-9]*$/d' \
-e '/^NETWORK vnet[0-9][0-9]*$/d' \
-e '/^NETWORK vio[0-9][0-9]*$/d' \
-e '/^NETWORK virbr[0-9][0-9]*$/d' \
-e '/^NETWORK virbr[0-9][0-9]*-nic$/d' \
-e '/^NETWORK wlan[0-9][0-9]*$/d' \
-e '/^NETWORK wlp[0-9][0-9]*s[0-9][0-9]*$/d' \
-e '/^NETWORK wlx[0-9a-f][0-9a-f]*$/d' \
-e '/^NETWORK wwan[0-9][0-9]*$/d' \
-e '/^NETWORK wmaster[0-9][0-9]*$/d' \
-e '/^NETWORK xp[0-9][0-9]*$/d' \
| $PCP_AWK_PROG '
BEGIN { last["DYN_DISCRETE"] = last["DYN_INSTANT"] = "" }
$2 ~ /DYN_/ { if (last[$2] != $0) {
print $0
last[$2] = $0
}
next
}
{ print }
/Lost connection/ { last["DYN_DISCRETE"] = last["DYN_INSTANT"] = "" }' \
| $PCP_AWK_PROG '
skip == 1 && /^[^ ]/ { skip = 0 }
/^run: schedule eval/ { skip = 1 }
/^sleepTight: negative/ { skip = 1 }
/^Last sleepTight until:/ { skip = 1 }
/^This sleepTight\() entry:/ { skip = 1 }
/^Harvest children done:/ { skip = 1 }
/^Want sleepTight until:/ { skip = 1 }
/Task dump @/ { skip = 1 }
skip == 0 { print }'
# success, all done
status=0
exit
|