#!/bin/bash # receiver-test.sh - run tests for the net-snmp Receiver # Usage: receiver-test.sh [ -6 ] [ -e ] [ -h ] [ -p ] [ -t target ] HOME_DIR=. HOST=localhost PRINT_ONLY=0 CMDS=/var/tmp/receiver-test.$$ TRAP_OID="1.3.6.1.6.3.1.1.5.2" unset ENGINE_ID IPV6=0 # Auth parameters - change as necessary COMMUNITY=public USER_NONE=fred USER_AUTH=betty USER_PRIV=barney AUTH_PROTOCOL=sha AUTH_KEY=illhavesomeauth PRIV_PROTOCOL=aes PRIV_KEY=andsomepriv usage() { echo "Usage: $0 [ -6 ] [ -e ] [ -h ] [ -p ] [ -t target ]" echo echo "Options:" echo " -6 use IPv6" echo " -e engine ID - used for SNMPv3 traps only" echo " -h print usage message and exit" echo " -p print commands but do not run them" echo " -t target host" exit 1 } while getopts "6e:hl:pt:" OPT ; do case ${OPT} in 6) IPV6=1 ;; e) ENGINE_ID=${OPTARG} ;; h) usage ;; p) PRINT_ONLY=1 ;; t) HOST=${OPTARG} ;; esac done shift $((OPTIND - 1)) PARAMS="" if [[ -n ${ENGINE_ID} ]] ; then PARAMS="${PARAMS} -e \"${ENGINE_ID}\"" fi if (( IPV6 )) ; then PARAMS="${PARAMS} -t udp6" fi cat >>${CMDS} <