📄 snmpd.conf
字号:
################################################################################# EXAMPLE.conf:# An example configuration file for configuring the ucd-snmp snmpd agent.################################################################################## This file is intended to only be an example. If, however, you want# to use it, it should be placed in /usr/local/etc/snmp/snmpd.conf.# When the snmpd agent starts up, this is where it will look for it.## You might be interested in generating your own snmpd.conf file using# the "snmpconf" program (perl script) instead. It's a nice menu# based interface to writing well commented configuration files. Try it!## Note: This file is automatically generated from EXAMPLE.conf.def.# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run# configure & make, and then make sure you read the EXAMPLE.conf file# instead, as it will tailor itself to your configuration.# All lines beginning with a '#' are comments and are intended for you# to read. All other lines are configuration commands for the agent.## PLEASE: read the snmpd.conf(5) manual page as well!################################################################################# Access Control################################################################################ YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.# By far, the most common question I get about the agent is "why won't# it work?", when really it should be "how do I configure the agent to# allow me to access it?"## By default, the agent responds to the "public" community for read# only access, if run out of the box without any configuration file in # place. The following examples show you other ways of configuring# the agent so that you can change the community names, and give# yourself write access as well.## The following lines change the access permissions of the agent so# that the COMMUNITY string provides read-only access to your entire# NETWORK (EG: 10.10.10.0/24), and read/write access to only the# localhost (127.0.0.1, not its real ipaddress).## For more information, read the FAQ as well as the snmpd.conf(5)# manual page.##### First, map the community name (COMMUNITY) into a security name# (local and mynetwork, depending on where the request is coming# from):# sec.name source communitycom2sec local localhost publiccom2sec mynetwork 192.168.1.0/24 public##### Second, map the security names into group names:# sec.model sec.namegroup MyRWGroup v1 localgroup MyRWGroup v2c localgroup MyRWGroup usm localgroup MyRWGroup usm initialgroup MyROGroup v1 mynetworkgroup MyROGroup v2c mynetworkgroup MyROGroup usm mynetwork##### Third, create a view for us to let the groups have rights to:# incl/excl subtree maskview all included .1 80##### Finally, grant the 2 groups access to the 1 view with different# write permissions:# context sec.model sec.level match read write notifaccess MyROGroup "" any noauth exact all none noneaccess MyRWGroup "" any noauth exact all all none# -----------------------------------------------------------------------------rwuser initial priv createUser initial MD5 auth_pass DES priv_pass################################################################################ System contact information## It is also possible to set the sysContact and sysLocation system# variables through the snmpd.conf file. **PLEASE NOTE** that setting# the value of these objects here makes these objects READ-ONLY# (regardless of any access control settings). Any attempt to set the# value of an object whose value is given here will fail with an error# status of notWritable.# syslocation Right here, right now.syscontact G. S. Marzot <gmarzot@marzot.net># Example output of snmpwalk:# % snmpwalk -v 1 -c public localhost 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 = "Me <me@somewhere.org>"# system.sysName.0 = "name"# system.sysLocation.0 = "Right here, right now."# system.sysServices.0 = 72# -----------------------------------------------------------------------------################################################################################ 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:## Make sure mountd is runningproc 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 prTable would look something like this:# # % snmpwalk -v 1 -c public localhost .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.## -----------------------------------------------------------------------------################################################################################ Executables/scripts### You can also have programs run by the agent that return a single# line of output and an exit code. Here are two examples.## exec NAME PROGRAM [ARGS ...]## NAME: A generic name.# PROGRAM: The program to run. Include the path!# ARGS: optional arguments to be passed to the program# a simple hello worldexec echotest /bin/echo hello world# Run a shell script containing:## #!/bin/sh# echo hello world# echo hi there
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -