Friday, November 6, 2009

network snmp check

Snmp is an network monitoring system. Many types of network equipment can be configured to provide snmp information, such as :

  • Uptime
  • Network Interface Descriptions and Types
  • Input and Output errors per interface
  • Routing Information
  • TCP and UDP connection information
  • and much more

a sample of snmptrap alarm script :


#!/bin/sh

TRAPHOST=10.4.8.56
TRAPCOMMUNITY=public
TRAPTIME=`date +%s`

usage()
{
echo " server alarm sender"
echo "usage: $0 "
echo ""
}

case $# in
5)
PROG=$1
PID=$2
LEVEL=$3
FUNC=$4
MSG=$5
;;
*)
usage
exit 1
esac

if [ $# -eq 5 ] ; then
/usr/local/bin/snmptrap -v 2c $TRAPHOST $TRAPCOMMUNITY '' \
server.alarm.0.$LEVEL \
alarmHost s "`hostname` " \
alarmTime t "$TRAPTIME" \



replace the bold TRAPHOST IP address and "server" with the expected IP and hostname.

0 Comment :