1
0
Files
2022-09-29 17:59:04 +03:00

90 lines
2.0 KiB
Bash
Executable File

#! /bin/sh
#
# This script starts then SNMP agents. SNMP support is made
# up of multiple parts. In the front is the Peer Networks
# master agent which handles new requests in SNMPv1 or v2.
# The master agent talks to an encapsulator which forwards
# requests on to agents. Currently we only ship one agent
# with the base operating system, which supports MIB2 and the
# SGI enterprise MIB. We ship subagents for the HP-UX mib
# and the atm mib as layerred products.
#
# Running chkconfig snmpd off/on controls whether the daemons
# are started.
#
# Configuration files for this are:
# peer_snmp.options command line arguments for master agent
# peer_encaps.options command line arguments for encapsulator
# snmpd.options command line arguments for MIB2/SGI sub-agent
# hpsnmpd.options command line arguments for HP-UX sub-agent
#
IS_ON=/sbin/chkconfig
if $IS_ON verbose ; then
ECHO=echo
else
ECHO=:
fi
CONFIG=/etc/config
BINDIR=/usr/etc
case "$1" in
'start')
if $IS_ON snmpd ; then
$ECHO "SNMP Agents:\c"
#
# peer_snmpd is the master agent which deals with SNMP
# protocol conversion.
#
if test -x $BINDIR/peer_snmpd ; then
$BINDIR/peer_snmpd `cat $CONFIG/peer_snmpd.options 2>/dev/null`
$ECHO " peer_snmpd\c"
fi
#
# peer_encaps is an encapsulator to allow the use of SNMPv1
# agents.
#
if test -x $BINDIR/peer_encaps ; then
$BINDIR/peer_encaps `cat $CONFIG/peer_encaps.options 2>/dev/null`
$ECHO " peer_encaps\c"
fi
#
# snmpd - handles MIB2 and the SGI enterprise mib.
#
if test -x $BINDIR/snmpd ; then
$BINDIR/snmpd `cat $CONFIG/snmpd.options 2>/dev/null`
$ECHO " snmpd\c"
fi
#
# hpsnmpd - handles the SGI port of the hp-ux mib.
#
if test -x $BINDIR/hpsnmpd ; then
$BINDIR/hpsnmpd `cat $CONFIG/hpsnmpd.options 2>/dev/null`
$ECHO " hpsnmpd\c"
fi
$ECHO "."
fi
;;
'stop')
#
# Kill all of the agents.
#
/sbin/killall -TERM peer_snmpd peer_encaps snmpd hpsnmpd
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit 0