]> git.pld-linux.org Git - packages/cacti-template-snmp_tcp_connection_status.git/blobdiff - cacti-template-snmp_tcp_connection_status.sh
- simplify
[packages/cacti-template-snmp_tcp_connection_status.git] / cacti-template-snmp_tcp_connection_status.sh
index 74a2eb0af3c6e20b46c45ece1ab7c2cc213b1250..ffdf5da26fb7f87ac8b6057f42f38ac63e61b801 100644 (file)
@@ -5,7 +5,10 @@
 # history:
 # http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.sh
 #
-# Modified to use snmpd server side summary script Elan Ruusamäe <glen@pld-linux.org>
+# Modified to use snmpget via aggregate program in snmpd side by Elan Ruusamäe <glen@pld-linux.org>, 2009-10-14
+#
+# To use this script, you must define in your snmpd.local.conf:
+# extend .1.3.6.1.4.1.16606.1 tcpstat /usr/lib/snmpd-agent-tcpstat
 
 PROGRAM=${0##*/}
 
@@ -13,7 +16,6 @@ hostname=$1
 snmp_community=${2:-public}
 timeout=${3:-10}
 retry=5
-oid=.1.3.6.1.4.1.16606.1.3.1.1.7.116.99.112.115.116.97.116
 
 # handle case when template was imported with <> getting lost
 if [ -z "$hostname" -o "$hostname" = "hostcommunity" ]; then # WTF
@@ -21,6 +23,13 @@ if [ -z "$hostname" -o "$hostname" = "hostcommunity" ]; then # WTF
        exit 1
 fi
 
-out=$(snmpget -v2c -On -c "$snmp_community" -t "$timeout" "$hostname" "$snmpget") || exit $?
-echo ${out#.*STRING: }
-exit 0
+# Use registered OID, http://www.oid-info.com/get/1.3.6.1.4.1.16606:
+oidbase=.1.3.6.1.4.1.16606.1
+oidextend=3.1.1
+oidcmd='"tcpstat"'
+oid=$oidbase.$oidextend.$oidcmd
+
+out=$(snmpget -v2c -Onqv -c "$snmp_community" -t "$timeout" "$hostname" "$oid") || exit $?
+# strip quotes
+out=${out#\"} out=${out%\"}
+echo $out
This page took 0.085268 seconds and 4 git commands to generate.