/var/lib/pcp/testsuite/635 is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #! /bin/sh
# PCP QA Test No. 635
# Check Linux network.interface metrics
#
# 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
[ $PCP_PLATFORM = linux ] || _notrun "Depends on Linux netstat -ai output format"
case `hostname`
in
vm24)
# netstat -ai is just wrong here ... /proc/net/dev and netstat -ai
# do not agree
_notrun "netstat -ai broken on vm24"
;;
esac
status=0 # success is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# sample output
#kenj-pc 68% netstat -ai
#Kernel Interface table
#Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
#eth0 1500 0 5212 0 0 0 3080 2 0 0 BRU
#lo 3924 0 164293 0 0 0 164293 0 0 0 LRU
#
# vm24 i686 openSUSE 13.1
#Kernel Interface table
#Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
#ens3 1500 0 5174 0 0 1 2731 0 0 0 BMRU
#lo 65536 0 2524 0 0 0 2524 0 0 0 LRU
#
#
# Grab the netstat statistics. Get name and mtu:
#
_netstat_i_1()
{
netstat -ai \
| tee -a $seq.full \
| sed -e 's/\*/ /' \
| $PCP_AWK_PROG '
BEGIN { iface = -1; mtu = -1; hdr = 0 }
/Kernel Interface table/ { next }
hdr==0 { for (i = 0; i <= NF; i++) {
if ($i == "Iface") iface = i
if ($i == "MTU") mtu = i
}
if (iface == -1 || mtu == -1) {
print "Botch: bad iface/mtu header line:",iface,mtu
exit(0);
}
hdr = 1
next
}
hdr==1 { print $iface, $mtu }'
}
# Then recv packets, recv errors, recv drops, xmit packets, xmit errors
# and xmit drops.
#
#Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
#eth0 1500 0 12263928 0 0 0 3273749 0 0 0 BMRU
#lo 16436 0 3489788 0 0 0 3489788 0 0 0 LRU
#
# Note1: fifo metric from /proc/net/dev is ?-OVR visible in netstat
# Note2: "Met" column may not be there!
#
_netstat_i_2()
{
netstat -ai \
tee -a $seq.full \
| sed \
-e 's/\*/ /' \
| $PCP_AWK_PROG '
BEGIN { rx = -1; rx_err = -1; rx_drp = -1; rx_ovr = -1
tx = -1; tx_err = -1; tx_drp = -1; tx_ovr = -1
hdr = 0
}
/Kernel Interface table/ { next }
hdr==0 { for (i = 0; i <= NF; i++) {
if ($i == "RX-OK") rx = i
if ($i == "RX-ERR") rx_err = i
if ($i == "RX-DRP") rx_drp = i
if ($i == "RX-OVR") rx_ovr = i
if ($i == "TX-OK") tx = i
if ($i == "TX-ERR") tx_err = i
if ($i == "TX-DRP") tx_drp = i
if ($i == "TX-OVR") tx_ovr = i
}
if (rx == -1 || rx_err == -1 || rx_drp == -1 || rx_ovr == -1 ||
tx == -1 || tx_err == -1 || tx_drp == -1 || tx_ovr == -1) {
print "Botch: bad rx/txheader line:",rx,rx_err,rx_drp,rx_ovr,tx,tx_err,tx_drp,tx_ovr
exit(0);
}
hdr = 1
next
}
hdr==1 { print $rx, $rx_err, $rx_drp, $rx_ovr, $tx, $tx_err, $tx_drp, $tx_ovr }'
}
# real QA test starts here
echo >$seq.full
# Get the list of network interfaces from ifconfig
# Need uniq because may have one interface appearing moer than once
# (e.g. br1 and br1:avahi which become 2 br1 lines otherwise).
#
ifconfig -a \
| sed -n -e '/^[^ ]/{
s/[: ].*//
p
}' \
| LC_COLLATE=POSIX sort \
| uniq \
> $tmp.net.indom
pminfo -f network.interface.total.drops \
| $PCP_AWK_PROG '
/ inst / { print $4 }
{ next } ' \
| tr -d '"]' \
| LC_COLLATE=POSIX sort \
> $tmp.pcp.indom
if diff $tmp.pcp.indom $tmp.net.indom >$tmp.indom.diff
then
:
else
echo "Instance domains for network.interface.total.drops are different:"
diff -u $tmp.pcp.indom $tmp.net.indom
echo "PCP instance domain ..." >>$seq.full
cat $tmp.pcp.indom >>$seq.full
echo "netstat instance domain ..." >>$seq.full
cat $tmp.net.indom >>$seq.full
status=1
fi
# Metrics to test. All of these should be counters.
# out.qlength, out.qmax
# are excluded because they're instantaneous values.
#
cat >$tmp.metrics <<END
in.errors
in.packets
in.drops
in.fifo
out.errors
out.packets
out.drops
out.fifo
END
echo >>$seq.full
echo "=== netstat for first i/f name and mtu ===" >>$seq.full
_netstat_i_1 > $tmp.net.1a
echo "===" >>$seq.full
cat $tmp.net.1a >>$seq.full
echo >>$seq.full
echo "=== netstat for first counts ===" >>$seq.full
_netstat_i_2 > $tmp.net.1b
echo "===" >>$seq.full
cat $tmp.net.1b >>$seq.full
# and stick 'em together (just lick and press)
#
paste $tmp.net.1a $tmp.net.1b \
| LC_COLLATE=POSIX sort \
>$tmp.net.1
# Now get the metrics
#
echo >>$seq.full
echo "=== pminfo ==" >>$seq.full
for m in `cat $tmp.metrics`
do
pminfo -f network.interface.$m \
| tee -a $seq.full \
| $PCP_AWK_PROG '
/ inst / { print $4, $6 }
{ next } ' \
| tr -d '"]' \
| LC_COLLATE=POSIX sort \
> $tmp.vals.$m.1
done
otherhost=`./getpmcdhosts -L -n 1 2>$tmp.out`
[ -z "$otherhost" ] && _notrun `cat $tmp.out`
# Generate a bit of network traffic
#
$sudo ping -f -c 100 localhost >/dev/null 2>&1 &
$sudo ping -f -c 100 $otherhost >/dev/null 2>&1 &
sleep 3
for m in `cat $tmp.metrics`
do
pminfo -f network.interface.$m \
| $PCP_AWK_PROG '
/ inst / { print $4, $6 }
{ next } ' \
| tr -d '"]' \
| LC_COLLATE=POSIX sort \
> $tmp.vals.$m.2
LC_COLLATE=POSIX join -1 1 -2 1 -o 1.2,2.2,1.1 -t' ' $tmp.vals.$m.1 $tmp.vals.$m.2 >$tmp.vals
while read v1 v2 inst
do
if [ $v2 -lt $v1 ]
then
echo "$m[\"$inst\"] decreased from $v1 to $v2!"
status=1
fi
done <$tmp.vals
done
# Grab another batch of netstat statistics. Get name and mtu:
#
echo >>$seq.full
echo "=== netstat for second i/f name and mtu ===" >>$seq.full
_netstat_i_1 > $tmp.net.2a
echo "===" >>$seq.full
cat $tmp.net.2a >>$seq.full
# Then recv packets, recv errors, recv drops, xmit packets, xmit errors
# and xmit drops.
#
echo >>$seq.full
echo "=== netstat for second counts ===" >>$seq.full
_netstat_i_2 > $tmp.net.2b
echo "===" >>$seq.full
cat $tmp.net.2b >>$seq.full
# and stick 'em together (just lick and press)
#
paste $tmp.net.2a $tmp.net.2b \
| LC_COLLATE=POSIX sort \
>$tmp.net.2
$PCP_AWK_PROG < $tmp.net.1 '
{
print $1, $3 >"'$tmp.net.in.packets.1'"
print $1, $4 >"'$tmp.net.in.errors.1'"
print $1, $5 >"'$tmp.net.in.drops.1'"
print $1, $6 >"'$tmp.net.in.fifo.1'"
print $1, $7 >"'$tmp.net.out.packets.1'"
print $1, $8 >"'$tmp.net.out.errors.1'"
print $1, $9 >"'$tmp.net.out.drops.1'"
print $1, $10 >"'$tmp.net.out.fifo.1'"
}'
$PCP_AWK_PROG < $tmp.net.2 '
{
print $3 >"'$tmp.net.in.packets.2'"
print $4 >"'$tmp.net.in.errors.2'"
print $5 >"'$tmp.net.in.drops.2'"
print $6 >"'$tmp.net.in.fifo.2'"
print $7 >"'$tmp.net.out.packets.2'"
print $8 >"'$tmp.net.out.errors.2'"
print $9 >"'$tmp.net.out.drops.2'"
print $10 >"'$tmp.net.out.fifo.2'"
}'
# Bring the two netstat snaps together and check the pminfo data falls
# within the netstat data.
#
for m in `cat $tmp.metrics`
do
[ ! -f $tmp.net.$m.1 ] && continue
echo "--- $tmp.net.$m.1 ---" >>$seq.full
cat $tmp.net.$m.1 >>$seq.full
echo "--- $tmp.net.$m.2 ---" >>$seq.full
cat $tmp.net.$m.2 >>$seq.full
echo "---" >>$seq.full
paste $tmp.net.$m.1 $tmp.net.$m.2 > $tmp.net
echo '' >>$seq.full
echo "=== $m pminfo ===" >>$seq.full
cat $tmp.vals.$m.2 >>$seq.full
echo "--- $m netstat ---" >>$seq.full
cat $tmp.net >>$seq.full
LC_COLLATE=POSIX join -1 1 -2 1 -o 1.1,2.2,1.2,2.3 $tmp.vals.$m.2 $tmp.net >$tmp.all
while read inst nv1 pcp nv2
do
if src/compare $nv1 $pcp $nv2
then
:
else
echo "network.interface.$m[\"$inst\"] value $pcp not in range $nv1..$nv2"
status=1
fi
done <$tmp.all
done
exit
|