3 # get number of tcp connections
4 # original code and xml templates by: <jbrooks@oddelement.com>
6 # http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.sh
8 # Modified to use snmpget via aggregate program in snmpd side by Elan Ruusamäe <glen@pld-linux.org>, 2009-10-14
10 # To use this script, you must define in your snmpd.local.conf:
11 # extend .1.3.6.1.4.1.16606.1 tcpstat /usr/lib/snmpd-agent-tcpstat
16 snmp_community=${2:-public}
21 if [ -z "$hostname" ]; then
22 echo >&2 "Usage: $PROGRAM HOSTNAME [SNMP_COMMUNITY] [TIMEOUT]"
26 # Use registered OID, http://www.oid-info.com/get/1.3.6.1.4.1.16606:
27 oidbase=.1.3.6.1.4.1.16606.1
30 oid=$oidbase.$oidextend.$oidcmd
32 out=$(snmpget -v2c -Onqv -c "$snmp_community" -t "$timeout" "$hostname" "$oid") || exit $?
34 out=${out#\"} out=${out%\"}