## sec.name source community 这里需要指定snmp服务器
com2sec http 59.34.XX.XX(#snmp-ip) public
## group.name sec.model sec.name
group MyROGroup any http
# incl/excl
subtree mask
view all included .1 80
## context sec.model sec.level prefix
read write notif
access
MyROGroup "" any noauth 0 all none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root
(configure /etc/snmp/snmp.local.conf)
# Example output of snmpwalk:
% snmpwalk -v 1 localhost -c
public system
system.sysDescr.0 = "SunOS
name sun4c"
system.sysObjectID.0 = OID:
enterprises.ucdavis.ucdSnmpAgent.sunos4
system.sysUpTime.0 =
Timeticks: (595637548) 68 days, 22:32:55
system.sysContact.0 =
"xxle71@ovi.com"
system.sysName.0 =
"name"
system.sysLocation.0 = "Right
here, right now."
system.sysServices.0 = 72
# load average checks
#
load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
#
# 1MAX: If the 1 minute load
average is above this limit at query
# time, the errorFlag will be set.
# 5MAX: Similar, but for 5 min
average.
# 15MAX: Similar, but for 15 min average.
# Check for loads:
load 12 14 14
% snmpwalk -v 1 localhost -c public
.1.3.6.1.4.1.2021.10
enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1
= 1
enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2
= 2
enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3
= 3
enterprises.ucdavis.loadTable.laEntry.loadaveNames.1
= "Load-1"
enterprises.ucdavis.loadTable.laEntry.loadaveNames.2
= "Load-5"
enterprises.ucdavis.loadTable.laEntry.loadaveNames.3
= "Load-15"
enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1
= "0.49" Hex: 30 2E 34 39
enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2
= "0.31" Hex: 30 2E 33 31
enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3
= "0.26" Hex: 30 2E 32 36
enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1
= "12.00"
enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2
= "14.00"
enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3
= "14.00"
enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1
= 0
enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2
= 0
enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3
= 0
enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1
= ""
enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2
= ""
enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3
= ""
###############################################################################
# disk checks
#
# The agent can check the amount of available disk space, and
make
# sure it is above a set limit.
# disk PATH [MIN=100000]
#
# PATH: mount path to the disk in question.
# MIN: Disks with space below
this value will have the Mib's errorFlag set.
# Default value = 100000.
# Check the / partition and make sure it contains at least 10
megs.
disk / 10000
% snmpwalk -v 1 localhost -c public
.1.3.6.1.4.1.2021.9
enterprises.ucdavis.diskTable.dskEntry.diskIndex.1
= 0
enterprises.ucdavis.diskTable.dskEntry.diskPath.1
= "/" Hex: 2F
enterprises.ucdavis.diskTable.dskEntry.diskDevice.1
= "/dev/dsk/c201d6s0"
enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1
= 10000
enterprises.ucdavis.diskTable.dskEntry.diskTotal.1
= 837130
enterprises.ucdavis.diskTable.dskEntry.diskAvail.1
= 316325
enterprises.ucdavis.diskTable.dskEntry.diskUsed.1
= 437092
enterprises.ucdavis.diskTable.dskEntry.diskPercent.1
= 58
enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1
= 0
enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1
= ""
#
-----------------------------------------------------------------------------
###############################################################################
# Process checks.
#
# The following are examples of how to use the
agent to check for
# processes running on the
host. The syntax looks something like:
#
# proc NAME [MAX=0] [MIN=0]
#
# NAME: the name of the process
to check for. It must match
# exactly (ie, http will not find httpd processes).
# MAX: the
maximum number allowed to be running. Defaults to
0.
# MIN: the
minimum number to be running. Defaults to 0.
#
# Examples (commented out by default):
#
# Make sure mountd is running
proc mountd
# Make sure there are no more than 4 ntalkds
running, but 0 is ok too.
proc ntalkd 4
# Make sure at least one sendmail, but less
than or equal to 10 are running.
proc sendmail 10 1
# A snmpwalk of the process mib tree would
look something like this:
#
% snmpwalk -v 1 localhost -c public
.1.3.6.1.4.1.2021.2
enterprises.ucdavis.procTable.prEntry.prIndex.1 =
1
enterprises.ucdavis.procTable.prEntry.prIndex.2 =
2
enterprises.ucdavis.procTable.prEntry.prIndex.3 =
3
enterprises.ucdavis.procTable.prEntry.prNames.1 =
"mountd"
enterprises.ucdavis.procTable.prEntry.prNames.2 =
"ntalkd"
enterprises.ucdavis.procTable.prEntry.prNames.3 =
"sendmail"
enterprises.ucdavis.procTable.prEntry.prMin.1 =
0
enterprises.ucdavis.procTable.prEntry.prMin.2 =
0
enterprises.ucdavis.procTable.prEntry.prMin.3 =
1
enterprises.ucdavis.procTable.prEntry.prMax.1 =
0
enterprises.ucdavis.procTable.prEntry.prMax.2 =
4
enterprises.ucdavis.procTable.prEntry.prMax.3 =
10
enterprises.ucdavis.procTable.prEntry.prCount.1 =
0
enterprises.ucdavis.procTable.prEntry.prCount.2 =
0
enterprises.ucdavis.procTable.prEntry.prCount.3 =
1
enterprises.ucdavis.procTable.prEntry.prErrorFlag.1
= 1
enterprises.ucdavis.procTable.prEntry.prErrorFlag.2
= 0
enterprises.ucdavis.procTable.prEntry.prErrorFlag.3
= 0
enterprises.ucdavis.procTable.prEntry.prErrMessage.1
= "No mountd process running."
enterprises.ucdavis.procTable.prEntry.prErrMessage.2
= ""
enterprises.ucdavis.procTable.prEntry.prErrMessage.3
= ""
enterprises.ucdavis.procTable.prEntry.prErrFix.1
= 0
enterprises.ucdavis.procTable.prEntry.prErrFix.2
= 0
enterprises.ucdavis.procTable.prEntry.prErrFix.3
= 0
#
# Note that the errorFlag for mountd is set to 1
because one is not
# running (in this case an rpc.mountd is, but
thats not good enough),
# and the ErrMessage tells you what's
wrong. The configuration
# imposed in the snmpd.conf file is also
shown. #
# Special Case: When the min
and max numbers are both 0, it assumes
# you want a max of infinity and a min of
1.
#
#
-----------------------------------------------------------------------------