2 # get number of tcp connection
6 # lots of ways to do this with more style... ;)
7 # jbrooks@oddelement.com
9 # convert to use awk by Elan Ruusamäe <glen@pld-linux.org>
11 snmpnetstat -v 2c -c "$2" -Can -Cp tcp "$1" | awk '
17 # socket states from net-snmp-5.4.2.1/apps/snmpnetstat/inet.c
18 split("CLOSED LISTEN SYNSENT SYNRECEIVED ESTABLISHED FINWAIT1 FINWAIT2 CLOSEWAIT LASTACK CLOSING TIMEWAIT", t, " ");
19 # create mapping (duh, why there are different data names used?)
20 # XXX TIMECLOSE missing
21 split("closed listen syn_sent syn_recv established fin_wait1 fin_wait2 closewait lastack closing time_wait", m, " ");
25 printf("%s:%d ", k, ss[s]);