4 # Verify network.<protocol> statistics
5 # (Linux version, see 117 for non-Linux version - although this version
6 # has been completely re-written to deal with optional output from the
7 # Linux version of netstat)
9 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
10 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
14 echo "QA output created by $seq"
16 # get standard environment, filters and checks
21 which netstat
>/dev
/null
2>&1 || _notrun
"netstat not installed"
23 if [ $PCP_PLATFORM != linux
]
25 echo "network.* checks for non-linux done in test 117" >$seq.notrun
26 echo "$seq: [not run] `cat $seq.notrun`"
31 compare
=`pwd`/src
/compare
32 status
=0 # success is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
38 echo "Can't find compare, giving up"
42 if pminfo network.ip
>/dev
/null
46 echo "pminfo network.ip not working, giving up"
57 cat <<'End-of-File' >$tmp.map
58 # build by hand from the source file statistics.c used to make netstat
60 # #notreported# netstat -s does not report this
61 # #notcounter# semantics is not counter, so not suitable for this test
63 # SNMP Name|netstat string|PCP name
65 #notreported#Forwarding|Forwarding is %s|network.ip.forwarding
66 #notreported#DefaultTTL|Default TTL is NNN|network.ip.defaultttl
67 InReceives|NNN total packets received|network.ip.inreceives
68 InHdrErrors|NNN with invalid headers|network.ip.inhdrerrors
69 InAddrErrors|NNN with invalid addresses|network.ip.inaddrerrors
70 ForwDatagrams|NNN forwarded|network.ip.forwdatagrams
71 InUnknownProtos|NNN with unknown protocol|network.ip.inunknownprotos
72 InDiscards|NNN incoming packets discarded|network.ip.indiscards
73 InDelivers|NNN incoming packets delivered|network.ip.indelivers
74 OutRequests|NNN requests sent out|network.ip.outrequests
75 OutDiscards|NNN outgoing packets dropped|network.ip.outdiscards
76 OutNoRoutes|NNN dropped because of missing route|network.ip.outnoroutes
77 ReasmTimeout|NNN fragments dropped after timeout|network.ip.reasmtimeout
78 ReasmReqds|NNN reassemblies required|network.ip.reasmreqds
79 ReasmOKs|NNN packets reassembled ok|network.ip.reasmoks
80 ReasmFails|NNN packet reassembles failed|network.ip.reasmfails
81 FragOKs|NNN fragments received ok|network.ip.fragoks
82 FragFails|NNN fragments failed|network.ip.fragfails
83 FragCreates|NNN fragments created|network.ip.fragcreates
85 InMsgs|NNN ICMP messages received|network.icmp.inmsgs
86 InErrors|NNN input ICMP message failed.|network.icmp.inerrors
87 InDestUnreachs|ICMP input *destination unreachable: NNN|network.icmp.indestunreachs
88 InTimeExcds|ICMP input *timeout in transit: NNN|network.icmp.intimeexcds
89 nParmProbs|ICMP input *wrong parameters: NNN|network.icmp.inparmprobs
90 InSrcQuenchs|ICMP input *source quenches: NNN|network.icmp.insrcquenchs
91 InRedirects|ICMP input *redirects: NNN|network.icmp.inredirects
92 InEchos|ICMP input *echo requests: NNN|network.icmp.inechos
93 InEchoReps|ICMP input *echo replies: NNN|network.icmp.inechoreps
94 InTimestamps|ICMP input *timestamp request: NNN|network.icmp.intimestamps
95 InTimestampReps|ICMP input *timestamp reply: NNN|network.icmp.intimestampreps
96 InAddrMasks|ICMP input *address mask request: NNN|network.icmp.inaddrmasks
97 InAddrMaskReps|ICMP input *address mask replies: NNN|network.icmp.inaddrmaskreps
98 OutMsgs|NNN ICMP messages sent|network.icmp.outmsgs
99 OutErrors|NNN ICMP messages failed|network.icmp.outerrors
100 OutDestUnreachs|ICMP output *destination unreachable: NNN|network.icmp.outdestunreachs
101 OutTimeExcds|ICMP output *time exceeded: NNN|network.icmp.outtimeexcds
102 OutParmProbs|ICMP output *wrong parameters: NNN|network.icmp.outparmprobs
103 OutSrcQuenchs|ICMP output *source quench: NNN|network.icmp.outsrcquenchs
104 OutRedirects|ICMP output *redirect: NNN|network.icmp.outredirects
105 OutEchos|ICMP output *echo request: NNN|network.icmp.outechos
106 OutEchoReps|ICMP output *echo replies: NNN|network.icmp.outechoreps
107 OutTimestamps|ICMP output *timestamp requests: NNN|network.icmp.outtimestamps
108 OutTimestampReps|ICMP output *timestamp replies: NNN|network.icmp.outtimestampreps
109 OutAddrMasks|ICMP output *address mask requests: NNN|network.icmp.outaddrmasks
110 OutAddrMaskReps|ICMP output *address mask replies: NNN|network.icmp.outaddrmaskreps
112 #notreported#RtoAlgorithm|RTO algorithm is %s|network.tcp.rtoalgorithm
113 #notreported#RtoMin||network.tcp.rtomin
114 #notreported#RtoMax||network.tcp.rtomax
115 #notreported#MaxConn||network.tcp.maxconn
116 #notcounter#ActiveOpens|NNN active connections openings|network.tcp.activeopens
117 #notcounter#PassiveOpens|NNN passive connection openings|network.tcp.passiveopens
118 AttemptFails|NNN failed connection attempts|network.tcp.attemptfails
119 EstabResets|NNN connection resets received|network.tcp.estabresets
120 #notcounter#CurrEstab|NNN connections established|network.tcp.currestab
121 InSegs|NNN segments received|network.tcp.insegs
122 OutSegs|NNN segments send out|network.tcp.outsegs
123 RetransSegs|NNN segments retransmited|network.tcp.retranssegs
124 InErrs|NNN bad segments received.|network.tcp.inerrs
125 OutRsts|NNN resets sent|network.tcp.outrsts
127 InDatagrams|NNN packets received|network.udp.indatagrams
128 NoPorts|NNN packets to unknown port received.|network.udp.noports
129 InErrors|NNN packet receive errors|network.udp.inerrors
130 OutDatagrams|NNN packets sent|network.udp.outdatagrams
131 #notreported#RcvbufErrors||network.udp.recvbuferrors
132 #notreported#SndbufErrors||network.udp.sndbuferrors
135 # real QA test starts here
141 |
$PCP_AWK_PROG >$tmp.out
'
142 /ICMP input histogram:/ { pfx = "ICMP input"; next }
143 /ICMP output histogram:/ { pfx = "ICMP output"; next }
144 /^Ip:/ { pfx = ""; skip = 0; print; next }
145 /^Icmp:/ { pfx = ""; skip = 0; print; next }
146 /^Tcp:/ { pfx = ""; skip = 0; print; next }
147 /^Udp:/ { pfx = ""; skip = 0; print; next }
148 /^[A-Z]/ { pfx = ""; skip = 1; print $0,"... skipped"; next }
150 /:/ { print pfx,$0; next }
152 echo "--- Culled netstat ---" >>$seq.full
153 cat $tmp.out
>>$seq.full
154 $PCP_AWK_PROG <$tmp.map
-F\|
'
157 |
sed -e 's/NNN/\\\\([0-9][0-9]*\\\\)/' \
160 echo "pat=$pat" >>$seq.full
161 sed -n -e 's/^[ ]*//' -e "/$pat/s//\\1/p" <$tmp.out
>$tmp.tmp
166 # assume it is marked opt_number in the statistics table, so
167 # netstat does not generate output if the value is zero
173 echo "=== First netstat ===" >>$seq.full
175 echo "=== Filtered first netstat ===" >>$seq.full
178 echo "=== pmprobe ===" >>$seq.full
179 $PCP_AWK_PROG <$tmp.map
-F\|
'
185 pmprobe
-v "$metric" 2>&1
188 |
while read metric sts val
194 # would prefer -1, but that messes up src/compare and 0
195 # happens too often ... 42424242 has only a 1 in 2^31 chance
196 # of hitting a false match!
201 echo "=== Second netstat ===" >>$seq.full
203 echo "=== Filtered second netstat ===" >>$seq.full
206 nm
=`wc -l <$pcp | sed -e 's/[ ]*//g'`
207 nn
=`wc -l <$ns2 | sed -e 's/[ ]*//g'`
210 echo "Update list! fewer metrics ($nm) than netstat statistics ($nn) -- see $seq.full"
213 echo "Update list! more metrics ($nm) than netstat statistics ($nn) -- see $seq.full"
216 echo "#!/bin/sh" >>$tmp.sh
217 echo "sts=0" >>$tmp.sh
218 paste -d" \n" $ns1 $pcp $ns2 $tmp.metrics \
221 printf "if '$compare' %d %d %d; then :; else ", $1, $2, $3;
222 printf "sts=1; echo \"%s = %d out of range %d..%d\"; fi\n", $4, $2, $1, $3
226 print "echo \"Test botch:",$0,"\""
230 echo "exit $sts" >>$tmp.sh
233 cat $tmp.sh
>>$seq.full
242 echo "Bad network.* metrics"