Acabo de crearme un pequeño script para Cacti para contar el número de sesiones CVS establecidas en un momento determinado.
El script es muy simplón y realmente habrÃa mejores formas de hacerlo, pero el caso es que necesitaba contar el número de sesiones CVS y hacerlo con un shell script no me ha llevado más de 2 minutos.
#!/bin/sh
#
# File : CountCVSConnections.sh
# Version : 1.0
# Date : November 22th 2007
# Author : Jorge Tomé Hernando <jorge@jorgetome.info>
#
# Description
# ===========
#
# Connect to a host via SNMP and count the number
# of TCP sessions in state "established" over the
# 2401 port.
#
# Usage
# =====
# CountCVSConnections [COMMUNITY] [HOST]</pre>
<pre>snmpwalk -Os -c $1 -v 1 $2 .1.3.6.1.2.1.6.13.1.1 | \\ # Get the full list of TCP connections
grep -e ".2401..*established" | \\ # Filter the established connections over 2401 port (CVS)
wc -l | \\ # Count the number of connections
awk '{printf "Active CVS connections: " int($1)}' # Print the result

