|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# snmpd.conf:
|
|
|
bc6b3f |
# An example configuration file for configuring the ucd-snmp snmpd agent.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# This file is intended to only be as a starting point. Many more
|
|
|
bc6b3f |
# configuration directives exist than are mentioned in this file. For
|
|
|
bc6b3f |
# full details, see the snmpd.conf(5) manual page.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# All lines beginning with a '#' are comments and are intended for you
|
|
|
bc6b3f |
# to read. All other lines are configuration commands for the agent.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Access Control
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# As shipped, the snmpd demon will only respond to queries on the
|
|
|
bc6b3f |
# system mib group until this file is replaced or modified for
|
|
|
bc6b3f |
# security purposes. Examples are shown below about how to increase the
|
|
|
bc6b3f |
# level of access.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# By far, the most common question I get about the agent is "why won't
|
|
|
bc6b3f |
# it work?", when really it should be "how do I configure the agent to
|
|
|
bc6b3f |
# allow me to access it?"
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# By default, the agent responds to the "public" community for read
|
|
|
bc6b3f |
# only access, if run out of the box without any configuration file in
|
|
|
bc6b3f |
# place. The following examples show you other ways of configuring
|
|
|
bc6b3f |
# the agent so that you can change the community names, and give
|
|
|
bc6b3f |
# yourself write access to the mib tree as well.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# For more information, read the FAQ as well as the snmpd.conf(5)
|
|
|
bc6b3f |
# manual page.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
####
|
|
|
bc6b3f |
# First, map the community name "public" into a "security name"
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# sec.name source community
|
|
|
bc6b3f |
#com2sec notConfigUser default public
|
|
|
bc6b3f |
|
|
|
bc6b3f |
####
|
|
|
bc6b3f |
# Second, map the security name into a group name:
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# groupName securityModel securityName
|
|
|
bc6b3f |
#group notConfigGroup v1 notConfigUser
|
|
|
bc6b3f |
#group notConfigGroup v2c notConfigUser
|
|
|
bc6b3f |
|
|
|
bc6b3f |
####
|
|
|
bc6b3f |
# Third, create a view for us to let the group have rights to:
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Make at least snmpwalk -v 1 localhost -c public system fast again.
|
|
|
bc6b3f |
# name incl/excl subtree mask(optional)
|
|
|
bc6b3f |
view systemview included .1.3.6.1.2.1.1
|
|
|
bc6b3f |
view systemview included .1.3.6.1.2.1.25.1.1
|
|
|
bc6b3f |
|
|
|
bc6b3f |
####
|
|
|
bc6b3f |
# Finally, grant the group read-only access to the systemview view.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# group context sec.model sec.level prefix read write notif
|
|
|
bc6b3f |
access notConfigGroup "" any noauth exact systemview none none
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Here is a commented out example configuration that allows less
|
|
|
bc6b3f |
# restrictive access.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
|
|
|
bc6b3f |
# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
|
|
|
bc6b3f |
# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
## sec.name source community
|
|
|
bc6b3f |
#com2sec local localhost COMMUNITY
|
|
|
bc6b3f |
#com2sec mynetwork NETWORK/24 COMMUNITY
|
|
|
bc6b3f |
|
|
|
bc6b3f |
## group.name sec.model sec.name
|
|
|
bc6b3f |
#group MyRWGroup any local
|
|
|
bc6b3f |
#group MyROGroup any mynetwork
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
#group MyRWGroup any otherv3user
|
|
|
bc6b3f |
#...
|
|
|
bc6b3f |
|
|
|
bc6b3f |
## incl/excl subtree mask
|
|
|
bc6b3f |
#view all included .1 80
|
|
|
bc6b3f |
|
|
|
bc6b3f |
## -or just the mib2 tree-
|
|
|
bc6b3f |
|
|
|
bc6b3f |
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
## context sec.model sec.level prefix read write notif
|
|
|
bc6b3f |
#access MyROGroup "" any noauth 0 all none none
|
|
|
bc6b3f |
#access MyRWGroup "" any noauth 0 all all all
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Sample configuration to make net-snmpd RFC 1213.
|
|
|
bc6b3f |
# Unfortunately v1 and v2c don't allow any user based authentification, so
|
|
|
bc6b3f |
# opening up the default config is not an option from a security point.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# WARNING: If you uncomment the following lines you allow write access to your
|
|
|
bc6b3f |
# snmpd daemon from any source! To avoid this use different names for your
|
|
|
bc6b3f |
# community or split out the write access to a different community and
|
|
|
bc6b3f |
# restrict it to your local network.
|
|
|
bc6b3f |
# Also remember to comment the syslocation and syscontact parameters later as
|
|
|
bc6b3f |
# otherwise they are still read only (see FAQ for net-snmp).
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# First, map the community name "public" into a "security name"
|
|
|
bc6b3f |
# sec.name source community
|
|
|
bc6b3f |
#com2sec notConfigUser default public
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Second, map the security name into a group name:
|
|
|
bc6b3f |
# groupName securityModel securityName
|
|
|
bc6b3f |
#group notConfigGroup v1 notConfigUser
|
|
|
bc6b3f |
#group notConfigGroup v2c notConfigUser
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Third, create a view for us to let the group have rights to:
|
|
|
bc6b3f |
# Open up the whole tree for ro, make the RFC 1213 required ones rw.
|
|
|
bc6b3f |
# name incl/excl subtree mask(optional)
|
|
|
bc6b3f |
#view roview included .1
|
|
|
bc6b3f |
#view rwview included system.sysContact
|
|
|
bc6b3f |
#view rwview included system.sysName
|
|
|
bc6b3f |
#view rwview included system.sysLocation
|
|
|
bc6b3f |
#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus
|
|
|
bc6b3f |
#view rwview included at.atTable.atEntry.atPhysAddress
|
|
|
bc6b3f |
#view rwview included at.atTable.atEntry.atNetAddress
|
|
|
bc6b3f |
#view rwview included ip.ipForwarding
|
|
|
bc6b3f |
#view rwview included ip.ipDefaultTTL
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask
|
|
|
bc6b3f |
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5
|
|
|
bc6b3f |
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex
|
|
|
bc6b3f |
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress
|
|
|
bc6b3f |
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress
|
|
|
bc6b3f |
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType
|
|
|
bc6b3f |
#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState
|
|
|
bc6b3f |
#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger
|
|
|
bc6b3f |
#view rwview included snmp.snmpEnableAuthenTraps
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Finally, grant the group read-only access to the systemview view.
|
|
|
bc6b3f |
# group context sec.model sec.level prefix read write notif
|
|
|
bc6b3f |
#access notConfigGroup "" any noauth exact roview rwview none
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# System contact information
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# It is also possible to set the sysContact and sysLocation system
|
|
|
bc6b3f |
# variables through the snmpd.conf file:
|
|
|
bc6b3f |
|
|
|
bc6b3f |
syslocation Unknown (edit /etc/snmp/snmpd.conf)
|
|
|
bc6b3f |
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Example output of snmpwalk:
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public system
|
|
|
bc6b3f |
# system.sysDescr.0 = "SunOS name sun4c"
|
|
|
bc6b3f |
# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
|
|
|
bc6b3f |
# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
|
|
|
bc6b3f |
# system.sysContact.0 = "Me <me@somewhere.org>"
|
|
|
bc6b3f |
# system.sysName.0 = "name"
|
|
|
bc6b3f |
# system.sysLocation.0 = "Right here, right now."
|
|
|
bc6b3f |
# system.sysServices.0 = 72
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Logging
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# We do not want annoying "Connection from UDP: " messages in syslog.
|
|
|
bc6b3f |
# If the following option is commented out, snmpd will print each incoming
|
|
|
bc6b3f |
# connection, which can be useful for debugging.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
dontLogTCPWrappersConnects yes
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Process checks.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# The following are examples of how to use the agent to check for
|
|
|
bc6b3f |
# processes running on the host. The syntax looks something like:
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# proc NAME [MAX=0] [MIN=0]
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# NAME: the name of the process to check for. It must match
|
|
|
bc6b3f |
# exactly (ie, http will not find httpd processes).
|
|
|
bc6b3f |
# MAX: the maximum number allowed to be running. Defaults to 0.
|
|
|
bc6b3f |
# MIN: the minimum number to be running. Defaults to 0.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Examples (commented out by default):
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Make sure mountd is running
|
|
|
bc6b3f |
#proc mountd
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Make sure there are no more than 4 ntalkds running, but 0 is ok too.
|
|
|
bc6b3f |
#proc ntalkd 4
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Make sure at least one sendmail, but less than or equal to 10 are running.
|
|
|
bc6b3f |
#proc sendmail 10 1
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# A snmpwalk of the process mib tree would look something like this:
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd"
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd"
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail"
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running."
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = ""
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = ""
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Note that the errorFlag for mountd is set to 1 because one is not
|
|
|
bc6b3f |
# running (in this case an rpc.mountd is, but thats not good enough),
|
|
|
bc6b3f |
# and the ErrMessage tells you what's wrong. The configuration
|
|
|
bc6b3f |
# imposed in the snmpd.conf file is also shown.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Special Case: When the min and max numbers are both 0, it assumes
|
|
|
bc6b3f |
# you want a max of infinity and a min of 1.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Executables/scripts
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# You can also have programs run by the agent that return a single
|
|
|
bc6b3f |
# line of output and an exit code. Here are two examples.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# exec NAME PROGRAM [ARGS ...]
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# NAME: A generic name. The name must be unique for each exec statement.
|
|
|
bc6b3f |
# PROGRAM: The program to run. Include the path!
|
|
|
bc6b3f |
# ARGS: optional arguments to be passed to the program
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# a simple hello world
|
|
|
bc6b3f |
|
|
|
bc6b3f |
#exec echotest /bin/echo hello world
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Run a shell script containing:
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# #!/bin/sh
|
|
|
bc6b3f |
# echo hello world
|
|
|
bc6b3f |
# echo hi there
|
|
|
bc6b3f |
# exit 35
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Note: this has been specifically commented out to prevent
|
|
|
bc6b3f |
# accidental security holes due to someone else on your system writing
|
|
|
bc6b3f |
# a /tmp/shtest before you do. Uncomment to use it.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
#exec shelltest /bin/sh /tmp/shtest
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Then,
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest"
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world"
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest"
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world."
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world."
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Note that the second line of the /tmp/shtest shell script is cut
|
|
|
bc6b3f |
# off. Also note that the exit status of 35 was returned.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# disk checks
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# The agent can check the amount of available disk space, and make
|
|
|
bc6b3f |
# sure it is above a set limit.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# disk PATH [MIN=100000]
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# PATH: mount path to the disk in question.
|
|
|
bc6b3f |
# MIN: Disks with space below this value will have the Mib's errorFlag set.
|
|
|
bc6b3f |
# Default value = 100000.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Check the / partition and make sure it contains at least 10 megs.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
#disk / 10000
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0"
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = ""
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# load average checks
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# 1MAX: If the 1 minute load average is above this limit at query
|
|
|
bc6b3f |
# time, the errorFlag will be set.
|
|
|
bc6b3f |
# 5MAX: Similar, but for 5 min average.
|
|
|
bc6b3f |
# 15MAX: Similar, but for 15 min average.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Check for loads:
|
|
|
bc6b3f |
#load 12 14 14
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1"
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5"
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15"
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00"
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00"
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00"
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = ""
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = ""
|
|
|
bc6b3f |
# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = ""
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Extensible sections.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# This alleviates the multiple line output problem found in the
|
|
|
bc6b3f |
# previous executable mib by placing each mib in its own mib table:
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Run a shell script containing:
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# #!/bin/sh
|
|
|
bc6b3f |
# echo hello world
|
|
|
bc6b3f |
# echo hi there
|
|
|
bc6b3f |
# exit 35
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Note: this has been specifically commented out to prevent
|
|
|
bc6b3f |
# accidental security holes due to someone else on your system writing
|
|
|
bc6b3f |
# a /tmp/shtest before you do. Uncomment to use it.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50
|
|
|
bc6b3f |
# enterprises.ucdavis.50.1.1 = 1
|
|
|
bc6b3f |
# enterprises.ucdavis.50.2.1 = "shelltest"
|
|
|
bc6b3f |
# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
|
|
|
bc6b3f |
# enterprises.ucdavis.50.100.1 = 35
|
|
|
bc6b3f |
# enterprises.ucdavis.50.101.1 = "hello world."
|
|
|
bc6b3f |
# enterprises.ucdavis.50.101.2 = "hi there."
|
|
|
bc6b3f |
# enterprises.ucdavis.50.102.1 = 0
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Now the Output has grown to two lines, and we can see the 'hi
|
|
|
bc6b3f |
# there.' output as the second line from our shell script.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Note that you must alter the mib.txt file to be correct if you want
|
|
|
bc6b3f |
# the .50.* outputs above to change to reasonable text descriptions.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Other ideas:
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# exec .1.3.6.1.4.1.2021.51 ps /bin/ps
|
|
|
bc6b3f |
# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top
|
|
|
bc6b3f |
# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# -----------------------------------------------------------------------------
|
|
|
bc6b3f |
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Pass through control.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# Usage:
|
|
|
bc6b3f |
# pass MIBOID EXEC-COMMAND
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# This will pass total control of the mib underneath the MIBOID
|
|
|
bc6b3f |
# portion of the mib to the EXEC-COMMAND.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Note: You'll have to change the path of the passtest script to your
|
|
|
bc6b3f |
# source directory or install it in the given location.
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# Example: (see the script for details)
|
|
|
bc6b3f |
# (commented out here since it requires that you place the
|
|
|
bc6b3f |
# script in the right location. (its not installed by default))
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255
|
|
|
bc6b3f |
# enterprises.ucdavis.255.1 = "life the universe and everything"
|
|
|
bc6b3f |
# enterprises.ucdavis.255.2.1 = 42
|
|
|
bc6b3f |
# enterprises.ucdavis.255.2.2 = OID: 42.42.42
|
|
|
bc6b3f |
# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42
|
|
|
bc6b3f |
# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1
|
|
|
bc6b3f |
# enterprises.ucdavis.255.5 = 42
|
|
|
bc6b3f |
# enterprises.ucdavis.255.6 = Gauge: 42
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5
|
|
|
bc6b3f |
# enterprises.ucdavis.255.5 = 42
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string"
|
|
|
bc6b3f |
# enterprises.ucdavis.255.1 = "New string"
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
|
|
|
bc6b3f |
# For specific usage information, see the man/snmpd.conf.5 manual page
|
|
|
bc6b3f |
# as well as the local/passtest script used in the above example.
|
|
|
bc6b3f |
|
|
|
bc6b3f |
###############################################################################
|
|
|
bc6b3f |
# Further Information
|
|
|
bc6b3f |
#
|
|
|
bc6b3f |
# See the snmpd.conf manual page, and the output of "snmpd -H".
|