]> git.pld-linux.org Git - packages/cacti-template-snmp_tcp_connection_status.git/commitdiff
- from http://forums.cacti.net/download.php?id=5198 (http://forums.cacti.net/about127...
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 21 Jan 2009 13:48:00 +0000 (13:48 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cacti-template-snmp_tcp_connection_status.sh -> 1.1

cacti-template-snmp_tcp_connection_status.sh [new file with mode: 0644]

diff --git a/cacti-template-snmp_tcp_connection_status.sh b/cacti-template-snmp_tcp_connection_status.sh
new file mode 100644 (file)
index 0000000..b694c9b
--- /dev/null
@@ -0,0 +1,32 @@
+#/bin/bash
+
+# get number of tcp connection
+# $1 = hostname
+# $2 = snmp community
+# lots of ways to do this with more style... ;)
+# jbrooks@oddelement.com
+
+CACTIDIR=/var/www/htdocs/cacti/scripts
+TMPDIR=/tmp
+
+cd $CACTIDIR
+
+
+snmpnetstat -v 2c -c $2 -Can -Cp tcp $1 > $TMPDIR/$1
+
+ESTABLISHED=`grep ESTABLISHED $TMPDIR/$1 |wc -l`
+LISTENING=`grep LISTEN $TMPDIR/$1 |wc -l`
+TIME_WAIT=`grep TIMEWAIT $TMPDIR/$1 |wc -l`
+TIME_CLOSE=`grep TIMECLOSE $TMPDIR/$1 |wc -l`
+FIN1=`grep FINWAIT1 $TMPDIR/$1 |wc -l`
+FIN2=`grep FINWAIT2 $TMPDIR/$1 |wc -l`
+SYNSENT=`grep SYNSENT $TMPDIR/$1 |wc -l`
+SYNRECV=`grep SYNRECV $TMPDIR/$1 |wc -l`
+
+echo -n established:${ESTABLISHED} listen:${LISTENING} time_wait:${TIME_WAIT} time_close:${TIME_CLOSE} syn_sent:${SYNSENT} fin_wait1:${FIN1} fin_wait2:${FIN2} syn_recv:${SYNRECV}
+
+# uncomment for debugging:
+# echo $1: established:$ESTABLISHED listen:$LISTENING time_wait:$TIME_WAIT time_close:$TIME_CLOSE syn_sent:$SYN fin_wait1:$FIN1 fin_wait2:$FIN2 >> $TMPDIR/tcp.log
+
+# may want to comment this for debugging too
+rm $TMPDIR/$1
This page took 0.078034 seconds and 4 git commands to generate.