]> git.pld-linux.org Git - packages/cacti-template-snmp_tcp_connection_status.git/blame - cacti-template-snmp_tcp_connection_status.sh
snmp agent: require ss tool directy so iproute2 would not be shadowed by vserver...
[packages/cacti-template-snmp_tcp_connection_status.git] / cacti-template-snmp_tcp_connection_status.sh
CommitLineData
ee7d4d10 1#!/bin/sh
da5be338 2#
387ee645
ER
3# get number of tcp connections
4# original code and xml templates by: <jbrooks@oddelement.com>
5# history:
6# http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/cacti-template-snmp_tcp_connection_status/cacti-template-snmp_tcp_connection_status.sh
da5be338 7#
e0ca6b25
ER
8# Modified to use snmpget via aggregate program in snmpd side by Elan Ruusamäe <glen@pld-linux.org>, 2009-10-14
9#
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
387ee645
ER
12
13PROGRAM=${0##*/}
14
da5be338
ER
15hostname=$1
16snmp_community=${2:-public}
17timeout=${3:-10}
18retry=5
85c56767 19
42bd8d07
ER
20# parse required args
21if [ -z "$hostname" ]; then
20dc28d5 22 echo >&2 "Usage: $PROGRAM HOSTNAME [SNMP_COMMUNITY] [TIMEOUT]"
da5be338
ER
23 exit 1
24fi
85c56767 25
e0ca6b25
ER
26# Use registered OID, http://www.oid-info.com/get/1.3.6.1.4.1.16606:
27oidbase=.1.3.6.1.4.1.16606.1
28oidextend=3.1.1
29oidcmd='"tcpstat"'
30oid=$oidbase.$oidextend.$oidcmd
31
32out=$(snmpget -v2c -Onqv -c "$snmp_community" -t "$timeout" "$hostname" "$oid") || exit $?
33# strip quotes
34out=${out#\"} out=${out%\"}
35echo $out
This page took 0.103035 seconds and 4 git commands to generate.