#!/bin/sh # -*- sh -*- # # Plugin to monitor network connections. # # Parameters: # # config (required) # autoconf (optional - only used by munin-config) # # Bugs: # At least one SuSE netstat appears to report # "passive connections rejected because of time stamp" # We have never seen that, patch requested. # # Magic markers (optional - used by munin-config and some installation # scripts): #%# family=auto #%# capabilities=autoconf if [ "$1" = "autoconf" ]; then if ( netstat -s 2>/dev/null >/dev/null ); then echo yes exit 0 else if [ $? -eq 127 ] then echo "no (netstat program not found)" exit 1 else echo no exit 1 fi fi fi if [ "$1" = "config" ]; then echo 'graph_title Netstat' echo 'graph_args -l 0 --base 1000' echo 'graph_vlabel active connections' echo 'graph_category network' echo 'graph_period second' echo 'graph_info This graph shows the TCP activity of all the network interfaces combined.' echo 'active.label active' echo 'active.type DERIVE' echo 'active.max 50000' echo 'active.min 0' echo 'active.info The number of active TCP openings per second.' echo 'passive.label passive' echo 'passive.type DERIVE' echo 'passive.max 50000' echo 'passive.min 0' echo 'passive.info The number of passive TCP openings per second.' echo 'failed.label failed' echo 'failed.type DERIVE' echo 'failed.max 50000' echo 'failed.min 0' echo 'failed.info The number of failed TCP connection attempts per second.' echo 'resets.label resets' echo 'resets.type DERIVE' echo 'resets.max 50000' echo 'resets.min 0' echo 'resets.info The number of TCP connection resets.' echo 'established.label established' echo 'established.type GAUGE' echo 'established.max 50000' echo 'established.info The number of currently open connections.' exit 0 fi netstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection ope/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'