Blame FAQ

Packit fcad23
      Frequently Asked Questions (FAQ) for the UCD/Net-SNMP package
Packit fcad23
      =============================================================
Packit fcad23
		       FAQ Author: Dave Shield
Packit fcad23
			Net-SNMP Version: 5.8
Packit fcad23
	    Net-SNMP/UCD-SNMP Project Leader: Wes Hardaker
Packit fcad23
	     Email: net-snmp-coders@lists.sourceforge.net
Packit fcad23
Packit fcad23
TABLE OF CONTENTS
Packit fcad23
=================
Packit fcad23
Packit fcad23
 TABLE OF CONTENTS
Packit fcad23
 GENERAL
Packit fcad23
   What is it?
Packit fcad23
   Where can I get it?
Packit fcad23
   What documentation is available?
Packit fcad23
   Are there binaries available?
Packit fcad23
   What's the difference between UCD-SNMP and Net-SNMP?
Packit fcad23
   What operating systems does it run on?
Packit fcad23
   What happens if mine isn't listed?
Packit fcad23
   Does it run on Windows?
Packit fcad23
   How do I find out about new releases?
Packit fcad23
   How can I find out what other people are doing?
Packit fcad23
   How do I submit a patch or bug report?
Packit fcad23
   Can I reuse the code in my commercial application?
Packit fcad23
   What's the difference between SNMPv1, SNMPv2 and SNMPv3?
Packit fcad23
   What's the difference between SNMPv2 and SNMPv2c?
Packit fcad23
   Which versions of SNMP are supported in this package?
Packit fcad23
   Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)?
Packit fcad23
   How can I monitor my system with SNMP?
Packit fcad23
   Where can I find more information about network management?
Packit fcad23
   What ports does SNMP use?
Packit fcad23
   Is Net-SNMP thread safe?
Packit fcad23
 APPLICATIONS
Packit fcad23
   How do I add a MIB?
Packit fcad23
   How do I add a MIB to the tools?
Packit fcad23
   Why can't I see anything from the agent?
Packit fcad23
   Why doesn't the agent respond?
Packit fcad23
   I can see the system group, but nothing else.  Why?
Packit fcad23
   Why can't I see values in the <ENTERPRISE> tree?
Packit fcad23
   The agent worked for a while, then stopped responding.  Why?
Packit fcad23
   Requesting an object fails with "Unknown Object Identifier"  Why?
Packit fcad23
   Why do I get "noSuchName" when asking for "sysUpTime" (or similar)?
Packit fcad23
   Why do I sometimes get "End of MIB" when walking a tree, and sometimes not?
Packit fcad23
   How do I use SNMPv3?
Packit fcad23
   Why can't I set any variables in the MIB?
Packit fcad23
   Variables seem to disappear when I try to set them.  Why?
Packit fcad23
   Why can't I change sysLocation (or sysContact)?
Packit fcad23
   I get an error when trying to set a negative value - why?
Packit fcad23
   I get an error when trying to query a string-indexed table value - why?
Packit fcad23
   How should I specify string-indexed table values?
Packit fcad23
   How do I send traps and notifications?
Packit fcad23
   How do I receive traps and notifications?
Packit fcad23
   How do I receive SNMPv1 traps?
Packit fcad23
   Why don't I receive incoming traps?
Packit fcad23
   My traphandler script doesn't work when run like this - why not?
Packit fcad23
   How can the agent receive traps and notifications?
Packit fcad23
   How big can an SNMP request (or reply) be?
Packit fcad23
   How can I monitor my systems (disk, memory, etc)?
Packit fcad23
   Applications complain about entries in your example 'snmp.conf' file.  Why?
Packit fcad23
   OK, what should I put in snmp.conf?
Packit fcad23
   How do I specify IPv6 addresses in tools command line arguments?
Packit fcad23
 PERL
Packit fcad23
   What is the purpose of the Perl SNMP module?
Packit fcad23
   Where can I get the Perl SNMP package?
Packit fcad23
   How do I install the Perl SNMP modules?
Packit fcad23
   But compiling this fails! Why?
Packit fcad23
   Compiling the Perl module works OK, but 'make test' fails. Why?
Packit fcad23
   Why can't mib2c (or tkmib) locate SNMP.pm?
Packit fcad23
   Why can't mib2c (or tkmib) load SNMP.so?
Packit fcad23
   Why can't tkmib locate Tk.pm?
Packit fcad23
   Why does your RPM complain about missing Perl modules?
Packit fcad23
   I've got a problem with the Net-SNMP module.  Can you help?
Packit fcad23
 MIBS
Packit fcad23
   Where can I find a MIB compiler?
Packit fcad23
   Why aren't my MIB files being read in?
Packit fcad23
   Where should I put my MIB files?
Packit fcad23
   What does "Cannot find module (XXX-MIB)" mean?
Packit fcad23
   I'm getting answers, but they're all numbers. Why?
Packit fcad23
   What does "unlinked OID" mean?
Packit fcad23
   The parser doesn't handle comments properly. Why not?
Packit fcad23
   How can I get more information about problems with MIB files?
Packit fcad23
   What's this about "too many imported symbols"?
Packit fcad23
   Do I actually need the MIB files?
Packit fcad23
 AGENT
Packit fcad23
   What MIBs are supported?
Packit fcad23
   What protocols are supported?
Packit fcad23
   How do I configure the agent?
Packit fcad23
   How do I remove a MIB from the agent?
Packit fcad23
   I've installed a new MIB file.  Why can't I query it?
Packit fcad23
   How do I add a MIB to the agent?
Packit fcad23
   What's the difference between 'exec', 'sh', 'extend' and 'pass'?
Packit fcad23
   What's the difference between AgentX, SMUX and proxied SNMP?
Packit fcad23
   What is the purpose of 'dlmod'?
Packit fcad23
   Which should I use?
Packit fcad23
   Can I use AgentX when running under Windows?
Packit fcad23
   How can I run AgentX with a different socket address?
Packit fcad23
   How can I turn off SMUX support?
Packit fcad23
   How can I combine two copies of the 'mib2' tree from separate subagents?
Packit fcad23
   What traps are sent by the agent?
Packit fcad23
   Where are these traps sent to?
Packit fcad23
   How can I send a particular trap to selected destinations?
Packit fcad23
   When I run the agent it runs and then quits without staying around. Why?
Packit fcad23
   After a while the agent stops responding, and starts eating CPU time.  Why?
Packit fcad23
   How can I stop other people getting at my agent?
Packit fcad23
   How can I listen on just one particular interface?
Packit fcad23
   The agent is complaining about 'snmpd.conf'.  Where is this?
Packit fcad23
   Why does the agent complain about 'no access control information'?
Packit fcad23
   How do I configure access control?
Packit fcad23
   How do I configure SNMPv3 users?
Packit fcad23
   The 'createUser' line disappears when I start the agent.  Why?
Packit fcad23
   What's the difference between /var/net-snmp and /usr/local/share/snmp?
Packit fcad23
   My new agent is ignoring the old snmpd.conf file. Why?
Packit fcad23
   Where should the snmpd.conf file go?
Packit fcad23
   Why am I getting "Connection refused"?
Packit fcad23
   Why can't I see values in the UCDavis 'extensible' or 'disk' trees?
Packit fcad23
   Why can't I see values in the UCDavis 'memory' or 'vmstat' tree?
Packit fcad23
   What do the CPU statistics mean - is this the load average?
Packit fcad23
   How do I get percentage CPU utilization using ssCpuRawIdle?
Packit fcad23
   What about multi-processor systems?
Packit fcad23
   The speed/type of my network interfaces is wrong - how can I fix it?
Packit fcad23
   The interface statistics for my subinterfaces are all zero - why?
Packit fcad23
   Does the agent support the RMON-MIB?
Packit fcad23
   What does "klread:  bad address" mean?
Packit fcad23
   What does "nlist err:  wombat not found" (or similar) mean?
Packit fcad23
   What does "Can't open /dev/kmem" mean?
Packit fcad23
   The system uptime (sysUpTime) returned is wrong!
Packit fcad23
   Can the agent run multi-threaded?
Packit fcad23
   Can I use AgentX (or an embedded SNMP agent) in a threaded application?
Packit fcad23
 COMPILING
Packit fcad23
   How do I control the environment used to compile the software?
Packit fcad23
   How do I control the environment used to compile the software under Windows?
Packit fcad23
   Why does the compilation complain about missing libraries?
Packit fcad23
   How can I reduce the memory footprint?
Packit fcad23
   How can I reduce the installation footprint or speed up compilation?
Packit fcad23
   How can I compile the project for use on an embedded system?
Packit fcad23
   How can I compile the project to use static linking?
Packit fcad23
   Why does 'make test' skip various tests?
Packit fcad23
   Why does 'make test' complain about a pid file?
Packit fcad23
 CODING
Packit fcad23
   How do I write C code to integrate with the agent?
Packit fcad23
   How does the agent fetch the value of a MIB variable from the system?
Packit fcad23
   Mib2c complains about a missing "mib reference" - what does this mean?
Packit fcad23
   Mib2c complains about not having a "valid OID" - what does this mean?
Packit fcad23
   Why doesn't mib2c like the MIB file I'm giving it?
Packit fcad23
   Mib2c ignores my MIB and generates a pair of 'mib-2' code files.  Why?
Packit fcad23
   What's the difference between the various mib2c configuration files?
Packit fcad23
   Which mib2c configuration file should I use?
Packit fcad23
   How can I have mib2c generate code for both scalars and tables?
Packit fcad23
   Are there any examples, or documentation for developing MIB modules?
Packit fcad23
   Where should I put the files produced by 'mib2c'?
Packit fcad23
   Why doesn't my new MIB module report anything?
Packit fcad23
   Why does the iterator call my get_{first,next} routines so often?
Packit fcad23
   How can I get the agent to generate a trap (or inform)?
Packit fcad23
   How can I get an AgentX sub-agent to generate a trap (or inform)?
Packit fcad23
   How can I get the agent to send an SNMPv1 (or SNMPv2c) trap?
Packit fcad23
   How can I get the agent to include varbinds with an SNMPv1 trap?
Packit fcad23
   How can I get the agent to send an SNMPv1 enterprise-specific trap?
Packit fcad23
   How can I get the agent to send an SNMPv3 trap (or inform)?
Packit fcad23
   Why does calling 'send_v2trap' generate an SNMPv1 trap (or vice versa)?
Packit fcad23
   How can I register a MIB module in a different (SNMPv3) context?
Packit fcad23
 MISC
Packit fcad23
   What ASN.1 parser is used?
Packit fcad23
   What is the Official Slogan of the net-snmp-coders list?
Packit fcad23
Packit fcad23
Packit fcad23
GENERAL
Packit fcad23
=======
Packit fcad23
Packit fcad23
What is it?
Packit fcad23
----------
Packit fcad23
Packit fcad23
  - Various tools relating to the Simple Network Management Protocol
Packit fcad23
    including:
Packit fcad23
Packit fcad23
	* An extensible agent
Packit fcad23
	* An SNMP library
Packit fcad23
	* tools to request or set information from SNMP agents
Packit fcad23
	* tools to generate and handle SNMP traps
Packit fcad23
	* a version of the unix 'netstat' command using SNMP
Packit fcad23
	* a graphical Perl/Tk/SNMP based mib browser
Packit fcad23
Packit fcad23
    This package is originally based on the Carnegie Mellon University
Packit fcad23
    SNMP implementation (version 2.1.2.1), but has developed significantly
Packit fcad23
    since then.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where can I get it?
Packit fcad23
------------------
Packit fcad23
Packit fcad23
  Download:
Packit fcad23
    - http://www.net-snmp.org/download/
Packit fcad23
  Web page:
Packit fcad23
    - http://www.net-snmp.org/
Packit fcad23
  Sourceforge Project page:
Packit fcad23
    - http://www.net-snmp.org/project/
Packit fcad23
  Mirrors (note that sourceforge download servers are mirrored themselves):
Packit fcad23
    - Greece:      ftp://ftp.ntua.gr/pub/net/snmp/net-snmp/
Packit fcad23
Packit fcad23
Packit fcad23
What documentation is available?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
	This FAQ (!)
Packit fcad23
	README and individual READMEs for various platforms
Packit fcad23
	README.thread (discusses threading issues)
Packit fcad23
	INSTALL
Packit fcad23
	PORTING
Packit fcad23
	EXAMPLE.conf
Packit fcad23
	man pages for the individual tools, files and the API
Packit fcad23
	A guide for extending the agent
Packit fcad23
	Tutorials for both ucd-snmp v4 and net-snmp v5
Packit fcad23
           at  http://www.net-snmp.org/tutorial/
Packit fcad23
           and http://www.net-snmp.org/tutorial-5/ respectively
Packit fcad23
Packit fcad23
      Most of this documentation (plus archives of the mailing lists)
Packit fcad23
	 is also available on our web page:
Packit fcad23
Packit fcad23
        	http://www.net-snmp.org/
Packit fcad23
Packit fcad23
      There is also a Wiki (including a community-maintained version
Packit fcad23
      of this FAQ) at
Packit fcad23
Packit fcad23
                http://www.net-snmp.org/wiki/
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Are there binaries available?
Packit fcad23
----------------------------
Packit fcad23
Packit fcad23
  There are binaries for some versions/systems available under
Packit fcad23
  the "net-snmp binaries" package on the SourceForge "Files"
Packit fcad23
  page, which is linked to from the main project download web
Packit fcad23
  page at http://www.net-snmp.org/download.html.
Packit fcad23
Packit fcad23
  These binaries are also available on the project FTP site,
Packit fcad23
  with a link on the same web page.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What's the difference between UCD-SNMP and Net-SNMP?
Packit fcad23
---------------------------------------------------
Packit fcad23
Packit fcad23
  Not a great deal, really.
Packit fcad23
  Although the project originally started at UC Davis (hence the name),
Packit fcad23
  and it has always been based there, most of the contributors have had
Packit fcad23
  little or no connection with this institution.
Packit fcad23
Packit fcad23
    The move to SourceForge was intended to provide a more flexible
Packit fcad23
  environment for the project, and to distribute the administrative
Packit fcad23
  workload more evenly.  The change of name simply reflects this move,
Packit fcad23
  which was the last remaining link with UC Davis.
Packit fcad23
Packit fcad23
    The 4.2.x line saw the last releases made using the ucd-snmp name,
Packit fcad23
  and all releases on this line have been been bug-fixes only.  Release
Packit fcad23
  5.0 was the first version released under the Net-SNMP name, and all
Packit fcad23
  further development is being done on the 5.x code base.  The 4.2.x
Packit fcad23
  code line is now effectively closed down, as are the older 5.x branches.
Packit fcad23
Packit fcad23
    Much of the work done for the various 5.x releases has involved
Packit fcad23
  some fairly significant changes to the code - in particular the
Packit fcad23
  architecture of the agent.  However attempts have been made to retain
Packit fcad23
  backwards compatibility as much as possible, and most code written
Packit fcad23
  for earlier releases should continue to work.  The most visible
Packit fcad23
  change from the 4.2.x UCD suite to the 5.x Net-SNMP releases was a
Packit fcad23
  restructuring of the header file organisation - not least a change
Packit fcad23
  from <ucd-snmp/xxx.h> to <net-snmp/yyy.h>.
Packit fcad23
Packit fcad23
    But given the maturity of the Net-SNMP code, this should be less
Packit fcad23
  of a consideration for most current SNMP development projects.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What operating systems does it run on?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  Both the applications and the agent have been reported as running
Packit fcad23
  (at least in part) on the following operating systems:
Packit fcad23
Packit fcad23
	* Linux (kernels 2.6 to 1.3)
Packit fcad23
	* Solaris/SPARC (11 to 2.3), Solaris/Intel (10, 9) -- see 
Packit fcad23
	  README.solaris
Packit fcad23
	* HP-UX (11.31 to 9.01) -- see README.hpux11
Packit fcad23
	* Mac OS X (10.5 to 10.1) -- see README.osX
Packit fcad23
	* NetBSD (2.0 to 1.0)
Packit fcad23
	* FreeBSD (7.0 to 2.2)
Packit fcad23
	* OpenBSD (4.0 to 2.6)
Packit fcad23
	* BSDi (4.0.1 to 2.1)
Packit fcad23
	* AIX (6.1, 5.3, 5.2, 5.1, 4.3.3, 4.1.5, 3.2.5) -- see README.aix
Packit fcad23
	* IRIX (6.5 to 5.1)
Packit fcad23
	* OSF (4.0, 3.2 and Tru64 Unix 5.1B) -- see README.tru64
Packit fcad23
	* SunOS 4 (4.1.4 to 4.1.2)
Packit fcad23
	* Ultrix (4.5 to 4.2)
Packit fcad23
	* Dynix/PTX 4.4
Packit fcad23
	* QNX 6.2.1A
Packit fcad23
Packit fcad23
  We have also been informed about a port to the Stratus VOS.
Packit fcad23
  See http://ftp.stratus.com/vos/network/network.html for details.
Packit fcad23
Packit fcad23
  See the next question but one for the status of Windows support.
Packit fcad23
Packit fcad23
  Certain systems fail to compile particular portions of the agent.
Packit fcad23
  These can usually be persuaded to compile (at the loss of some
Packit fcad23
  functionality) by omitting the modules affected.
Packit fcad23
  See the next question for more details.
Packit fcad23
Packit fcad23
  Also note that the presence of a particular configuration in this
Packit fcad23
  list does not imply a perfect or complete implementation.  This
Packit fcad23
  is simply what various people have reported as seeming to work.
Packit fcad23
 (Or more frequently, the configurations where people have reported
Packit fcad23
  problems that we think we've subsequently fixed!)
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What happens if mine isn't listed?
Packit fcad23
---------------------------------
Packit fcad23
Packit fcad23
  It's probably worth trying to compile it anyway.  Unless your
Packit fcad23
  system is significantly different to the supported configurations,
Packit fcad23
  most of the code (library, applications and the agent infrastructure)
Packit fcad23
  should probably compile with little or no difficulty.  The most
Packit fcad23
  likely source of problems will be MIB modules within the agent,
Packit fcad23
  as this tends to be where the most system-specific code is found.
Packit fcad23
Packit fcad23
    If only a few modules fail to compile, try removing them from
Packit fcad23
  the agent by running "configure --with-out-mib-module=xxx,yyy",
Packit fcad23
  and re-compiling.  If a large number of modules fail, then it
Packit fcad23
  might be easier to start from a relatively bare system, using
Packit fcad23
  "configure --enable-mini-agent --with-defaults".  Then if this
Packit fcad23
  minimal agent compiles and runs successfully, try adding each of
Packit fcad23
  the missing mibgroups individually using the configure option
Packit fcad23
  '--with-mib-module'.
Packit fcad23
  
Packit fcad23
    If configure fails with "invalid configuration" messages, or
Packit fcad23
  you get completely stuck, contact the coders list for advice.
Packit fcad23
  Similarly, if you manage to get this working on a new system,
Packit fcad23
  please let us know of any code changes that you needed to make,
Packit fcad23
  together with details of the hardware you're using, and what
Packit fcad23
  versions of the operating system you've tried it on.  The entry
Packit fcad23
  'host' in the file 'config.status' should show this information.
Packit fcad23
  Oh, and congratulations!
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Does it run on Windows?
Packit fcad23
----------------------
Packit fcad23
Packit fcad23
    The suite should compile and run on Win32 platforms, including
Packit fcad23
  the library, command-line tools and the basic agent framework.
Packit fcad23
  Note that the agent now includes support for the MIB-II module,
Packit fcad23
  but this requires Microsoft's Core Platform SDK.  Instructions
Packit fcad23
  for how to install this are given in README.win32.
Packit fcad23
Packit fcad23
    Pre-compiled binaries are available from the project web site.
Packit fcad23
Packit fcad23
    As of v5.4, the Net-SNMP agent is able to load the Windows SNMP
Packit fcad23
  service extension DLLs by using the Net-SNMP winExtDLL extension.
Packit fcad23
Packit fcad23
    Some other Net-SNMP MIB modules, including the UCD pass-through
Packit fcad23
  extensions, do not currently work under Windows.  Volunteers to assist
Packit fcad23
  with these missing modules are likely to welcomed with open arms :-)
Packit fcad23
Packit fcad23
    Further details of Windows support (currently Visual C++, MinGW
Packit fcad23
  and Cygnus cygwin32) is available in the file README.win32.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I find out about new releases?
Packit fcad23
------------------------------------
Packit fcad23
Packit fcad23
  There is a mailing list for these announcements
Packit fcad23
Packit fcad23
  	net-snmp-announce@lists.sourceforge.net
Packit fcad23
Packit fcad23
  To be added to (or removed from) this list, visit
Packit fcad23
        http://www.net-snmp.org/lists/net-snmp-announce/
Packit fcad23
  Or you can send a message to the address
Packit fcad23
        net-snmp-announce-request@lists.sourceforge.net
Packit fcad23
  with a subject line of 'subscribe' (or 'unsubscribe' as appropriate).
Packit fcad23
Packit fcad23
  Advance notice of upcoming releases are also made on the
Packit fcad23
  net-snmp-users list (for "release candidates") for a week
Packit fcad23
  or two before the full release, and on the net-snmp-coders
Packit fcad23
  list (for "pre-releases") during the period prior to this.
Packit fcad23
Packit fcad23
  Major code revisions may be announced more widely, but these
Packit fcad23
  lists are the most reliable way to keep in touch with the
Packit fcad23
  status of the package.
Packit fcad23
Packit fcad23
  Patches to fix known problems are also made available via the web site:
Packit fcad23
Packit fcad23
        http://www.net-snmp.org/patches/
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I find out what other people are doing?
Packit fcad23
----------------------------------------------
Packit fcad23
Packit fcad23
  There is a general purpose discussion list
Packit fcad23
Packit fcad23
  	net-snmp-users@lists.sourceforge.net
Packit fcad23
Packit fcad23
  To be added to (or removed from) this list, visit
Packit fcad23
        http://www.net-snmp.org/lists/net-snmp-users/
Packit fcad23
  Or you can send a message to the address
Packit fcad23
        net-snmp-users-request@lists.sourceforge.net
Packit fcad23
  with a subject line of 'subscribe' (or 'unsubscribe' as appropriate).
Packit fcad23
Packit fcad23
  To find out what the developers are doing, and to help them
Packit fcad23
  out, please read the PORTING file enclosed with the package.
Packit fcad23
Packit fcad23
  There is also a #net-snmp IRC channel set up on the freenode.net
Packit fcad23
  chat system.  You can connect to this via chat.freenode.net.
Packit fcad23
  See http://www.freenode.net/ for more information on getting
Packit fcad23
  started with IRC.
Packit fcad23
    Several core developers hang out on this channel on a fairly
Packit fcad23
  regular basis.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I submit a patch or bug report?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  The best way to submit a bug report is via the bug database through
Packit fcad23
  the interface found at
Packit fcad23
         http://www.net-snmp.org/bugs/
Packit fcad23
  Be sure to include the version of the package that you've been working
Packit fcad23
  with, the output of the command 'uname -a', the precise configuration
Packit fcad23
  or command that triggers the problem and a copy of any output produced.
Packit fcad23
Packit fcad23
    Questions about using the package should be directed at the
Packit fcad23
  net-snmp-users@lists.sourceforge.net mailing list.  Note that this
Packit fcad23
  mailing list is relatively busy, and the people answering these
Packit fcad23
  questions are doing so out of the goodness of their hearts, and in
Packit fcad23
  addition to their main employment.  Please note the following:
Packit fcad23
Packit fcad23
     - use plain text mail, rather than HTML
Packit fcad23
     - don't resend questions more than once
Packit fcad23
          (even if no-one answered immediately)
Packit fcad23
     - include full details of exact commands and error messages
Packit fcad23
          ("I've tried everything, and it doesn't work" isn't much use!)
Packit fcad23
     - do *NOT* send messages to -users and -coders mailing lists
Packit fcad23
          (most developers read both anyway)
Packit fcad23
     - don't mail the developers privately - keep everything on the list
Packit fcad23
Packit fcad23
    We can't promise to be able to solve all problems, but we'll
Packit fcad23
  certainly try and help.  But remember that this is basically an
Packit fcad23
  unsupported package.  It's Open Source, so if you need something
Packit fcad23
  fixing badly enough,  fundamentally it's up to you to do the work.
Packit fcad23
Packit fcad23
    All patches should be submitted to the patch manager at
Packit fcad23
         http://www.net-snmp.org/patches/
Packit fcad23
  If possible, submit a bug report describing the patch as well
Packit fcad23
  (referencing it by its patch number) since the patch manager
Packit fcad23
  doesn't contain a decent description field.
Packit fcad23
Packit fcad23
  The best way to submit patch (diff) information is by checking out
Packit fcad23
  the current code from the development git trunk, making your changes
Packit fcad23
  and then running "git diff" or "git format-patch" after you're done.
Packit fcad23
Packit fcad23
  (Please see http://www.net-snmp.org/wiki/index.php/Git for further
Packit fcad23
  information on using git with the Net-SNMP project)
Packit fcad23
Packit fcad23
  If you're working from a source code distribution, and comparing old
Packit fcad23
  and new versions of a code file, use "diff -u OLDFILE NEWFILE" 
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Can I reuse the code in my commercial application?
Packit fcad23
-------------------------------------------------
Packit fcad23
Packit fcad23
  The details of the COPYRIGHTs on the package can be found in the COPYING
Packit fcad23
  file.  You should have your lawyer read this file if you wish to use the
Packit fcad23
  code in your commercial application.  We will not summarize here what is
Packit fcad23
  in the file, as we're not lawyers and are unqualified to do so.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What's the difference between SNMPv1, SNMPv2 and SNMPv3?
Packit fcad23
-------------------------------------------------------
Packit fcad23
What's the difference between SNMPv2 and SNMPv2c?
Packit fcad23
------------------------------------------------
Packit fcad23
Packit fcad23
  A full description is probably beyond the scope of this FAQ.
Packit fcad23
  Very briefly, the original protocol and admin framework was
Packit fcad23
  described in RFCs 1155-1157, and is now known as SNMPv1.
Packit fcad23
Packit fcad23
    Practical experience showed up various problems and deficiencies
Packit fcad23
  with this, and a number of revised frameworks were developed to try
Packit fcad23
  and address these problems.  Unfortunately, it proved difficult to
Packit fcad23
  achieve any sort of agreement - particularly over the details of
Packit fcad23
  the administrative framework to use.
Packit fcad23
Packit fcad23
    There was less disagreement over the proposed changes to the
Packit fcad23
  protocol operations.  These included:
Packit fcad23
        * increasing the range of errors that could be reported
Packit fcad23
        * introducing "exception values"
Packit fcad23
            (so a single missing value didn't affect
Packit fcad23
             the other varbinds in the same request)
Packit fcad23
        * a new GETBULK operation
Packit fcad23
            (a supercharged GETNEXT)
Packit fcad23
        * new notification PDUs
Packit fcad23
            (closer in structure to the other request PDUs)
Packit fcad23
Packit fcad23
  Strictly speaking, it's this revised protocol (originally defined
Packit fcad23
  in RFC 1905, and most recently in RFC 3416) that is "SNMPv2".
Packit fcad23
Packit fcad23
  The only framework based on this protocol that saw a significant
Packit fcad23
  level of use was "Community-based SNMPv2" or "SNMPv2c" (defined
Packit fcad23
  in RFC 1901). This retained the same administrative framework
Packit fcad23
  as SNMPv1 (with all of the accompanying limitations), but using
Packit fcad23
  the new protocol operations.
Packit fcad23
Packit fcad23
  More recently, a new administrative framework has been developed,
Packit fcad23
  building on the various competing SNMPv2 proposals, and using the
Packit fcad23
  same SNMPv2 protocol operations.  This is SNMPv3, which is defined
Packit fcad23
  in RFCs 3411-3418.    It addresses some of the deficiencies of the
Packit fcad23
  community-based versions, including significant improvements to
Packit fcad23
  the security of SNMP requests (like it finally has some!).
Packit fcad23
     SNMPv3 is now a full IETF standard protocol.
Packit fcad23
Packit fcad23
  Strictly speaking, SNMPv3 just defines a fairly abstract framework,
Packit fcad23
  based around the idea of "Security Models" and "Access Control Models".
Packit fcad23
  It's this combination of SNMPv3 plus accompanying models that actually
Packit fcad23
  provides a working SNMP system.
Packit fcad23
     However, the only models in common use are the "User-based Security
Packit fcad23
  Model" (RFC 3414) and the "View-based Access Control Model" (RFC 3415).
Packit fcad23
  So "SNMPv3" is frequently used to mean the combination of the basic
Packit fcad23
  SNMPv3 framework with these two particular models.
Packit fcad23
     This is also sometimes described as "SNMPv3/USM".
Packit fcad23
Packit fcad23
Packit fcad23
  So in brief:
Packit fcad23
        - SNMPv2c updated the protocol operations
Packit fcad23
                  but left the administrative framework unchanged.
Packit fcad23
        - SNMPv3  updated the administrative framework
Packit fcad23
                  but left the protocol operations unchanged.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Which versions of SNMP are supported in this package?
Packit fcad23
----------------------------------------------------
Packit fcad23
Packit fcad23
  This package currently supports the original SNMPv1 (RFC 1157),
Packit fcad23
  Community-based SNMPv2 (RFCs 1901-1908), and SNMPv3 (RFCs 3411-3418).
Packit fcad23
    The agent will respond to requests using any of these protocols,
Packit fcad23
  and all the tools take a command-line option to determine which
Packit fcad23
  version to use.
Packit fcad23
Packit fcad23
  Support for SNMPv2 classic (a.k.a. "SNMPv2 historic" - RFCs 1441-1452)
Packit fcad23
  was dropped with the 4.0 release of the UCD-snmp package.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)?
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
    Yes.
Packit fcad23
Packit fcad23
    The syntax used to specify a MIB file (better referred
Packit fcad23
  to as SMIv1 or SMIv2) is purely concerned with how to define
Packit fcad23
  the characteristics of various management objects.  This is
Packit fcad23
  (almost) completely unrelated to the versions of the protocol
Packit fcad23
  used to operate on these values.  So it is quite reasonable to
Packit fcad23
  use SNMPv1 requests on objects defined using SMIv2, or SNMPv2
Packit fcad23
 (or SNMPv3) requests on objects defined using SMIv1.
Packit fcad23
Packit fcad23
    The one exception is objects of syntax Counter64, which are
Packit fcad23
  only accessible using SNMPv2 or higher.  SNMPv1 requests will
Packit fcad23
  either treat such objects as an error, or skip them completely.
Packit fcad23
Packit fcad23
  Note that SMIv1 is effectively obsolete, and all new MIBs
Packit fcad23
  should be written using SMIv2.
Packit fcad23
Packit fcad23
  
Packit fcad23
Packit fcad23
How can I monitor my system with SNMP?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  There are two main methods of using SNMP for monitoring.  One is to regularly
Packit fcad23
  query the SNMP agent for information of interest, graphing these values and/or
Packit fcad23
  saving them for later analysis.  That's not really the focus of the Net-SNMP
Packit fcad23
  project - our tools are more low-level, single-shot commands.  For this sort
Packit fcad23
  of high-level management, you're really looking at a management console
Packit fcad23
  application (such as Nagios or OpenNMS), or a data logging application
Packit fcad23
  (such as RRDtool, or one of its front-ends - MRTG, Cacti, etc).
Packit fcad23
Packit fcad23
  The other approach is to configure the SNMP agent to monitor the relevant
Packit fcad23
  information itself, and issue an alert when the values pass suitable limits.
Packit fcad23
  See the section ACTIVE MONITORING in the snmpd.conf(5) man page for details.
Packit fcad23
Packit fcad23
  Note that this entry makes no reference as to _what_ you should monitor, or
Packit fcad23
  what values might be significant.  That's because it is impossible to provide
Packit fcad23
  a universal answer to these questions.  The information to monitor, and the
Packit fcad23
  normal operating values will ultimately depend on your local environment.
Packit fcad23
  SNMP is simply a tool to _help_ you manage your systems - it isn't a magic
Packit fcad23
  panacea - you still have to think for yourself!
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where can I find more information about network management?
Packit fcad23
----------------------------------------------------------
Packit fcad23
Packit fcad23
  There are a number of sites with network management information on
Packit fcad23
  the World Wide Web.  Some of the most useful are
Packit fcad23
Packit fcad23
      http://www.simpleweb.org/
Packit fcad23
      http://www.snmplink.org/
Packit fcad23
      http://www.mibdepot.com/
Packit fcad23
Packit fcad23
  The SNMP Usenet newsgroup is now mostly defunct, but although the
Packit fcad23
  FAQ hasn't been updated for a while, it still contains a large
Packit fcad23
  amount of useful information relating to SNMP, including books,
Packit fcad23
  software, other sites, how to get an enterprise number, etc, etc.
Packit fcad23
  This is available from
Packit fcad23
Packit fcad23
      ftp://rtfm.mit.edu/pub/usenet/comp.protocols.snmp/
Packit fcad23
Packit fcad23
  or via any of the Web sites above.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What ports does SNMP use?
Packit fcad23
------------------------
Packit fcad23
Packit fcad23
  There are three main network ports (and one named socket), which are 
Packit fcad23
  typically used by SNMP.  These are:
Packit fcad23
Packit fcad23
    - UDP port 161       - SNMP requests (GET* and SET)
Packit fcad23
    - UDP port 162       - SNMP notifications  (Traps/Informs)
Packit fcad23
    - TCP port 705       - AgentX
Packit fcad23
    - /var/agentx/master - AgentX
Packit fcad23
Packit fcad23
  However, these are simply the default "well-known" ports for these purposes,
Packit fcad23
  and it is perfectly possible to accept requests on other ports.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Is Net-SNMP thread safe?
Packit fcad23
-----------------------
Packit fcad23
Packit fcad23
  Strictly speaking, no.  However, it is possible to use the library within
Packit fcad23
  a multi-threaded management application.  This is covered in detail in
Packit fcad23
  the file README.thread (shipped with the standard distribution), but can
Packit fcad23
  be summarised as follows:
Packit fcad23
Packit fcad23
    -	Call 'snmp_sess_init()' prior to activating any threads.
Packit fcad23
	This reads in and parses MIB information (which isn't thread-safe)
Packit fcad23
	as well as preparing a session structure for subsequent use.
Packit fcad23
Packit fcad23
    -	Open an SNMP session using 'snmp_sess_open()' which returns an
Packit fcad23
	opaque session handle, which is essentially independent of any
Packit fcad23
	other sessions (regardless of thread).
Packit fcad23
Packit fcad23
    -	Resource locking is not handled within the library, and is the
Packit fcad23
	responsibility of the main application.
Packit fcad23
Packit fcad23
  The Net-SNMP agent has not been designed for multi-threaded use.  It
Packit fcad23
  should be safe to use the agent library to embed a subagent within a
Packit fcad23
  threaded application as long as *all* SNMP-related activity (including
Packit fcad23
  generating traps, and parsing MIBs) is handled within a single thread.
Packit fcad23
Packit fcad23
  The command-line tools shipped as part of the Net-SNMP distribution
Packit fcad23
  are simple single-threaded applications, and are not designed for
Packit fcad23
  multi-threaded use.  Adapting these to a threaded model is left as
Packit fcad23
  an exercise for the student.
Packit fcad23
    The same holds true for the notification receiver (snmptrapd).
Packit fcad23
Packit fcad23
  Unfortunately, the SNMPv3 support was added about the same time as
Packit fcad23
  the thread support and since they occurred in parallel the SNMPv3
Packit fcad23
  support was never checked for multi-threading correctness.  It is
Packit fcad23
  most likely that it is not thread-safe at this time.
Packit fcad23
Packit fcad23
Packit fcad23
APPLICATIONS
Packit fcad23
============
Packit fcad23
Packit fcad23
How do I add a MIB?
Packit fcad23
------------------
Packit fcad23
Packit fcad23
  This is actually two separate questions, depending on whether you
Packit fcad23
  are referring to the tools, or the agent (or both).
Packit fcad23
    See the next question or the next section respectively.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I add a MIB to the tools?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
  Adding a MIB to the client-side tools has two main effects:
Packit fcad23
Packit fcad23
    -  it allows you to refer to MIB objects by name
Packit fcad23
         (rather than having to use the numeric OIDs)
Packit fcad23
    -  it allows the results to be displayed in a more immediately
Packit fcad23
       meaningful fashion.  Not just giving the object names, but
Packit fcad23
       also showing named enumeration values, and interpreting table
Packit fcad23
       indexes properly (particularly for string and OID index values).
Packit fcad23
       
Packit fcad23
  There are two steps required to add a new MIB file to the tools.
Packit fcad23
  Firstly, copy the MIB file into the appropriate location:
Packit fcad23
Packit fcad23
	cp MY-MIB.txt /usr/local/share/snmp/mibs
Packit fcad23
            (which makes it available to everyone on the system)
Packit fcad23
    or
Packit fcad23
        mkdir $HOME/.snmp
Packit fcad23
        mkdir $HOME/.snmp/mibs
Packit fcad23
	cp MY-MIB.txt $HOME/.snmp/mibs
Packit fcad23
            (which makes it available to you only)
Packit fcad23
Packit fcad23
  Note that the location of the shared MIB directory may be different
Packit fcad23
  from that given here - see the FAQ entry "Where should I put my MIB
Packit fcad23
  files?" for more information.
Packit fcad23
Packit fcad23
Packit fcad23
  Secondly, tell the tools to load this MIB:
Packit fcad23
Packit fcad23
        snmpwalk -m +MY-MIB .....
Packit fcad23
            (load it for this command only)
Packit fcad23
    or
Packit fcad23
	export MIBS=+MY-MIB
Packit fcad23
            (load it for this session only)
Packit fcad23
    or
Packit fcad23
        echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf
Packit fcad23
            (load it every time)
Packit fcad23
Packit fcad23
  Note that the value for this variable is the name of the MIB
Packit fcad23
  module, *not* the name of the MIB file.   These are typically the
Packit fcad23
  same (apart from the .txt suffix), but if in doubt, check the contents
Packit fcad23
  of the file.  The value to use is the token immediately before the
Packit fcad23
  word DEFINITIONS at the start of the file.
Packit fcad23
Packit fcad23
  Or use the special value "all" to have the tools load all available
Packit fcad23
  MIBs (which may slow them down, particularly if you have a large
Packit fcad23
  number of MIB files.
Packit fcad23
Packit fcad23
  Note that you need *both* steps.
Packit fcad23
Packit fcad23
Packit fcad23
  Adding a MIB in this way does *not* mean that the agent will
Packit fcad23
  automatically return values from this MIB.  The agent needs to be
Packit fcad23
  explicitly extended to support the new MIB objects, which typically
Packit fcad23
  involves writing new code.
Packit fcad23
    See the AGENT section for details.
Packit fcad23
Packit fcad23
  Most of the tools (apart from 'snmptable') will work quite happily
Packit fcad23
  without any MIB files at all - although the results won't be displayed
Packit fcad23
  in quite the same way.  Similarly, the agent doesn't need MIB files
Packit fcad23
  either (other than to handle MIB object names in the configuration file).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't I see anything from the agent?
Packit fcad23
---------------------------------------
Packit fcad23
Packit fcad23
  Fundamentally, there are two basic reasons why a request may go
Packit fcad23
  unanswered.  Either the management application does not like the
Packit fcad23
  request (so never sends it), or the agent does not like the request
Packit fcad23
  (so never responds).  The simplest way to distinguish between the
Packit fcad23
  two is to run the command with the command-line option '-d'.
Packit fcad23
Packit fcad23
  If this doesn't display a hex dump of the raw outgoing packet, then
Packit fcad23
  it's the client side which is dropping the request.  Hopefully you
Packit fcad23
  should also see an error message, to help identify what's wrong.
Packit fcad23
Packit fcad23
  If this displays one or more outgoing dumps (but nothing coming back),
Packit fcad23
  then the request is failing at the agent end.  See the next entry for
Packit fcad23
  more details.
Packit fcad23
Packit fcad23
Packit fcad23
    There are three further possibilities to consider:
Packit fcad23
Packit fcad23
  One is that the agent may return a response to the original query,
Packit fcad23
  but the management application may not like this response, and refuse
Packit fcad23
  to display it.  This is relatively unusual, and typically indicates
Packit fcad23
  a flaw with the remote agent.  (I hope you're not contemplating the
Packit fcad23
  suggestion that the Net-SNMP command-line tools might contain bugs!)
Packit fcad23
Packit fcad23
    The typical symptoms of this would be that the '-d' option would
Packit fcad23
  display a sequence of sending and received packet dumps, with the
Packit fcad23
  same contents each time.  Ask on the mailing list for advice.
Packit fcad23
Packit fcad23
Packit fcad23
  Alternatively, the agent may simply not support the MIB objects being
Packit fcad23
  requested.  This is most commonly seen when using the "snmpwalk" tool
Packit fcad23
  (particularly with SNMPv1).
Packit fcad23
Packit fcad23
  The symptoms here would be that '-d' would show two pairs of raw
Packit fcad23
  packet dumps - one a GETNEXT request (A1 in the sending packet),
Packit fcad23
  followed by a GET request (A0).  Repeating the same request with the
Packit fcad23
  "snmpgetnext" command-line tool should show the information (if any)
Packit fcad23
  that the agent returned, which was then discarded by snmpwalk as
Packit fcad23
  irrelevant.
Packit fcad23
Packit fcad23
  Note that this is how snmpwalk was designed to work.  It is not an error.
Packit fcad23
Packit fcad23
Packit fcad23
  Finally, it may be that the agent is simply taking too long to respond.
Packit fcad23
  The easiest way to test for this is to add the command-line options
Packit fcad23
  "-t 60 -r 0", which will send a single request (with no repetitions)
Packit fcad23
  and wait for a minute before giving up.  This ought to be long enough
Packit fcad23
  for all but the most-overloaded agent, or inefficient MIB module!
Packit fcad23
Packit fcad23
  If this turns out to be the cause, then ask on the mailing list for
Packit fcad23
  advice on options for improving the performance.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why doesn't the agent respond?
Packit fcad23
-----------------------------
Packit fcad23
Packit fcad23
  Assuming that the tests outlined in the previous entry indicate that
Packit fcad23
  the problem lies with the agent not responding, the obvious question 
Packit fcad23
  is "why not".
Packit fcad23
Packit fcad23
  Again, there are two basic possibilities - either the agent never
Packit fcad23
  sees the request, or it receives it but is unwilling (or unable) to
Packit fcad23
  process it.  If the remote system is running the Net-SNMP agent,
Packit fcad23
  then the easiest way to distinguish between these two cases is to
Packit fcad23
  shut down the agent, and re-start it manually using the options
Packit fcad23
              -f -Le -d
Packit fcad23
  Then send the same query as before.  This should display raw dumps of
Packit fcad23
  packets seen (or sent) by the agent, just as with the client side in
Packit fcad23
  the previous entry.
Packit fcad23
Packit fcad23
Packit fcad23
  If the agent does not display anything, then it is simply not receiving
Packit fcad23
  the requests.  This may be because they are being blocked by network
Packit fcad23
  or local firewall settings ('iptables -L'),  or the agent may not be
Packit fcad23
  listening on the expected interfaces ('netstat -a').
Packit fcad23
Packit fcad23
  This is most commonly encountered when running queries from a remote
Packit fcad23
  host, particularly if the same request succeeds when run on the same
Packit fcad23
  system as the agent itself.
Packit fcad23
Packit fcad23
Packit fcad23
  If the agent displays a dump of the incoming request, but nothing going
Packit fcad23
  out, then the most likely cause is access control settings.  See the
Packit fcad23
  relevant entries in the AGENT section for details.  Note that if the agent
Packit fcad23
  receives an SNMPv1 or SNMPv2c request with a unknown community string,
Packit fcad23
  then it will not return an error response - the request is simply discarded.
Packit fcad23
Packit fcad23
  Another possibility is that the request may be rejected by settings in
Packit fcad23
  /etc/hosts.{allow,deny}.  Again, '-d' will display an incoming packet
Packit fcad23
  dump but no corresponding outgoing response.  However in this situation,
Packit fcad23
  the agent should also log a message that the request is being refused.
Packit fcad23
Packit fcad23
Packit fcad23
  Running the agent with '-d' can also help identify situations where the
Packit fcad23
  agent *is* responding to the request, but only after a long delay.  This
Packit fcad23
  would be indicated by a series of incoming packet dumps (showing various
Packit fcad23
  retries from the client side), followed by several outgoing dumps - possibly
Packit fcad23
  long after the client tool has given up in disgust.
Packit fcad23
    See the entry
Packit fcad23
      The agent worked for a while, then stopped responding.  Why?
Packit fcad23
  later in this section.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
I can see the system group, but nothing else.  Why?
Packit fcad23
--------------------------------------------------
Packit fcad23
Packit fcad23
  This is almost definitely due to the access configuration of the agent.
Packit fcad23
  Many pre-configured systems (such as most Linux distributions) will only
Packit fcad23
  allow access to the system group by default, and need to be configured
Packit fcad23
  to enable more general access.
Packit fcad23
Packit fcad23
    The easiest way to test this is to try a GETNEXT request on one of
Packit fcad23
  the other standard groups
Packit fcad23
  e.g.
Packit fcad23
	snmpgetnext  .....  interfaces
Packit fcad23
Packit fcad23
  If the agent responds with "hrSystemUptime.0" or "end of MIB", then it
Packit fcad23
  is clearly configured in this way.  See the entries on access control
Packit fcad23
  in the AGENT section for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't I see values in the <ENTERPRISE> tree?
Packit fcad23
-----------------------------------------------
Packit fcad23
Packit fcad23
  If you can see most of the standard information (not just the system and
Packit fcad23
  hrSystem groups), but not in the vendor-specific 'enterprises' tree, then
Packit fcad23
  once again there are several possible causes.
Packit fcad23
Packit fcad23
  Firstly, it's possible that the agent does not implement this particular
Packit fcad23
  enterprise tree.  Remember that adding a MIB to the client tools does
Packit fcad23
  *not* automatically add support for these object to the agent.  See the
Packit fcad23
  AGENT section for more information.
Packit fcad23
Packit fcad23
Packit fcad23
  Alternatively, it may be that the agent does implement some or all of this
Packit fcad23
  enterprise tree, but the access control settings are configured to block
Packit fcad23
  access to it.
Packit fcad23
Packit fcad23
  The simplest way to checks whether the agent implements a given portion
Packit fcad23
  of the OID tree is to run
Packit fcad23
Packit fcad23
	snmpwalk .... nsModuleName
Packit fcad23
Packit fcad23
  and look for index values that fall in the area of interest.
Packit fcad23
  (Always assuming that you have access to this particular section
Packit fcad23
  of the Net-SNMP enterprise tree, of course!)
Packit fcad23
 
Packit fcad23
  Checking the access control settings can be done by examining the tables
Packit fcad23
  vacmAccessTable and vacmViewTreeFamilyTable.   Note that these are used
Packit fcad23
  to configure access control for *all* versions of SNMP - not just SNMPv3.
Packit fcad23
Packit fcad23
Packit fcad23
  The third possibility is that simply isn't any information in the specified
Packit fcad23
  tree.  For example, several of the tables in the UCDavis enterprise tree
Packit fcad23
  (such as prTable, extTable, dskTable and fileTable) require explicit
Packit fcad23
  configuration in the snmpd.conf file.  If you query this particular tables
Packit fcad23
  without the necessary configuration entries, then they will be empty.
Packit fcad23
Packit fcad23
Packit fcad23
  Finally, if you can't see anything from *any* enterprise-specific tree,
Packit fcad23
  then this may be down to how you are asking for the information.  By
Packit fcad23
  default, if "snmpwalk" is run without an explicitly starting OID, then
Packit fcad23
  it will display the contents of the 'mib-2' tree, containing most of the
Packit fcad23
  IETF-standard management information supported by the agent.
Packit fcad23
 
Packit fcad23
  When the agent reaches the end of this tree, it will return the first
Packit fcad23
  enterprise-specific value, 'snmpwalk' will recognise that this marks the
Packit fcad23
  end of the (implicit) requested tree, and stop.  No enterprise-specific
Packit fcad23
  information will be displayed.
Packit fcad23
Packit fcad23
    To walk the whole tree, and see *all* the information that the
Packit fcad23
  agent supports, specify a starting point of '.iso' or '.1'.
Packit fcad23
  To walk a specific enterprise subtree, specify the root of this tree
Packit fcad23
  as the starting point - e.g:
Packit fcad23
Packit fcad23
	snmpwalk -v1 -c public localhost UCD-SNMP-MIB::ucdavis
Packit fcad23
 
Packit fcad23
  There is more information about particular UCD-specific subtrees in
Packit fcad23
  the AGENT section.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
The agent worked for a while, then stopped responding.  Why?
Packit fcad23
-----------------------------------------------------------
Packit fcad23
Packit fcad23
  There are three basic possibilities:
Packit fcad23
    - the agent has crashed
Packit fcad23
    - it is hanging
Packit fcad23
    - it is temporarily overloaded
Packit fcad23
Packit fcad23
  Detecting whether the agent has crashed should be fairly straighforward.
Packit fcad23
  If you can reliably reproduce this crash (e.g. by sending a particular
Packit fcad23
  SNMP request), then contact the coders list for advice.
Packit fcad23
  It's the other two cases that are probably more significant.
Packit fcad23
Packit fcad23
  To tell the difference between these two, try leaving the agent
Packit fcad23
  undisturbed for a while, and then probe it using a single 'snmpget'
Packit fcad23
  request, specifying a longer timeout (e.g. '-t 120').  If it now
Packit fcad23
  responds, then something was probably sending requests (including
Packit fcad23
  duplicate retries) faster than the agent could process them, and it
Packit fcad23
  was building up a backlog.  Try adjusting the timeout period and retry
Packit fcad23
  frequency of these client requests, or look at improving the efficiency
Packit fcad23
  of the implementation of the relevant MIB objects.
Packit fcad23
Packit fcad23
  If the agent remains unresponsive (particularly if the load on the
Packit fcad23
  system is steadily climbing), then it's probably hanging, and all
Packit fcad23
  you can really do is restart the agent.  If you can identify what
Packit fcad23
  causes this to happen, then contact the coders list for advice.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Requesting an object fails with "Unknown Object Identifier"  Why?
Packit fcad23
----------------------------------------------------------------
Packit fcad23
Packit fcad23
  If a general snmpwalk shows a particular entry, but asking for it more
Packit fcad23
  specifically gives a "sub-identifier not found:" or "Unknown Object
Packit fcad23
  Identifier" error, then that's a problem with the tool, rather than
Packit fcad23
  the agent.
Packit fcad23
Packit fcad23
  Firstly, make sure that you're asking for the object by the right name.
Packit fcad23
  Object descriptors are case-sensitive, so asking for 'sysuptime' will
Packit fcad23
  not be recognised, but 'sysUpTime' will.
Packit fcad23
Packit fcad23
  Alternatively, the object may be defined in a MIB that hasn't been
Packit fcad23
  loaded.  Try loading in all the MIB files:
Packit fcad23
Packit fcad23
	snmpget -m ALL -v1 -c public localhost sysUpTime.0
Packit fcad23
Packit fcad23
  or specify the name of the appropriate MIB explicitly:
Packit fcad23
Packit fcad23
	snmpget -v1 -c public myhost SNMPv2-MIB::sysUpTime.0
Packit fcad23
Packit fcad23
  Note that this uses the name of the *module*, not the name of the file.
Packit fcad23
  However, if 'snmpwalk' displays the object by name, this is unlikely to
Packit fcad23
  be the cause, and you should look closely at the exact object name you
Packit fcad23
  are using.  In particular, see the next entry.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why do I get "noSuchName" when asking for "sysUpTime" (or similar)?
Packit fcad23
------------------------------------------------------------------
Packit fcad23
Packit fcad23
  Assuming that you do have access to this object, the most likely cause
Packit fcad23
  is forgetting the instance subidentifier.
Packit fcad23
Packit fcad23
  If you try walking the 'system' group (or any other part of the MIB tree),
Packit fcad23
  you should notice that all of the results have a number after the object
Packit fcad23
  name.  This is the "instance subidentifier" of that particular MIB instance.
Packit fcad23
Packit fcad23
  For values in tables (such as the sysORTable), this acts as an index into
Packit fcad23
  the table - a very familiar concept.  But *all* SNMP values will display an
Packit fcad23
  instance number, whether or not they are part of a table.  For non-table
Packit fcad23
  objects ("scalars"), this instance subidentifier will always be '0',
Packit fcad23
  and it *must* be included when making a GET request.
Packit fcad23
Packit fcad23
     Compare the following:
Packit fcad23
Packit fcad23
	$ snmpget -v1 -c public localhost sysUpTime
Packit fcad23
	Error in packet
Packit fcad23
	Reason: (noSuchName) There is no such variable name in this MIB.
Packit fcad23
	This name doesn't exist: system.sysUpTime
Packit fcad23
Packit fcad23
	$ snmpget -v1 -c public localhost sysUpTime.0
Packit fcad23
	system.sysUpTime.0 = Timeticks: (69189271) 8 days, 0:11:32.71
Packit fcad23
Packit fcad23
  This is a little less obscure when using SNMPv2c or v3 requests:
Packit fcad23
Packit fcad23
	$ snmpget -v 2c -c public localhost sysUpTime
Packit fcad23
	system.sysUpTime = No Such Instance currently exists
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why do I sometimes get "End of MIB" when walking a tree, and sometimes not?
Packit fcad23
--------------------------------------------------------------------------
Packit fcad23
Packit fcad23
  This depends on which MIB modules are supported by the agent you are
Packit fcad23
  querying and exactly what you're asking for.
Packit fcad23
Packit fcad23
  Note that a tree is walked by repeatedly asking for "the next entry" until
Packit fcad23
  all the values under that tree have been retrieved.  However, the agent has
Packit fcad23
  no idea that this is what's happening - all it sees is a request for "the
Packit fcad23
  next entry after X".
Packit fcad23
Packit fcad23
  If the object X happens to be the last entry in a sub-tree, the agent will
Packit fcad23
  provide the next object supported (as requested) even though this will be
Packit fcad23
  in a different subtree.  It's up to the querying tool to recognise that
Packit fcad23
  this last result lies outside the area of interest, and simply discard it.
Packit fcad23
Packit fcad23
  If the object X happens to be the last entry supported by the agent, it
Packit fcad23
  doesn't have another object to provide, so returns an "end of MIB"
Packit fcad23
  indication.  The Net-SNMP tools report this with the message above.
Packit fcad23
Packit fcad23
  But in either case, the actual information provided will be the same.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I use SNMPv3?
Packit fcad23
-------------------
Packit fcad23
Packit fcad23
  The simplest form of SNMPv3 request is unauthenticated and unencrypted
Packit fcad23
  (noAuthNoPriv).  It simply requires a user name, and would look something
Packit fcad23
  like:
Packit fcad23
Packit fcad23
	snmpget -v 3 -l noAuthNoPriv -u dave localhost sysUpTime.0
Packit fcad23
Packit fcad23
  However this approach foregoes the security protection which is the
Packit fcad23
  main advantage of using SNMPv3 (and the agent must also be explicitly
Packit fcad23
  configured to allow unauthenticated requests from that user).
Packit fcad23
Packit fcad23
  The most common form of SNMPv3 request is authenticated but not encrypted
Packit fcad23
  (authNoPriv).  This specifies the pass phrase to authenticate with:
Packit fcad23
Packit fcad23
	snmpget -v 3 -l authNoPriv -u dave -A "Open the Door"
Packit fcad23
				localhost sysUpTime.0
Packit fcad23
Packit fcad23
  A fully secure (i.e. encrypted) request (authPriv) would also specify
Packit fcad23
  the privacy pass phrase:
Packit fcad23
Packit fcad23
	snmpget -v 3 -l authPriv -u dave -A "Open the Door"
Packit fcad23
			-X "Bet you can't see me"  localhost sysUpTime.0
Packit fcad23
Packit fcad23
  In practise, most of these would probably be set via configuration
Packit fcad23
  directives in a personal $HOME/.snmp/snmp.conf file (note, *not* the
Packit fcad23
  agent's snmpd.conf file).
Packit fcad23
    The equivalent settings for the third example would be:
Packit fcad23
Packit fcad23
	defSecurityName		dave
Packit fcad23
	defSecurityLevel	authPriv
Packit fcad23
	defAuthPassphrase	"Open the Door"
Packit fcad23
	defPrivPassphrase	"Bet you can't see me"
Packit fcad23
Packit fcad23
  If the AuthPassphrase and the PrivPassphrase are the same, then you
Packit fcad23
  can use the single setting
Packit fcad23
		defPassphrase	"Open the Door and see me"
Packit fcad23
  instead.
Packit fcad23
Packit fcad23
  See the AGENT section for how to configure the agent for SNMPv3 access.
Packit fcad23
 
Packit fcad23
Packit fcad23
Packit fcad23
Why can't I set any variables in the MIB?
Packit fcad23
----------------------------------------
Packit fcad23
Packit fcad23
  There are three possible reasons for this:
Packit fcad23
Packit fcad23
  Many MIB objects are defined as "read-only" and inherently cannot be
Packit fcad23
  changed via SET requests.  Attempts to do so will typically be rejected
Packit fcad23
  by the 'snmpset' command without ever being sent to the agent.
Packit fcad23
Packit fcad23
  Of those objects that can in principle be changed, the agent may not
Packit fcad23
  include the code necessary to support SET requests.  (GET and GETNEXT
Packit fcad23
  are much easier to handle - particularly for objects relating to the
Packit fcad23
  internals of the underlying operating system).
Packit fcad23
Packit fcad23
  Even if SET support has been implemented, the agent may not be configured
Packit fcad23
  to allow write access to this object.
Packit fcad23
Packit fcad23
    Ready-installed distributions (such as those shipped with Linux) tend
Packit fcad23
  to be configured with read-only access to part of the mib tree (typically
Packit fcad23
  just the system group) and no write access at all.
Packit fcad23
Packit fcad23
  To change this, you will need to set up the agent's access control
Packit fcad23
  configuration.  See the AGENT section for more details.
Packit fcad23
Packit fcad23
    Note that neither the community string "public" nor "private" can be
Packit fcad23
  used to set variables in a typical default configuration.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Variables seem to disappear when I try to set them.  Why?
Packit fcad23
--------------------------------------------------------
Packit fcad23
Packit fcad23
  This is actually the same as the previous question - it just isn't
Packit fcad23
  particularly obvious, particularly when using SNMPv1.  A typical
Packit fcad23
  example of this effect would be
Packit fcad23
Packit fcad23
	$ snmpget -v1 -c public localhost sysLocation.0
Packit fcad23
	sysLocation.0 = somewhere nearby
Packit fcad23
Packit fcad23
	$ snmpset -v1 -c public localhost sysLocation.0 s "right here"
Packit fcad23
	Error in packet.
Packit fcad23
	Reason: (noSuchName) There is no such variable name in this MIB.
Packit fcad23
	This name doesn't exist: sysLocation.0
Packit fcad23
Packit fcad23
  Trying the same request using SNMPv2 or above is somewhat more informative:
Packit fcad23
Packit fcad23
	$ snmpset -v 2c -c public localhost sysLocation.0 s "right here"
Packit fcad23
        Error in packet.
Packit fcad23
        Reason: notWritable
Packit fcad23
Packit fcad23
  The SNMPv1 error 'noSuchName' actually means:
Packit fcad23
Packit fcad23
	"You can't do that to this variable"
Packit fcad23
Packit fcad23
  rather than "this variable doesn't exist".
Packit fcad23
  It may be the case that it doesn't exist at all.  It may exist but you
Packit fcad23
  don't have access to it (although different administrative credentials
Packit fcad23
  might be accepted).  Or it may exist, but you simply can't perform that
Packit fcad23
  particular operation (e.g. changing it).
Packit fcad23
    Similarly, the SNMPv2 error 'notWritable' means "not writable in this
Packit fcad23
  particular case" rather than "not writable under any circumstances".
Packit fcad23
Packit fcad23
  If you are sure that the object is both defined as writable, and has been
Packit fcad23
  implemented as such, then you probably need to look at the agent access
Packit fcad23
  control. See the AGENT section for more details.
Packit fcad23
    But see the next entry first.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't I change sysLocation (or sysContact)?
Packit fcad23
----------------------------------------------
Packit fcad23
Packit fcad23
  There is one final possibility to consider for why a SET request might
Packit fcad23
  be rejected.
Packit fcad23
Packit fcad23
  The values for certain MIB objects (including 'sysLocation' and 'sysContact')
Packit fcad23
  can be configured via the snmpd.conf file.  If this is done, then these
Packit fcad23
  particular objects become read-only, and cannot be updated via SET commands,
Packit fcad23
  even if the access control settings would otherwise allow it.
Packit fcad23
Packit fcad23
  This may seem perverse, but there is good reason for it.  If there is a
Packit fcad23
  configuration setting for one of these objects, then that value will be
Packit fcad23
  used whenever the agent re-starts.  If the object was allowed to be updated
Packit fcad23
  using SET, this new value would be forgotten the next time the agent was
Packit fcad23
  re-started.
Packit fcad23
Packit fcad23
  Hence the Net-SNMP agent rejects such requests if there's a value configured
Packit fcad23
  via the 'snmpd.conf' file.  If there isn't such a config setting, then the
Packit fcad23
  write request will succeed (assuming suitable access control settings), and
Packit fcad23
  the new value will be retained the next time the agent restarts.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
I get an error when trying to set a negative value - why?
Packit fcad23
--------------------------------------------------------
Packit fcad23
Packit fcad23
    This is a different problem.  What's happening here is that the
Packit fcad23
  routine that parses the arguments to the 'snmpset' command is seeing
Packit fcad23
  the '-' of the new value, and treating it as a command-line option.
Packit fcad23
  This normally generates an error (since digits typically aren't valid
Packit fcad23
  command line options).
Packit fcad23
Packit fcad23
    The easiest way to solve this is include the "end-of-option"
Packit fcad23
  indicator '--' in the command line, somewhere before the new value
Packit fcad23
  (but after all of the options, obviously).  For example:
Packit fcad23
Packit fcad23
	snmpset -v 2c -c public localhost -- versionRestartAgent.0 i -1
Packit fcad23
Packit fcad23
  (This command will still fail, since -1 isn't an acceptable value for
Packit fcad23
  this particular object, but that's not the point here!)
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
I get an error when trying to query a string-indexed table value - why?
Packit fcad23
----------------------------------------------------------------------
Packit fcad23
Packit fcad23
  The Net-SNMP library will normally try to interpret string-based
Packit fcad23
  index values, and display them in a meaningful manner:
Packit fcad23
Packit fcad23
      $ snmpgetnext .... vacmGroupName
Packit fcad23
      vacmGroupName.3."dave" = theWorkers
Packit fcad23
Packit fcad23
  The command-line tools will also accept string-valued indexes within
Packit fcad23
  an OID, and convert them into the appropriate numeric form before
Packit fcad23
  sending an SNMP request.  However the Unix shell will typically
Packit fcad23
  swallow the quotes around the string index value, before the SNMP
Packit fcad23
  tools can get a chance to interpret them.
Packit fcad23
Packit fcad23
  The answer is to escape the quotes, to protect them from the shell,
Packit fcad23
  and allow them to be passed through to the OID parser:
Packit fcad23
Packit fcad23
      snmpget ....   vacmGroupName.3.\"dave\"
Packit fcad23
  or
Packit fcad23
      snmpget ....  'vacmGroupName.3."dave"'
Packit fcad23
Packit fcad23
Packit fcad23
  Another alternative is to avoid trying to specify the index value as
Packit fcad23
  a string, and provide the numeric subidentifiers directly:
Packit fcad23
Packit fcad23
      snmpget .... vacmGroupName.3.4.100.97.118.101
Packit fcad23
Packit fcad23
  (where '3' indicates SNMPv3, '4' is the length of the string index,
Packit fcad23
  followed by the ASCII values of the individual characters).
Packit fcad23
Packit fcad23
  The command-line option '-Ob' will display the results of querying
Packit fcad23
  a string-indexed table in this format:
Packit fcad23
Packit fcad23
      $ snmpgetnext -Ob .... vacmGroupName
Packit fcad23
      vacmGroupName.3.4.100.97.118.101 = theWorkers
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How should I specify string-indexed table values?
Packit fcad23
------------------------------------------------
Packit fcad23
Packit fcad23
  There's one other aspect of string-indexed tables that can cause
Packit fcad23
  problems - the difference between implicit- and explicit-length
Packit fcad23
  strings, and how to represent these when making an SNMP query.
Packit fcad23
Packit fcad23
  The most common style of string index uses an explicit length,
Packit fcad23
  followed by the individual ASCII character values:
Packit fcad23
Packit fcad23
      "dave"  =  4.'d'.'a'.'v'.'e'
Packit fcad23
Packit fcad23
  (as shown in the previous entry).
Packit fcad23
Packit fcad23
  However if the string index is defined in the MIB file as IMPLIED
Packit fcad23
  (or if it has a fixed length, such as a physical ethernet address),
Packit fcad23
  then the length subidentifier is omitted, and the index simply
Packit fcad23
  consists of the character values:
Packit fcad23
Packit fcad23
      "dave"  =  'd'.'a'.'v'.'e'
Packit fcad23
Packit fcad23
  Note that IMPLIED index objects can only appear as the *last* index
Packit fcad23
  for a table.
Packit fcad23
 
Packit fcad23
  The Net-SNMP library uses double quotes (i.e. "dave) to indicate an
Packit fcad23
  explicit length string index value, and single quotes (i.e. 'dave')
Packit fcad23
  to indicate an implicit length one.  If you use the wrong style of
Packit fcad23
  quotes, then the resulting OID will be incorrect, and you'll get
Packit fcad23
  confusing results to your query.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I send traps and notifications?
Packit fcad23
---------------------------------------
Packit fcad23
Packit fcad23
    Traps and notifications can be sent using the command 'snmptrap'.
Packit fcad23
  The following examples generate the generic trap 'warmStart(1)' and a
Packit fcad23
  (dummy) enterprise specific trap '99' respectively:
Packit fcad23
Packit fcad23
	snmptrap -v 1 -c public localhost "" "" 1 0  ""
Packit fcad23
	snmptrap -v 1 -c public localhost "" "" 6 99 ""
Packit fcad23
  
Packit fcad23
  The empty parameters "" will use suitable defaults for the relevant 
Packit fcad23
  values (enterprise OID, address of sender and current sysUptime).
Packit fcad23
Packit fcad23
    An SNMPv2 or SNMPv3 notification (either trap or inform) takes
Packit fcad23
  the OID of the trap to send:
Packit fcad23
Packit fcad23
	snmptrap -v 2c -c public localhost "" UCD-SNMP-MIB::ucdStart
Packit fcad23
	snmptrap -v 2c -c public localhost "" .1.3.6.1.4.1.2021.251.1
Packit fcad23
Packit fcad23
  (These two are equivalent ways of specifying the same trap).  Again,
Packit fcad23
  the empty parameter "" will use a suitable default for the relevant
Packit fcad23
  value (sysUptime).
Packit fcad23
Packit fcad23
  Any of these commands can be followed by one or more varbinds,
Packit fcad23
  using the same (OID/type/value) syntax as for 'snmpset':
Packit fcad23
Packit fcad23
	snmptrap -v 2c -c public localhost "" ucdStart sysContact.0 s "Dave"
Packit fcad23
Packit fcad23
  Generating traps from within the agent, or other applications, is
Packit fcad23
  covered in the AGENT and CODING sections.
Packit fcad23
Packit fcad23
  You should also read the snmptrap tutorial at
Packit fcad23
        http://www.net-snmp.org/wiki/index.php/TUT:snmptrap
Packit fcad23
  which will help you understand everything you need to know about traps.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I receive traps and notifications?
Packit fcad23
----------------------------------------
Packit fcad23
Packit fcad23
    Handling incoming traps is the job of a "notification receiver".
Packit fcad23
  The Net-SNMP suite include the tool 'snmptrapd' to act in this role.
Packit fcad23
  This can log traps to a file or via the syslog mechanism, forward them
Packit fcad23
  to another notification receiver and/or invoke a specified command
Packit fcad23
  whenever a particular notification is received.
Packit fcad23
Packit fcad23
  Logging notifications would be done by starting snmptrapd as:
Packit fcad23
	snmptrapd -Ls 7		(log to syslog using 'LOCAL7')
Packit fcad23
  or
Packit fcad23
	snmptrapd -f -Lo        (log to standard output)
Packit fcad23
Packit fcad23
  Invoking a command to process a received notification uses one or
Packit fcad23
  more 'traphandle' directives in the configuration file 'snmptrapd.conf'.
Packit fcad23
  A typical configuration might look something like:
Packit fcad23
Packit fcad23
	traphandle .1.3.6.1.6.3.1.5.1       /path/to/page_me up
Packit fcad23
	traphandle .1.3.6.1.4.1.2021.251.1  /path/to/page_me up
Packit fcad23
	traphandle .1.3.6.1.4.1.2021.251.2  /path/to/page_me down
Packit fcad23
	traphandle default                  /path/to/log_it
Packit fcad23
Packit fcad23
  where 'page_me' and 'log_it' are the commands to be run.
Packit fcad23
Packit fcad23
  Forwarding notifications to another receiver would be done using
Packit fcad23
  similar 'snmptrapd.conf' directives:
Packit fcad23
Packit fcad23
        forward .1.3.6.1.4.1.8072.4.0.3  10.0.0.1
Packit fcad23
        forward default                  10.0.0.2
Packit fcad23
Packit fcad23
  There's a tutorial with more details on the web site at
Packit fcad23
        http://www.net-snmp.org/wiki/index.php/TUT:snmptrap
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I receive SNMPv1 traps?
Packit fcad23
-----------------------------
Packit fcad23
Packit fcad23
  Directives in the 'snmptrapd.conf' file use the (SNMPv2) snmpTrapOID
Packit fcad23
  value to identify individual notifications.  This applies to *all*
Packit fcad23
  versions of SNMP - including SNMPv1 traps.  See the co-existence spec
Packit fcad23
  (RFC 2576) for details of mapping SNMPv1 traps to SNMPv2 OIDs.
Packit fcad23
Packit fcad23
  Note that the first traphandle directive in the previous entry uses
Packit fcad23
  the OID corresponding to the SNMPv1 'coldStart' trap. 
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why don't I receive incoming traps?
Packit fcad23
----------------------------------
Packit fcad23
Packit fcad23
  Starting with net-snmp 5.3, snmptrapd will no longer automatically
Packit fcad23
  accept all incoming traps. It must be configured with authorized
Packit fcad23
  SNMPv1/v2c community strings and/or SNMPv3 users. Non-authorized
Packit fcad23
  traps/informs will be dropped.
Packit fcad23
    Please refer to the snmptrapd.conf(5) manual page for details.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
My traphandler script doesn't work when run like this - why not?
Packit fcad23
---------------------------------------------------------------
Packit fcad23
Packit fcad23
    If a traphandler script works fine when run manually from the
Packit fcad23
  command line, but fails or generates an error when triggered by
Packit fcad23
  an incoming notification, then there are two likely causes.
Packit fcad23
Packit fcad23
    Firstly, the interactive shell environment may not be precisely
Packit fcad23
  the same as that for programs executed by the snmptrapd daemon.
Packit fcad23
  In particular, it's quite possible that the PATH environmental
Packit fcad23
  variable may not include all the additional directories that are
Packit fcad23
  commonly set up for a personal login configuration.  To avoid this
Packit fcad23
  problem (particularly for traphandler shell scripts), it's worth
Packit fcad23
  giving the full path to all programs used within the script.
Packit fcad23
Packit fcad23
    Secondly, the snmptrapd daemon may not always recognise the
Packit fcad23
  appropriate interpreter to use for a particular trap handler.
Packit fcad23
  If this is the case, then you can specify this interpreter
Packit fcad23
  explicitly as part of the trap handle directive:
Packit fcad23
Packit fcad23
	traphandle default /usr/bin/perl /usr/local/bin/log_it
Packit fcad23
Packit fcad23
    In this case, it's almost certain that you'll also
Packit fcad23
  need to give the full path to the traphandle script (as shown)
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can the agent receive traps and notifications?
Packit fcad23
-------------------------------------------------
Packit fcad23
Packit fcad23
  It can't.
Packit fcad23
Packit fcad23
  The primary purpose of an SNMP agent is to handle requests for
Packit fcad23
  information from management applications.  In SNMP terminology,
Packit fcad23
  it acts as a "command responder".
Packit fcad23
Packit fcad23
  It may also issue traps to report significant events or conditions
Packit fcad23
  ("notification generator").  But responding to such notifications
Packit fcad23
  is a significantly different role, and this is handled by a separate
Packit fcad23
  application ('snmptrapd').  Note that it is perfectly possible (even
Packit fcad23
  normal) for both agent and trap receiver to run on the same host.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How big can an SNMP request (or reply) be?
Packit fcad23
-----------------------------------------
Packit fcad23
Packit fcad23
    The protocol definition specifies a "minimum maximum" packet size
Packit fcad23
  (484 bytes for UDP), which all systems must support, but does not
Packit fcad23
  attempt to define an upper bound for this maximum size.  This is left
Packit fcad23
  to each individual implementation.
Packit fcad23
Packit fcad23
    The UCD software used a fixed size buffer of 1472 bytes to hold the
Packit fcad23
  encoded packet, so all requests and responses had to fit within this.
Packit fcad23
  The Net-SNMP releases handle packet buffers rather differently, and
Packit fcad23
  are not subject to the same fixed restrictions.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I monitor my systems (disk, memory, etc)?
Packit fcad23
------------------------------------------------
Packit fcad23
Packit fcad23
    In general, the Net-SNMP suite consists of relatively low-level
Packit fcad23
  tools, and there is nothing included that is designed for high-level,
Packit fcad23
  long-term monitoring of trends in network traffic, disk or memory
Packit fcad23
  usage, etc.
Packit fcad23
Packit fcad23
    There are a number of packages available that are designed for this
Packit fcad23
  purpose.  Two of the most widely used are MRTG (http://www.mrtg.org/)
Packit fcad23
  and RRDtool (http://oss.oetiker.ch/rrdtool/).  There are also several
Packit fcad23
  frontends built on top of RRDtool, including Cacti (http://www.cacti.net/)
Packit fcad23
  and Cricket (http://cricket.sourceforge.net/).  There are details of
Packit fcad23
  how to set up Cricket to monitor some of the UCD extensions at
Packit fcad23
  http://www.afn.org/~jam/software/cricket/
Packit fcad23
Packit fcad23
     We have also set up a page that describes in detail how MRTG
Packit fcad23
  can be set up to monitor disk, memory and cpu activity at
Packit fcad23
  http://www.net-snmp.org/tutorial-5/mrtg/index.html
Packit fcad23
Packit fcad23
    There is also a web-based network configuration system "Net-Policy",
Packit fcad23
  based upon SNMP.  This is not strictly connected to the Net-SNMP project,
Packit fcad23
  but a number of the core developers are also involved with that system.
Packit fcad23
  See http://net-policy.sourceforge.net for more details.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Applications complain about entries in your example 'snmp.conf' file.  Why?
Packit fcad23
--------------------------------------------------------------------------
Packit fcad23
Packit fcad23
  There *is* no example 'snmp.conf' shipped with the standard distribution.
Packit fcad23
  
Packit fcad23
  The configuration file 'EXAMPLE.conf' is designed as a config for
Packit fcad23
  the agent, and should be installed as 'snmpd.conf' (note the 'd').
Packit fcad23
  The file 'snmp.conf' is intended for general configuration options,
Packit fcad23
  applicable to all applications (via the SNMP library).
Packit fcad23
    Rename (or merge) the 'snmp.conf' file to 'snmpd.conf', and this
Packit fcad23
  should fix the problem.
Packit fcad23
Packit fcad23
  See the AGENT section or the 'snmpd.conf(5)' man page for more information
Packit fcad23
  about what should go in this file.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
OK, what should I put in snmp.conf?
Packit fcad23
----------------------------------
Packit fcad23
Packit fcad23
    This is used to set common configuration values for most of the
Packit fcad23
  applications, to avoid having to specify them every time.  Examples
Packit fcad23
  are the SNMPv3 settings mentioned above, defaults for which MIBs to
Packit fcad23
  load and where from (see the second entry in this section),
Packit fcad23
  and the default SNMP version, port and (if appropriate) community
Packit fcad23
  string to use.
Packit fcad23
Packit fcad23
    Some of these (such as MIB information), might be best put in a
Packit fcad23
  shared snmp.conf file (typically /usr/local/share/snmp/snmp.conf or
Packit fcad23
  /etc/snmp/snmp.conf) to apply to all users of the system.  Others
Packit fcad23
  (particularly the SNMPv3 security settings), are more likely to refer
Packit fcad23
  to a particular user, and should probably go in a personal snmp.conf
Packit fcad23
  file (typically $HOME/.snmp/snmp.conf).
Packit fcad23
Packit fcad23
    See 'snmpget -H' and/or the snmp.conf(5) man page for more details.
Packit fcad23
Packit fcad23
    You can also use the "snmpconf" command to help you generate your
Packit fcad23
  snmp.conf configuration file (just run it and answer its questions).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I specify IPv6 addresses in tools command line arguments?
Packit fcad23
---------------------------------------------------------------
Packit fcad23
Packit fcad23
    IPv6 addresses pose a particular problem for the Net-SNMP command
Packit fcad23
  line tools, which parse host names into pieces. In particular, normally
Packit fcad23
  if you specify a simple host name, it assumes you want UDP in IPv4 on
Packit fcad23
  port 161.   By default, these two commands are actually the same:
Packit fcad23
Packit fcad23
            snmpget     127.0.0.1     sysUpTime.0
Packit fcad23
            snmpget udp:127.0.0.1:161 sysUpTime.0
Packit fcad23
Packit fcad23
  However, for IPv6 this causes a problem because IPv6 addresses also use
Packit fcad23
  a colon to separate addressing parts. Thus you need to enclose the address
Packit fcad23
  in square brackets ( [ and ] ).
Packit fcad23
     Because most shells use these brackets too, you also likely need to quote it:
Packit fcad23
Packit fcad23
            snmpget 'udp6:[::1]:161' sysUpTime.0
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
PERL
Packit fcad23
====
Packit fcad23
Packit fcad23
What is the purpose of the Perl SNMP module?
Packit fcad23
-------------------------------------------
Packit fcad23
Packit fcad23
  Short, comprehensive (but ultimately unhelpful) anwer - to provide a
Packit fcad23
  perl interface for SNMP operations.
Packit fcad23
Packit fcad23
  Longer, incomplete (but more useful) answer - there are probably two
Packit fcad23
  main uses for the Perl SNMP module.  The first is for developing client
Packit fcad23
  management applications, using perl to send SNMP requests, and manipulating
Packit fcad23
  or displaying the results.  As such, this is a straight alternative to
Packit fcad23
  various other SNMP toolkits currently available (for both perl and other
Packit fcad23
  programming languages).
Packit fcad23
Packit fcad23
  The second is as a means for extending the functionality of the Net-SNMP
Packit fcad23
  agent, by implementing new MIB modules.  This is an alternative to the
Packit fcad23
  other script-based extension mechanisms, but is more tightly bound to the
Packit fcad23
  Net-SNMP agent (and hence more efficient), while still avoiding the need
Packit fcad23
  to write C code.
Packit fcad23
Packit fcad23
  It is also possible to use the perl SNMP module in the snmpd.conf file,
Packit fcad23
  or to process incoming notifications,  but the above are probably the
Packit fcad23
  two primary uses.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where can I get the Perl SNMP package?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  Joe Marzot's excellent Perl 'SNMP' module, is included in the Net-SNMP
Packit fcad23
  source releases.  It can be found located in the perl/SNMP subdirectory
Packit fcad23
  of the source tree.  This is accompanied by a number of Perl modules
Packit fcad23
  grouped together under the NetSNMP namespace.
Packit fcad23
Packit fcad23
  The basic SNMP module (though not the NetSNMP additions), can also
Packit fcad23
  be found at any Comprehensive Perl Archive Network (CPAN) mirror site,
Packit fcad23
  under modules/by-module/SNMP.  To find the CPAN site nearest you,
Packit fcad23
  please see http://www.cpan.org/SITES.html.
Packit fcad23
Packit fcad23
  These Perl modules need to be used in conjunction with a compatible
Packit fcad23
  version of the Net-SNMP library.  Consult the README file in the SNMP
Packit fcad23
  Perl distribution to find out which version of the library it needs.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I install the Perl SNMP modules?
Packit fcad23
--------------------------------------
Packit fcad23
Packit fcad23
  Assuming you have a reasonably new (and properly configured) Perl system,
Packit fcad23
  this should be simply:
Packit fcad23
Packit fcad23
        cd perl
Packit fcad23
	perl Makefile.PL
Packit fcad23
	    (press RETURN when prompted for host and community)
Packit fcad23
	make
Packit fcad23
	make test
Packit fcad23
	make install  (probably as root)
Packit fcad23
Packit fcad23
Packit fcad23
  It might be possible to install the basic module using 
Packit fcad23
Packit fcad23
	perl -MCPAN -e shell ; "install SNMP"
Packit fcad23
Packit fcad23
  but this has not been reliably tested, and very much relies on
Packit fcad23
  having the correct version of the Net-SNMP library.
Packit fcad23
Packit fcad23
  There may also be appropriate pre-compiled versions of the Perl modules
Packit fcad23
  available from the Net-SNMP project website, or your O/S vendor.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
But compiling this fails! Why?
Packit fcad23
-----------------------------
Packit fcad23
Packit fcad23
  The Perl module tends to delve quite deeply into the internals of the
Packit fcad23
  main Net-SNMP library, and so is quite sensitive to changes within the
Packit fcad23
  library.  It's important to use the correct version of the module, that
Packit fcad23
  corresponds to the version of the library you have installed.  If you're
Packit fcad23
  working with a Net-SNMP source distribution, the appropriate versions of
Packit fcad23
  the Perl modules are shipped as part of the source code, but you *must*
Packit fcad23
  have run "make install" on the main Net-SNMP distribution *first*.
Packit fcad23
Packit fcad23
  If you're working with a ready-installed version of the library, make
Packit fcad23
  sure you obtain a compatible version of the Perl module.
Packit fcad23
Packit fcad23
    Note that the Perl modules will be compiled using the compiler
Packit fcad23
  (and compiler settings) used for compiling the original perl binary,
Packit fcad23
  *not* those used for compiling the Net-SNMP (or UCD) library.
Packit fcad23
  If these are different (e.g. 'gcc' used for one and 'cc' for the other)
Packit fcad23
  then this may well cause problems.  It's much safer to use a consistent
Packit fcad23
  environment for both.  This issue is discussed in greater detail in
Packit fcad23
  the README.solaris file.
Packit fcad23
Packit fcad23
    Also note that the v5 Net-SNMP suite *must* be configured to provide
Packit fcad23
  shared libraries in order for the Perl modules to work correctly.  This
Packit fcad23
  is not necessary with the v4 UCD-SNMP libraries.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Compiling the Perl module works OK, but 'make test' fails. Why?
Packit fcad23
--------------------------------------------------------------
Packit fcad23
Packit fcad23
  That's difficult to answer in general.
Packit fcad23
  Some of the Perl tests are rather picky, so this may simply be
Packit fcad23
  some minor inconsistency between your precise setup, and the
Packit fcad23
  expectations of the test environment.
Packit fcad23
Packit fcad23
    Check that you are working with the Perl distribution that matches
Packit fcad23
  the SNMP libraries (use the 'perl/SNMP' in preference to CPAN), and
Packit fcad23
  that you have installed the main libraries successfully (uninstall
Packit fcad23
  any old versions if you're having trouble).
Packit fcad23
Packit fcad23
    If all this looks OK, and if most of the tests pass, then it's
Packit fcad23
  probably safe to run 'make install' anyway.   Probably.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't mib2c (or tkmib) locate SNMP.pm?
Packit fcad23
-----------------------------------------
Packit fcad23
Packit fcad23
  That's probably because the SNMP Perl module hasn't been installed.
Packit fcad23
  It's not part of the standard Perl distribution, nor is it included
Packit fcad23
  in the default Fedora Linux installation (for example).
Packit fcad23
  You'll need to install it yourself.
Packit fcad23
Packit fcad23
  See the second entry in this section.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't mib2c (or tkmib) load SNMP.so?
Packit fcad23
---------------------------------------
Packit fcad23
Packit fcad23
    This is probably the same problem.  Either the SNMP module
Packit fcad23
  hasn't been installed, or it's the wrong version.  See the
Packit fcad23
  previous questions.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't tkmib locate Tk.pm?
Packit fcad23
----------------------------
Packit fcad23
Packit fcad23
  Tk.pm is another Perl package that needs to be installed before tkmib
Packit fcad23
  will run.  It's also available on Perl CPAN.  We suggest using version
Packit fcad23
  "Tk800.011" or later.  It can be installed by issuing the command:
Packit fcad23
Packit fcad23
		perl -MCPAN -e shell ; "install Tk"
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does your RPM complain about missing Perl modules?
Packit fcad23
-----------------------------------------------------
Packit fcad23
Packit fcad23
  This has been particularly noted on RedHat 9, complaining about the
Packit fcad23
  module "perl(Term::ReadKey)" - even if this is actually present (e.g.
Packit fcad23
  having been installed directly from CPAN).  In fact, this is not
Packit fcad23
  specific to Perl modules - the same issue can potentially arise with
Packit fcad23
  other RPM dependencies.
Packit fcad23
Packit fcad23
  The problem is that the RPM mechanism keeps a local database of what
Packit fcad23
  software packages have been installed, and checks this for any other
Packit fcad23
  features that this RPM requires.  If software is installed "manually"
Packit fcad23
  rather than via rpm packages, then it will not appear in this database.
Packit fcad23
  Attempting to install another RPM that rely on this functionality will
Packit fcad23
  then complain about the "missing" package, because the RPM system doesn't
Packit fcad23
  know that's it's actually available.
Packit fcad23
Packit fcad23
  The ideal solution is to *always* install software using a consistent
Packit fcad23
  mechanism (which may involve building RPMs locally, or looking for a
Packit fcad23
  suitable pre-built version).
Packit fcad23
Packit fcad23
  Failing this, it's possible to tell the "rpm" command to ignore such
Packit fcad23
  dependencies, and install the package anyway.  Try:
Packit fcad23
Packit fcad23
              rpm -i --nodeps {package}
Packit fcad23
Packit fcad23
  In this situation, it's then up to you to make sure that any other
Packit fcad23
  necessary packages *are* actually present on the system.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
I've got a problem with the Net-SNMP module.  Can you help?
Packit fcad23
----------------------------------------------------------
Packit fcad23
Packit fcad23
  Sorry, despite the similar-sounding name, the Net-SNMP (or Net::SNMP)
Packit fcad23
  module is nothing to do with this package, or the NetSNMP modules.
Packit fcad23
  Net::SNMP is a "pure-perl" implementation of SNMP support, developed
Packit fcad23
  by David Town.  The developers of the (C-based) Net-SNMP suite do
Packit fcad23
  not have any significant experience in using this particular module,
Packit fcad23
  and you'll probably be better off asking for help via CPAN or some
Packit fcad23
  other perl-related forum.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
MIBS
Packit fcad23
====
Packit fcad23
Packit fcad23
Where can I find a MIB compiler?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
  That depends what you mean by a "MIB compiler".  There are at least two
Packit fcad23
  types of tool that are commonly referred to by this name.
Packit fcad23
Packit fcad23
  The first is a tool to check MIB files for validity.  With the Net-SNMP
Packit fcad23
  software, this functionality is mostly integrated within the MIB parser,
Packit fcad23
  and hence included in all the applications.  The tool 'snmptranslate' is
Packit fcad23
  probably the most appropriate for this purpose.
Packit fcad23
Packit fcad23
  Note that the parser is fairly forgiving (see 'What ASN.1 parser is used'
Packit fcad23
  below), so this should not be regarded as a stamp of approval.  For a
Packit fcad23
  more rigourous validation, use a tool such as 'smilint', or the on-line
Packit fcad23
  interface at http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/
Packit fcad23
Packit fcad23
    The second type of "MIB compiler" is one to turn a MIB specification
Packit fcad23
  into C code, specifically one designed to aid agent implementation.  The
Packit fcad23
  command 'mib2c' is an example of such a tool for the Net-SNMP agent.  
Packit fcad23
  See the CODING section for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why aren't my MIB files being read in?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  There are two basic likely causes - either the library isn't attemping to
Packit fcad23
  load these particular MIB files, or it's trying to load them but can't
Packit fcad23
  locate them.
Packit fcad23
Packit fcad23
  By default, the Net-SNMP library loads a specific subset of MIB files.
Packit fcad23
  This list is set when the suite is first configured and compiled, and
Packit fcad23
  basically corresponds to the list of modules that the agent supports.
Packit fcad23
    (This is a simplification, but is a reasonable first approximation).
Packit fcad23
Packit fcad23
  In order to load additional MIB files, it is necessary to add them to this
Packit fcad23
  default list.  See the FAQ entry "How do I add a MIB to the tools?" for
Packit fcad23
  more information about how to do this.
Packit fcad23
Packit fcad23
Packit fcad23
  Alternatively, the tools may be looking in the wrong place.  The directory
Packit fcad23
  where the library looks for MIB files is also set when the software is
Packit fcad23
  first configured and compiled.  If you put new MIB files in the wrong
Packit fcad23
  location, then the library won't be able to find them (and will complain).
Packit fcad23
Packit fcad23
  This problem may arise when switching from a vendor-supplied distribution
Packit fcad23
  to one compiled from source (or vice versa).
Packit fcad23
    See the next entry for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where should I put my MIB files?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
  If you've compiled the package from source (or are using binaries
Packit fcad23
  from the project website), then you should probably put new MIB
Packit fcad23
  files in the directory /usr/local/share/snmp/mibs
Packit fcad23
Packit fcad23
  If you are using vendor-supplied binaries, then the MIB files
Packit fcad23
  may well be located somewhere else (e.g. /usr/share/snmp/mibs,
Packit fcad23
  /opt/snmp/mibs, or /etc/sma/snmp/mibs).  Have a look for where
Packit fcad23
  existing MIB files are installed, and try adding your MIBs to
Packit fcad23
  the same directory.
Packit fcad23
Packit fcad23
  If you compiled the source yourself, but specified a different
Packit fcad23
  --prefix value when running configure, then the location of the
Packit fcad23
  MIB directory will be {prefix}/share/snmp/mibs.
Packit fcad23
Packit fcad23
  If you're still not sure where to put your MIB files, try running
Packit fcad23
  the command
Packit fcad23
Packit fcad23
     snmpget  -Dparse-mibs  2>&1 | grep directory
Packit fcad23
Packit fcad23
  This will display the location(s) where the library is looking
Packit fcad23
  for MIB files.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What does "Cannot find module (XXX-MIB)" mean?
Packit fcad23
---------------------------------------------
Packit fcad23
Packit fcad23
    If this error is only generated for one or two modules, then it's
Packit fcad23
  likely that the named modules are not being found - perhaps they're
Packit fcad23
  not installed in the correct location, are not readable, or the
Packit fcad23
  name being used is incorrect.  See the previous entries and the entry
Packit fcad23
  "How do I add a MIB to the tools?" for more details.
Packit fcad23
Packit fcad23
  Note that the name reported is the name of the MIB *module*, which is
Packit fcad23
  not necessarily the same as the name of the file.
Packit fcad23
Packit fcad23
Packit fcad23
    If there are a large number of such errors, then it's more likely
Packit fcad23
  that either the MIB files haven't been installed at all.  If you are
Packit fcad23
  compiling from source, then it is necessary to run "make install" in
Packit fcad23
  order to set up the full run-time environment.
Packit fcad23
Packit fcad23
  Otherwise, see the previous entry to check whether the MIBs are installed
Packit fcad23
  in the correct location for the tools to find them.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
I'm getting answers, but they're all numbers. Why?
Packit fcad23
-------------------------------------------------
Packit fcad23
Packit fcad23
  This is related to the previous questions.  Remember, the results that
Packit fcad23
  you receive from an agent do not depend on which MIBs are loaded by the
Packit fcad23
  client tools - purely on how the agent was compiled and configured.
Packit fcad23
Packit fcad23
  Because the tools don't necessarily read in every MIB file they can find
Packit fcad23
  (and the relevant MIB file may not be available anyway), it is quite
Packit fcad23
  possible for results from an agent to refer to modules that have not
Packit fcad23
  been loaded (particularly with GETNEXT requests, or when walking a tree).
Packit fcad23
Packit fcad23
  The results will be reported correctly, but won't be translated to use
Packit fcad23
  named identifiers (or display the values in the most appropriate manner).
Packit fcad23
  To fix this, add the missing MIB files to the list of MIBs to be loaded.
Packit fcad23
  See the previous entries and the entry "How do I add a MIB to the tools?"
Packit fcad23
  for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What does "unlinked OID" mean?
Packit fcad23
-----------------------------
Packit fcad23
Packit fcad23
    This means that the library has been able to find the MIB module,
Packit fcad23
  and parse the individual objects defined in it, but is having problems
Packit fcad23
  linking them together into a consistent tree.  In particular, it
Packit fcad23
  can't find an object corresponding to the name within the braces
Packit fcad23
  (i.e. the 'xxx' in '{xxx 99}').
Packit fcad23
Packit fcad23
    This is probably due either to a typo in this name (remember that
Packit fcad23
  names are case sensitive, so a reference to 'xxx' will *not* match
Packit fcad23
  a definition of 'Xxx'), or else the name is defined in another MIB
Packit fcad23
  file, and this dependency is missing from the IMPORT clause of this
Packit fcad23
  MIB file.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
The parser doesn't handle comments properly. Why not?
Packit fcad23
----------------------------------------------------
Packit fcad23
Packit fcad23
  The way that comments are handled in a MIB file is subtly different
Packit fcad23
  to the equivalent syntax in most typical programming languages, and
Packit fcad23
  this difference can catch out the unwary.  In particular, there are
Packit fcad23
  two common situations which can lead to problems.
Packit fcad23
Packit fcad23
  The first scenario is where the MIB designer has attempted to "comment
Packit fcad23
  out" an unwanted line that already contains a comment:
Packit fcad23
Packit fcad23
	--   broken ::= { myMIB 1 }   -- This isn't working yet
Packit fcad23
Packit fcad23
  The assumption here is that a comment continues to the end of the line.
Packit fcad23
  Unfortunately, this is not correct.  A comment will continue either to
Packit fcad23
  the end of the line, *or* the next occurance of a pair of dashes.
Packit fcad23
Packit fcad23
    Thus in this case, the definition of "broken" is commented out (as
Packit fcad23
  intended) but the following text ("This isn't working yet") is treated
Packit fcad23
  as an active part of the MIB, and will generate an error.
Packit fcad23
Packit fcad23
Packit fcad23
  The second scenario is where a line of dashes has been used to mark
Packit fcad23
  out separate parts of a MIB file.  Depending on the exact number of
Packit fcad23
  dashes used, this may still result in a syntactically valid MIB file,
Packit fcad23
  but has a 1-in-4 possibility of triggering an error.  This means that
Packit fcad23
  this particular situation can be particularly difficult to spot!
Packit fcad23
Packit fcad23
Packit fcad23
    Most of the Net-SNMP applications have a command-line option (-Pc) which
Packit fcad23
  will work around this problem by treating the whole line as a comment.
Packit fcad23
  But this is not strictly legal, and the offending MIB file should really
Packit fcad23
  be corrected.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get more information about problems with MIB files?
Packit fcad23
------------------------------------------------------------
Packit fcad23
Packit fcad23
  The command 'snmptranslate' is used to translate between numeric
Packit fcad23
  and symbolic forms of OIDs.  It uses the same MIB parsing routines
Packit fcad23
  as the commands that actually communicate with a network management
Packit fcad23
  agent, but can be used standalone.  As such, it is a useful tool
Packit fcad23
  for identifying problems with reading in MIB files.
Packit fcad23
Packit fcad23
    In particular, the following options may be useful in
Packit fcad23
  identifying problems:
Packit fcad23
	-Pw  warns about conflicting symbols
Packit fcad23
	-PW  prints more verbose warnings about other problems as well
Packit fcad23
		(in both cases, ignore the 'xmalloc' reports)
Packit fcad23
	-T   provides sub-options for various views of these entries
Packit fcad23
Packit fcad23
  There are other '-P' options to control various aspects of MIB parsing.
Packit fcad23
  See the 'snmptranslate(1)' and 'snmpcmd(1)' man pages for more details,
Packit fcad23
  or the tutorial at
Packit fcad23
	http://www.net-snmp.org/tutorial-5/commands/snmptranslate.html
Packit fcad23
Packit fcad23
  For a more rigourous validation, use a tool such as 'smilint', or the
Packit fcad23
  on-line interface at http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What's this about "too many imported symbols"?
Packit fcad23
---------------------------------------------
Packit fcad23
Packit fcad23
  Any MIB file starts with an (optional) list of identifiers that
Packit fcad23
  it "imports" from other files.  The parser handles this using
Packit fcad23
  a fixed size buffer to hold the import information.
Packit fcad23
    There are two circumstances in which this can result in the
Packit fcad23
  error message shown above.
Packit fcad23
Packit fcad23
    Firstly, if the MIB file refers to an unusually large number
Packit fcad23
  of external identifiers.  Handling this case requires a (trivial)
Packit fcad23
  patch to the parsing code.  Contact the coders list for advice.
Packit fcad23
     (This is extremely rare - the only example that
Packit fcad23
      we've come across is the Cabletron Trap MIB).
Packit fcad23
Packit fcad23
    Much more common is a syntax error in the IMPORTS clause of the
Packit fcad23
  MIB file in question.  In particular, check that this section ends
Packit fcad23
  in a semicolon, before going on to the main MIB object definitions.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Do I actually need the MIB files?
Packit fcad23
--------------------------------
Packit fcad23
Packit fcad23
  Probably not.
Packit fcad23
  The MIB files play two main roles - they are used to translate
Packit fcad23
  between numeric OIDs and the corresponding textual names, and
Packit fcad23
  they define the structure and syntax of the relevant MIB objects.
Packit fcad23
Packit fcad23
    This second role is perhaps best thought of in terms of a design
Packit fcad23
  document.  It's vital while developing an application (typically
Packit fcad23
  the MIB module or handler within the agent), since it defines
Packit fcad23
  what the application (MIB) must actually do.  But once the code
Packit fcad23
  has been written, the design document becomes redundent.
Packit fcad23
  The agent then has the same information hardcoded into it
Packit fcad23
  (literally!), and no longer needs the MIB file.
Packit fcad23
Packit fcad23
    The translation task is not strictly necessary - SNMP will
Packit fcad23
  operate fine without any MIB files at all, as long as you're
Packit fcad23
  happy to work with numeric OIDs throughout, and know which MIB
Packit fcad23
  objects you're interested in.  But it's much easier to work with
Packit fcad23
  the (hopefully) meaningful names, enumeration tags and the like,
Packit fcad23
  and to view the description of a particular object.
Packit fcad23
  This requires having the relevant MIB files installed and loaded.
Packit fcad23
Packit fcad23
Packit fcad23
  Since the agent needs MIBs the least and some systems are memory
Packit fcad23
  restricted, it is possible to completely disable loading these MIBs
Packit fcad23
  as well as remove the code that does the parsing by using the
Packit fcad23
  --disable-mib-loading flag to configure.
Packit fcad23
Packit fcad23
  However, note that certain snmpd.conf tokens actually make use
Packit fcad23
  of mib information so they won't be as easily usable. 
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
AGENT
Packit fcad23
=====
Packit fcad23
Packit fcad23
What MIBs are supported?
Packit fcad23
-----------------------
Packit fcad23
Packit fcad23
  The following MIBs are supported (at least in part and on some systems):
Packit fcad23
Packit fcad23
	- MIB-2  General network statistics
Packit fcad23
                (RFC 1213 and subsequent revisions)
Packit fcad23
	- Host Resources (RFC 1514 and 2790)
Packit fcad23
	- SNMPv3 framework (RFCs 2571-5, 3411-3418)
Packit fcad23
		(including USM, VACM, Target
Packit fcad23
		 and Notification MIBs)
Packit fcad23
	- DisMan Event and Schedule MIBs
Packit fcad23
	- MTA-MIB (sendmail)
Packit fcad23
	- private UCD/Net-SNMP agent extensions
Packit fcad23
		(monitor specified processes and disks,
Packit fcad23
		 memory, CPU, load average, + extending
Packit fcad23
		 the agent using shell commands)
Packit fcad23
Packit fcad23
  See README.agent-mibs for details.
Packit fcad23
Packit fcad23
  Not all MIB modules are included by default on all systems.  Some of
Packit fcad23
  these may need to be explicitly requested when the software is first
Packit fcad23
  configured and built, while others may not be available on all
Packit fcad23
  architectures.
Packit fcad23
Packit fcad23
  There are a few other MIB implementations distributed as part of the
Packit fcad23
  source tarball, but these are basically unsupported and most of the
Packit fcad23
  core developers have little or no experience with using them.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What protocols are supported?
Packit fcad23
----------------------------
Packit fcad23
Packit fcad23
  The agent supports all three current versions of SNMP (v1, v2c and v3),
Packit fcad23
  over both UDP and TCP transports, as well as acting as a SMUX (RFC 1227)
Packit fcad23
  master agent, AgentX (RFC 2741) in both master and subagent roles, and
Packit fcad23
  SNMP proxying.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I configure the agent?
Packit fcad23
----------------------------
Packit fcad23
Packit fcad23
  That's a somewhat ambiguous question, as there are two very different
Packit fcad23
  stages where it is possible to "configure" the agent.
Packit fcad23
Packit fcad23
  Firstly, you can determine what capabilities and defaults are included
Packit fcad23
  within the library and agent, at the time that the software is first
Packit fcad23
  built.  This uses suitable flags to the 'configure' script, before
Packit fcad23
  compiling the source.
Packit fcad23
    As far as the agent is concerned, the most significant option is
Packit fcad23
  '--with-mib-modules' (or '--with-out-mib-modules') to control which
Packit fcad23
  MIBs will be supported by the agent.  See the next few entries for
Packit fcad23
  details.
Packit fcad23
Packit fcad23
    You can also control various aspects of the agent behaviour (and the
Packit fcad23
  information it returns) at run time, via the 'snmpd.conf' configuration
Packit fcad23
  file.  Various aspects of this are touched on throughout this FAQ.  Or
Packit fcad23
  see the snmpd.conf(5) manual page for full details.
Packit fcad23
    The "snmpconf" script can help in creating this config file.
Packit fcad23
  Start off with 'snmpconf -g basic_setup' to get you going.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I remove a MIB from the agent?
Packit fcad23
------------------------------------
Packit fcad23
Packit fcad23
  Deleting the text file for a MIB does not affect the agent (other than
Packit fcad23
  to prevent it from recognising MIB object names in the config files).
Packit fcad23
  It's necessary to tell the agent not to activate the relevant code that
Packit fcad23
  actually implements these objects.  There are three ways to do this:
Packit fcad23
                                                                                
Packit fcad23
    1) re-run 'configure' to exclude the given MIB module(s) from the
Packit fcad23
       build configuration, then recompile and reinstall:
Packit fcad23
Packit fcad23
	  ./configure --with-out-mib-modules=path/to/unwanted   ....
Packit fcad23
	  make
Packit fcad23
	  make install
Packit fcad23
Packit fcad23
       This specifies the path to the module code file, relative to
Packit fcad23
       the 'agent/mibgroup' directory.  Clearly, this approach is
Packit fcad23
       only possible if you are working with a source distribution.
Packit fcad23
 
Packit fcad23
    2) disable the MIB at runtime
Packit fcad23
Packit fcad23
	  snmpd -I -unwanted
Packit fcad23
Packit fcad23
       Note that this relies on knowing which modules are used to
Packit fcad23
       implement the relevant MIB objects.  If you're not sure,
Packit fcad23
       you could try walking the 'nsModuleName' MIB object, which
Packit fcad23
       indicates the module responsible for each particular range
Packit fcad23
       of OIDs.
Packit fcad23
       You can also check which MIB modules are loaded by getting
Packit fcad23
       the agent to report them as they are initialised:
Packit fcad23
Packit fcad23
	  snmpd -Dmib_init -H
Packit fcad23
Packit fcad23
       From this information, it should then be fairly obvious which
Packit fcad23
       modules to disable.
Packit fcad23
Packit fcad23
    3) use access control to exclude the mib from the view used to
Packit fcad23
       query the agent:
Packit fcad23
Packit fcad23
          view    almostEverything  included   .1
Packit fcad23
          view    almostEverything  excluded   unwantedMib
Packit fcad23
Packit fcad23
          rocommunity  public  default  -V almostEverything
Packit fcad23
Packit fcad23
       This approach can also be used with the full com2sec/group/access
Packit fcad23
       configuration directives (e.g. with versions earlier than 5.3,
Packit fcad23
       which don't support the above mechanism).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
I've installed a new MIB file.  Why can't I query it?
Packit fcad23
----------------------------------------------------
Packit fcad23
Packit fcad23
  Installing a new MIB file will not magically enable the agent to know
Packit fcad23
  what values to report for the objects defined in that MIB.  It's
Packit fcad23
  necessary to have some code which can provide the relevant information.
Packit fcad23
  The next few entries, and the CODING section address this issue in more
Packit fcad23
  detail.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I add a MIB to the agent?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
  Adding a MIB essentially involves writing some code to implement the
Packit fcad23
  objects defined in the new MIB.  There are three basic approaches that
Packit fcad23
  can be used to do this:
Packit fcad23
Packit fcad23
    -  The agent can invoke an external command or shell script to
Packit fcad23
       return the necessary information.  There are several possible
Packit fcad23
       variations on this approach - see the next entry for details.
Packit fcad23
Packit fcad23
    -  The agent can pass the request off to another (sub-)agent,
Packit fcad23
       which already implements the required MIB.  Again, there are
Packit fcad23
       several ways of doing this - including AgentX, SMUX and
Packit fcad23
       proxied SNMP.  See the next entry but one for details.
Packit fcad23
Packit fcad23
    -  You can write code to implement the new MIB objects, and
Packit fcad23
       include this within the agent.  This is most commonly C
Packit fcad23
       (or C++) code, although the agent can also support MIB modules
Packit fcad23
       implemented in perl.
Packit fcad23
         See the next section (CODING) for more details.
Packit fcad23
Packit fcad23
  Note that there is no visible difference between external commands,
Packit fcad23
  subagents, and modules implemented within the main agent itself.
Packit fcad23
  Tools querying the agent will see a single MIB structure.
Packit fcad23
 
Packit fcad23
Packit fcad23
Packit fcad23
What's the difference between 'exec', 'sh', 'extend' and 'pass'?
Packit fcad23
---------------------------------------------------------------
Packit fcad23
Packit fcad23
  'exec' will run the specified command and return the exit status and
Packit fcad23
  output.  Any arguments are passed directly to the command, with no
Packit fcad23
  special interpretation.
Packit fcad23
Packit fcad23
  'sh' is similar, but invokes a shell to run the command line given.
Packit fcad23
  This means that quoted arguments will be recognised as such, and also
Packit fcad23
  allows redirection, and other similar shell interpretation.  The results
Packit fcad23
  are returned in exactly the same way.
Packit fcad23
Packit fcad23
  'extend' is also similar, but provides a richer and more flexible MIB
Packit fcad23
  framework - both for configuring the exact command to be run, and for
Packit fcad23
  displaying the results.
Packit fcad23
Packit fcad23
  None of these mechanisms require the command to have any knowledge of
Packit fcad23
  SNMP, or the fact that they are being used in this manner.  But the
Packit fcad23
  output is returned in a fixed format, and it is up to the receiving
Packit fcad23
  application to interpret this appropriately.
Packit fcad23
Packit fcad23
  Note that the "relocatable" form of the 'exec' directive ('exec OID ....')
Packit fcad23
  produces MIB output that is not strictly valid. For this reason, support
Packit fcad23
  for this has been deprecated in favour of 'extend OID ...', which produces
Packit fcad23
  well-formed MIB results (as well as providing fuller functionality).
Packit fcad23
  The most recent releases of the agent don't include support for "relocatable
Packit fcad23
  exec" by default. This needs to be explicitly included when the agent is
Packit fcad23
  first compiled, by including the module 'ucd-snmp/extensible' instead of
Packit fcad23
  'agent/extend'.
Packit fcad23
Packit fcad23
Packit fcad23
  'pass' is a more general mechanism for implementing arbitrary MIB
Packit fcad23
  objects.  The specified command will be invoked for any request within
Packit fcad23
  the named MIB subtree, and passed details of the requested OID.  It
Packit fcad23
  should return the information relevant to the requested OID.
Packit fcad23
Packit fcad23
    'pass-persist' is similar, but the command will continue running
Packit fcad23
  even after the initial request has been answered.  These two mechanisms
Packit fcad23
  can be used to implement a particular MIB, following the correct MIB
Packit fcad23
  structure (as opposed to the fixed format of exec/sh/extend).
Packit fcad23
Packit fcad23
  All of these mechanisms are described in the 'snmpd.conf(5)' man page,
Packit fcad23
  in the section entitled "Extending Agent Functionality".
Packit fcad23
Packit fcad23
  
Packit fcad23
Packit fcad23
What's the difference between AgentX, SMUX and proxied SNMP?
Packit fcad23
-----------------------------------------------------------
Packit fcad23
Packit fcad23
    All three are protocols that can be used to make two or more agents
Packit fcad23
  appear as one to the querying application.  In each case, one agent
Packit fcad23
  takes the role of "master", and delegates requests to one of the others
Packit fcad23
  as and where this is appropriate.  The differences between them mainly
Packit fcad23
  relate to how data is represented, and the mechanisms for communication
Packit fcad23
  between master and subagents.
Packit fcad23
Packit fcad23
    SMUX and proxy SNMP both essentially use the standard SNMP packet format.
Packit fcad23
  The main difference is that a proxy SNMP subagent need not be aware that
Packit fcad23
  it is acting in such a role.  It typically listens on a non-standard port,
Packit fcad23
  and simply receives requests as usual, forwarded from the master agent
Packit fcad23
  (rather than directly).  The main issue to be aware of is that such requests
Packit fcad23
  will appear to come from the local host, and this may affect how the access
Packit fcad23
  control mechanisms need to be set up.
Packit fcad23
Packit fcad23
    SMUX uses a similar packet format, but the subagent "registers" with
Packit fcad23
  the master agent, providing a suitable password.  The Net-SNMP (and UCD)
Packit fcad23
  agent includes the possibility of acting as a SMUX master agent, but the
Packit fcad23
  suite does not include a subagent API.   Note that support for SMUX is not
Packit fcad23
  included by default, and needs to be explicitly enabled by running:
Packit fcad23
Packit fcad23
		--with-mib-modules=smux
Packit fcad23
Packit fcad23
  before re-compiling the agent.
Packit fcad23
    See the file 'agent/mibgroup/README.smux' for details.
Packit fcad23
Packit fcad23
    AgentX uses a more compact (and simpler) packet format, with a richer
Packit fcad23
  range of administrative commands, and provides a more flexible and reliable
Packit fcad23
  extension mechanism.  The Net-SNMP agent can be used in both master and
Packit fcad23
  subagent roles, and the agent library can also be used to embed an AgentX
Packit fcad23
  subagent within another application.
Packit fcad23
    See the file 'README.agentx' for details.
Packit fcad23
Packit fcad23
  AgentX support is included by default, but needs to be explicitly
Packit fcad23
  activated in the master agent.  Do this by adding the line
Packit fcad23
Packit fcad23
		master agentx
Packit fcad23
Packit fcad23
  to the snmpd.conf file before starting the agent.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What is the purpose of 'dlmod'?
Packit fcad23
------------------------------
Packit fcad23
Packit fcad23
  Most of the MIB information supplied by the Net-SNMP agent is provided
Packit fcad23
  by C-coded implementation modules, and the choice of which modules to
Packit fcad23
  include is usually made when the agent is first built.  Adding new
Packit fcad23
  MIB modules would therefore require re-compiling the agent.  This is
Packit fcad23
  not always convenient - particularly when working with a production
Packit fcad23
  system, and/or pre-installed binaries.
Packit fcad23
  
Packit fcad23
  Dynamically loaded modules are a means of including a MIB implementation
Packit fcad23
  module within the main SNMP agent (or an AgentX subagent) without needing
Packit fcad23
  to re-compile and re-link the agent binary.  Instead, details of the
Packit fcad23
  module(s) to load are specified in the configuration file, and the agent
Packit fcad23
  locates the files listed, and merges them in at run time.
Packit fcad23
Packit fcad23
  See http://www.net-snmp.org/tutorial-5/toolkit/dlmod/ for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Which extension mechanism should I use?
Packit fcad23
--------------------------------------
Packit fcad23
Packit fcad23
  That's not easy to answer in general.
Packit fcad23
Packit fcad23
  If there's an existing agent that already implements the desired new
Packit fcad23
  MIB, then it makes sense to re-use that, via whatever extension protocol
Packit fcad23
  that agent might support.  Note that the SMUX protocol has essentially
Packit fcad23
  been superceded by AgentX, which provides a fuller and more reliable
Packit fcad23
  mechanism than either SMUX or proxied SNMP.  So ideally, this would
Packit fcad23
  be the preferred extension approach.
Packit fcad23
  But if the target subagent only supports SMUX or basic SNMP, then that
Packit fcad23
  would dictate the extension protocol to use.
Packit fcad23
Packit fcad23
  Implementing the module in C within the main agent (directly or via
Packit fcad23
  dlmod) is probably the most efficient and reliable, closely followed
Packit fcad23
  by embedded perl (or python) extensions.  These have the advantage of
Packit fcad23
  minimal overheads between the code implementing the MIB module, and
Packit fcad23
  the agent framework, and no inter-process communication issues.  But
Packit fcad23
  this does assume that there's a suitable mechanism for retrieving the
Packit fcad23
  necessary information.
Packit fcad23
Packit fcad23
  If the new MIB is monitoring or managing some other subsystem, external
Packit fcad23
  to the agent, then it may be necessary to embed a subagent within the
Packit fcad23
  subsystem itself - particularly if there's no suitable public API to
Packit fcad23
  retrieve the necessary information.  In this case, AgentX is probably
Packit fcad23
  the most appropriate way forward.
Packit fcad23
    Alternatively, you could implement the missing public management API
Packit fcad23
  for that subsystem, and develop a module within the main agent instead.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Can I use AgentX when running under Windows?
Packit fcad23
-------------------------------------------
Packit fcad23
Packit fcad23
  Yes, but there are a couple of things to be aware of.
Packit fcad23
Packit fcad23
  Firstly, by default the AgentX master listens on the Unix domain
Packit fcad23
  socket '/var/agentx/master', which doesn't work under Windows.
Packit fcad23
  You'll need to tell it to listen on a TCP port, either by using
Packit fcad23
  the command-line option "-x localhost:705",  or by adding the
Packit fcad23
  directive "agentxSocket localhost:705" to the snmpd.conf file.
Packit fcad23
Packit fcad23
  Secondly, be aware that the security of AgentX connectivity is not
Packit fcad23
  particularly strong.  The examples given here would allow any process
Packit fcad23
  running on the local machine to register as an AgentX subagent.  The
Packit fcad23
  more obvious settings "-x 705" or "agentxSocket 705" would allow
Packit fcad23
  a system *anywhere* on the network (or even from remote networks) to
Packit fcad23
  register as an AgentX subagent.  This could potentially be used to
Packit fcad23
  hijack the agent, or provide false information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I run AgentX with a different socket address?
Packit fcad23
----------------------------------------------------
Packit fcad23
Packit fcad23
  There are two sides to an AgentX connection, and they need to
Packit fcad23
  agree about which socket address to use.  So if you want to use
Packit fcad23
  a different socket, you need to configure both parties accordingly.
Packit fcad23
Packit fcad23
  The socket that the Net-SNMP master agent uses to listen for AgentX
Packit fcad23
  registrations (and send appropriate requests) can be specified using
Packit fcad23
  the option '-x'.
Packit fcad23
    The command
Packit fcad23
		"snmpd -x tcp:localhost:705 ...."
Packit fcad23
  would start the agent listening on the TCP port 705 for connections
Packit fcad23
  from the local system.
Packit fcad23
    The same effect can also be obtained by adding the line
Packit fcad23
		agentxsocket localhost:705
Packit fcad23
  to the file 'snmpd.conf'.
Packit fcad23
Packit fcad23
  The same option can be used with the Net-SNMP agent when running in
Packit fcad23
  This also holds when the Net-SNMP agent is running in
Packit fcad23
  "subagent" mode, to specify the socket to register with (and receive
Packit fcad23
  requests from).
Packit fcad23
    So a subagent might connect to the master agent above (both running
Packit fcad23
  on the same host), using: 
Packit fcad23
		"snmpd -X -x tcp:localhost:705 ...."
Packit fcad23
Packit fcad23
  A subagent running embedded within some other application will
Packit fcad23
  typically not understand the same command-line options, so would
Packit fcad23
  need to set the same configuration programmatically:
Packit fcad23
Packit fcad23
     netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
Packit fcad23
                           NETSNMP_DS_AGENT_X_SOCKET, "tcp:localhost:705");
Packit fcad23
Packit fcad23
  With the example subagent code from the Net-SNMP tutorial, this line
Packit fcad23
  would be added immediately before the 'init_agent' call.
Packit fcad23
Packit fcad23
  The same approach can also be used to listen on a different named
Packit fcad23
  socket, using:
Packit fcad23
		agentxsocket /tmp/agentx
Packit fcad23
		agentxperms 770 770 myuser mygroup
Packit fcad23
  or
Packit fcad23
		snmpd -x /tmp/agentx ....
Packit fcad23
  or
Packit fcad23
     netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
Packit fcad23
                           NETSNMP_DS_AGENT_X_SOCKET, "/tmp/agentx");
Packit fcad23
  as appropriate.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I turn off SMUX support?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
  Normally, you would use the command-line option '-I -{module}' to
Packit fcad23
  disable the initialisation of a particular MIB module within the
Packit fcad23
  agent.  Unfortunately, it's not currently possible to turn off SMUX
Packit fcad23
  support this way.
Packit fcad23
Packit fcad23
  The safest approach is to run
Packit fcad23
	configure --with-out-mib-modules=smux
Packit fcad23
  and recompile the agent.
Packit fcad23
Packit fcad23
  If this is not possible, an alternative workaround might be to have
Packit fcad23
  the agent bind the SMUX socket to an invalid IP address, using a
Packit fcad23
  snmpd.conf line such as:
Packit fcad23
Packit fcad23
	smuxsocket  1.0.0.0
Packit fcad23
Packit fcad23
  The agent may complain at startup, but it won't accept any incoming
Packit fcad23
  SMUX requests.
Packit fcad23
Packit fcad23
  If the agent complains about not recognising the "smuxsocket"
Packit fcad23
  token, then you're out of luck.  You'll either have to recompile
Packit fcad23
  from source, or use local firewall rules to block connections
Packit fcad23
  to port 199.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I combine two copies of the 'mib2' tree from separate subagents?
Packit fcad23
-----------------------------------------------------------------------
Packit fcad23
Packit fcad23
  This is the purpose of the SNMPv3 'context' field.  Register the MIB
Packit fcad23
  module a second time in a non-default context (see the relevant entry
Packit fcad23
  in the CODING section for details), and specify this context when
Packit fcad23
  querying the agent.  The MIB module can use this context information
Packit fcad23
  to determine which set of information to report.
Packit fcad23
    Or you could register two completely different handlers for the same
Packit fcad23
  OID (using different contexts), and the agent will invoke the appropriate
Packit fcad23
  code.  This holds for both MIB modules implemented within the main agent,
Packit fcad23
  or AgentX subagents - the same approach will work for both.
Packit fcad23
Packit fcad23
  Contexts can also be used with proxied SNMP requests - just specify
Packit fcad23
  the option '-Cn {context}' as part of the "proxy" entry.  See the
Packit fcad23
  'snmpd.conf(5)' man page for details.
Packit fcad23
Packit fcad23
  It's currently not possible to support parallel MIB trees when using
Packit fcad23
  SNMPv1 or SNMPv2c.  In principle, it should be possible to use the
Packit fcad23
  community string in a similar way, but this has not (yet) been implemented.
Packit fcad23
Packit fcad23
  This mechanism is only available with the v5 Net-SNMP agent. The v4
Packit fcad23
  UCD agent does not support contexts at all.  Sorry about that.
Packit fcad23
Packit fcad23
    Another way to handle this would be to tweak one of the subagents to
Packit fcad23
  use a different set of (non-standard) OID assignments - perhaps by
Packit fcad23
  relocating the whole of the subtree to another (private) OID.  This
Packit fcad23
  is not ideal, but should work with all configurations.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What traps are sent by the agent?
Packit fcad23
--------------------------------
Packit fcad23
Packit fcad23
  The Net-SNMP agent sends a 'coldStart(0)' trap when it first starts up,
Packit fcad23
  and an enterprise-specific trap 'nsNotifyShutdown' when it stops.  It
Packit fcad23
  generates an enterprise-specific trap 'nsNotifyRestart' (rather than
Packit fcad23
  the standard 'coldStart(0)' or 'warmStart(1)' traps) on receiving a HUP
Packit fcad23
  signal - typically after being re-configured.  It can also be configured
Packit fcad23
  to send an 'authenticationFailure(4)' trap when it receives an SNMPv1 
Packit fcad23
  (or SNMPv2c) request using an unknown community name.
Packit fcad23
Packit fcad23
    The agent does not send 'linkUp' or 'linkDown' traps by default. It can
Packit fcad23
  be configured to do this using the directive 'linkUpDownNotifications'.
Packit fcad23
  See the 'snmpd.conf(5)' man page (under ACTIVE MONITORING) for details.
Packit fcad23
Packit fcad23
    Similarly, it does not generate traps by default when one of the
Packit fcad23
  monitored characteristics (disk usage, running processes, etc) enters or
Packit fcad23
  leaves an error state.  This can be configured using the 'defaultMonitors'
Packit fcad23
  directive (again documented under ACTIVE MONITORING).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where are these traps sent to?
Packit fcad23
-----------------------------
Packit fcad23
Packit fcad23
  With all these alerts, the agent needs to be told where to send them,
Packit fcad23
  specifying the type of notification (v1 or v2 trap, or v2 inform) and
Packit fcad23
  the community name to use.  This uses the snmpd.conf directives 'trapsink',
Packit fcad23
  'trap2sink' and 'informsink' for the destination type, and 'trapcommunity'
Packit fcad23
  for the community name.  SNMPv3 destinations can be configured using the
Packit fcad23
  directive 'trapsess'.   See the 'snmpd.conf(5)' man page for details.
Packit fcad23
Packit fcad23
    Note that the type of trap generated is totally determined by these
Packit fcad23
  directives - irrespective of which API call was used to trigger sending
Packit fcad23
  the trap.  See the trap-related entries in the CODING section for details.
Packit fcad23
Packit fcad23
  Note also that you typically only want *one* of the settings:
Packit fcad23
Packit fcad23
        trapsink   localhost
Packit fcad23
        trap2sink  localhost
Packit fcad23
        informsink localhost
Packit fcad23
Packit fcad23
  Including two (or all three) of these lines in the snmpd.conf file will
Packit fcad23
  will result in multiple copies of every notifications being sent for
Packit fcad23
  each call to 'send_easy_trap()' (or 'send_v2trap()').
Packit fcad23
    This is probably not what was intended!
Packit fcad23
 
Packit fcad23
Packit fcad23
Packit fcad23
How can I send a particular trap to selected destinations?
Packit fcad23
----------------------------------------------------------
Packit fcad23
Packit fcad23
  This is not currently possible.  All notifications will be sent to
Packit fcad23
  all configured destinations.  The agent does not (currently) support
Packit fcad23
  notification filtering.
Packit fcad23
Packit fcad23
    There is a preliminary implementation of the snmpNotifyFilterTable
Packit fcad23
  which is designed to allow this sort of selective trap direction.
Packit fcad23
  However this is not currently active.  (The tables are present and
Packit fcad23
  can be manipulated and updated, but the information is not consulted)
Packit fcad23
  Documentation on how to use this mechanism will appear once the
Packit fcad23
  functionality is working properly.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
When I run the agent it runs and then quits without staying around. Why?
Packit fcad23
-----------------------------------------------------------------------
Packit fcad23
Packit fcad23
  Firstly, are you certain that this is what is happening?
Packit fcad23
Packit fcad23
  The normal operation of the agent is to 'fork' itself into the background,
Packit fcad23
  detaching itself from the controlling terminal so that it will continue
Packit fcad23
  running even when you log out, and freeing the command line for subsequent
Packit fcad23
  use.  This looks at first sight as if the agent has died, but using 'ps'
Packit fcad23
  to show all processes should reveal that the agent is still running.
Packit fcad23
Packit fcad23
  To prevent this behaviour (such as when attempting to debug the agent),
Packit fcad23
  you can start it with the '-f' flag.  This suppresses the fork, and the
Packit fcad23
  agent will run as a 'normal' command.  It's also often useful to use the
Packit fcad23
  '-Le' (or '-L') flag, to log messages to stderr.
Packit fcad23
Packit fcad23
  On the other hand, if 'ps' shows that the agent is not running, then
Packit fcad23
  this is an error, and probably show that something went wrong in
Packit fcad23
  starting the agent up.  Check the agent log file for any error messages,
Packit fcad23
  or run it with '-f -Le' and see what it reports.
Packit fcad23
Packit fcad23
  One possible cause might be an existing agent (or some other process)
Packit fcad23
  that's already listening on the SNMP port.  Trying to start a second
Packit fcad23
  agent will fail with an error about "opening the specified endpoint".
Packit fcad23
Packit fcad23
  If you're starting the agent as a non-root user, then this may also
Packit fcad23
  fail with the very same error.  By default, the agent (and trap handler)
Packit fcad23
  will attempt to listen on the standard SNMP port 161 (or 162 for the
Packit fcad23
  trap handler).  These are defined as "privileged ports", and processes
Packit fcad23
  will need to be running as root in order to open them.
Packit fcad23
Packit fcad23
  One way to tackle this is to start the agent as root, but use the -u
Packit fcad23
  option to switch to run as another user once the port has been opened.
Packit fcad23
  Alternatively, you can specify a different port to use instead.
Packit fcad23
  Anything greater than 1024 is available to non-root users.  In this case,
Packit fcad23
  you'll also need to specify the same port when issuing client commands.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
After a while the agent stops responding, and starts eating CPU time.  Why?
Packit fcad23
--------------------------------------------------------------------------
Packit fcad23
Packit fcad23
  This is basically the same problem described in the APPLICATIONS
Packit fcad23
  section, in the entry
Packit fcad23
   The agent worked for a while, then stopped responding.  Why?
Packit fcad23
Packit fcad23
  See that entry for details.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I stop other people getting at my agent?
Packit fcad23
-----------------------------------------------
Packit fcad23
Packit fcad23
  Firstly, are you concerned with read access or write access?
Packit fcad23
Packit fcad23
  As far as changing things on the agent is concerned, there is relatively
Packit fcad23
  little that can actually be altered (see the entry "Why can't I set
Packit fcad23
  any variables in the MIB?" above).
Packit fcad23
Packit fcad23
    If you are using the example config file, this is set up to allow
Packit fcad23
  read access from your local network, and write access only from the
Packit fcad23
  system itself (accessed as 'localhost'), both using the community name
Packit fcad23
  specified.  You will need to set appropriate values for both NETWORK
Packit fcad23
  and COMMUNITY in this file before using it.
Packit fcad23
    This mechanism can also be used to control access much more precisely.
Packit fcad23
  (see the next few questions for details)
Packit fcad23
Packit fcad23
  Other options include:
Packit fcad23
	- Blocking access to port 161 from outside your organisation
Packit fcad23
		(using filters on network routers)
Packit fcad23
	- Using kernel-level network filtering on the system itself
Packit fcad23
		(such as IPTables)
Packit fcad23
	- Configuring TCP wrapper support ("--with-libwrap")
Packit fcad23
		This uses the TCP 'libwrap' library (available separately)
Packit fcad23
		to allow/deny access via /etc/hosts.{allow,deny}
Packit fcad23
Packit fcad23
  For strict security you should use only SNMPv3, which is the secure
Packit fcad23
  form of the protocol.  However, note that the agent access control
Packit fcad23
  mechanisms does not restrict SNMPv3 traffic by location - an SNMPv3
Packit fcad23
  request will be accepted or rejected based purely on the user
Packit fcad23
  authentication, irrespective of where it originated.  Source-based
Packit fcad23
  restrictions on SNMPv3 requests would need to use one of the "external"
Packit fcad23
  mechanisms listed above.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I listen on just one particular interface?
Packit fcad23
-------------------------------------------------
Packit fcad23
Packit fcad23
    Normally, the agent will bind to the specified port on all interfaces
Packit fcad23
  on the system, and accept requests received from any of them.  However,
Packit fcad23
  if a particular port (or ports) is specified when the agent is first
Packit fcad23
  started, then it will only listen for requests on these particular
Packit fcad23
  ports.
Packit fcad23
     For example:
Packit fcad23
			snmpd 127.0.0.1:161
Packit fcad23
Packit fcad23
  would listen (on the standard port) on the loopback interface only, and:
Packit fcad23
Packit fcad23
			snmpd 10.0.0.1:6161
Packit fcad23
Packit fcad23
  would listen on port 6161, on the (internal network) interface with
Packit fcad23
  address 10.0.0.1.   To listen on both of these interfaces (and no others)
Packit fcad23
  provide a list of all the desired addresses:
Packit fcad23
Packit fcad23
			snmpd 127.0.0.1:161 127.0.0.1:6161
Packit fcad23
Packit fcad23
  The AgentX port option ('-x') works in much the same way.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
The agent is complaining about 'snmpd.conf'.  Where is this?
Packit fcad23
-----------------------------------------------------------
Packit fcad23
Packit fcad23
  It doesn't exist in the distribution as shipped.  You need to
Packit fcad23
  create it to reflect your local requirement.
Packit fcad23
    To get started, you can either just create this file manually,
Packit fcad23
  or run snmpconf to help you create one.  At the very least, you
Packit fcad23
  will need some form of access control configuration, if the agent
Packit fcad23
  is to be of any use whatsoever.  This can be as simple as:
Packit fcad23
Packit fcad23
       rocommunity public
Packit fcad23
Packit fcad23
    See the snmpd.conf(5) manual page or relevant entries in this
Packit fcad23
  FAQ for further details.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does the agent complain about 'no access control information'?
Packit fcad23
-----------------------------------------------------------------
Packit fcad23
Packit fcad23
  Although an SNMP agent may support a wide range of management
Packit fcad23
  information, it is not necessarily appropriate to report the whole
Packit fcad23
  of this to every SNMP management station who asks for it.  Some
Packit fcad23
  information may be sensitive, and should restricted to authorized
Packit fcad23
  administrators only.   SNMP therefore includes mechanisms for
Packit fcad23
  controlling who has access to what information - both in terms of
Packit fcad23
  what can be seen, and (even more importantly) what can be changed.
Packit fcad23
Packit fcad23
  By default, the Net-SNMP agent starts up with a completely empty
Packit fcad23
  access control configuration.  This means that *no* SNMP request
Packit fcad23
  would be successful.  It is necessary to explicitly configure
Packit fcad23
  suitable access control settings, based on who should be granted
Packit fcad23
  access in that particular environment.
Packit fcad23
Packit fcad23
  If there are no access control entries configured (perhaps because
Packit fcad23
  no snmpd.conf configuration file has been loaded, or it contains no
Packit fcad23
  access control settings), then the agent will not respond to any
Packit fcad23
  SNMP requests whatsoever.  This is almost certainly not what was
Packit fcad23
  intended, so the agent reports this situation.
Packit fcad23
Packit fcad23
  See the next entry for how to configure access control settings.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I configure access control?
Packit fcad23
---------------------------------
Packit fcad23
Packit fcad23
    The simplest way is to use the configure directives:
Packit fcad23
Packit fcad23
		rocommunity public	(for SNMPv1/2c)
Packit fcad23
		rwcommunity private
Packit fcad23
  or
Packit fcad23
		rouser user1		(for SNMPv3)
Packit fcad23
		rwuser user2
Packit fcad23
Packit fcad23
  These specify the community names or security names to accept for
Packit fcad23
  read-only and read-write access to the whole of the supported MIB tree.
Packit fcad23
  (Obviously you should change these names to match your requirements -
Packit fcad23
  which is a particularly good idea in the case of 'rwcommunity'!)
Packit fcad23
Packit fcad23
  Note that you should *not* specify the same community name for both
Packit fcad23
  rocommunity and rwcommunity directives.  The rwcommunity setting
Packit fcad23
  automatically provides read access, and having both lines (with the
Packit fcad23
  same community name) may result in unexpected behaviour.
Packit fcad23
  Only use both settings when specifying *different* community names.
Packit fcad23
    The same holds true for rouser and rwuser.
Packit fcad23
Packit fcad23
  The two community directives can be restricted to only allow requests
Packit fcad23
  from particular sources, and all four can be restricted to a particular
Packit fcad23
  subtrees or (from v5.3) a named view.  See 'snmpd.conf(5)' for details.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I configure SNMPv3 users?
Packit fcad23
-------------------------------
Packit fcad23
Packit fcad23
  There are three ways to configure SNMPv3 users:
Packit fcad23
Packit fcad23
  1) Stop the agent, and add the line
Packit fcad23
Packit fcad23
	createUser {myUser} MD5 {myPassword} DES
Packit fcad23
Packit fcad23
    to the file /var/net-snmp/snmpd.conf (where {myUser} and
Packit fcad23
    {myPassword} are the appropriate values for username and password,
Packit fcad23
    _without_ the braces!).  Then re-start the snmpd agent.
Packit fcad23
Packit fcad23
  2) Stop the agent, run the command
Packit fcad23
Packit fcad23
        net-snmp-config --create-snmpv3-user
Packit fcad23
Packit fcad23
     and follow the prompts given.  This will create an entry
Packit fcad23
     in the /var/net-snmp/snmpd.conf file similar to the above.
Packit fcad23
     Then re-start the snmpd agent.
Packit fcad23
Packit fcad23
  3) Make sure the agent is running, and will respond to an SNMPv3
Packit fcad23
     request (using an existing user with the desired authentication
Packit fcad23
     and privacy protocols).  Then use the 'snmpusm' command to clone
Packit fcad23
     this template user, and change the password.
Packit fcad23
Packit fcad23
Packit fcad23
  See the access control entries above and the file 'README.snmpv3'
Packit fcad23
  for more details about how to use SNMPv3 users,
Packit fcad23
Packit fcad23
  Note that simply having a 'rouser' or 'rwuser' line does *not*
Packit fcad23
  automatically create the corresponding SNMPv3 user.  You will need
Packit fcad23
  the above 'createUser' line (or an equivalent 'usmUser') as well.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
The 'createUser' line disappears when I start the agent.  Why?
Packit fcad23
-------------------------------------------------------------
Packit fcad23
Packit fcad23
  This is deliberate.
Packit fcad23
Packit fcad23
  The agent removes the (human-readable) 'createUser' directive, and
Packit fcad23
  replaces it with an equivalent 'usmUser' entry.  This contains the
Packit fcad23
  same information, but in a form that's only meaningful internally.
Packit fcad23
  Not only is the passphrase no longer visible in the config file, it
Packit fcad23
  has actually been converted to a key that is only valid on this
Packit fcad23
  particular system.  If someone stole the configuration file, they
Packit fcad23
  could not use the information from the usmUser entry to access any
Packit fcad23
  of your other agents (even if the usernames and passwords were the same).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What's the difference between /var/net-snmp and /usr/local/share/snmp?
Packit fcad23
---------------------------------------------------------------------
Packit fcad23
Packit fcad23
    The /var/net-snmp location is primarily used for information set
Packit fcad23
  during the running of the agent, which needs to be persistent between
Packit fcad23
  one run of the agent and the next.   Apart from "createUser" (see
Packit fcad23
  the previous entry), you shouldn't need to touch this file.
Packit fcad23
Packit fcad23
  All other user-provided configuration should go in the traditional
Packit fcad23
  location (typically /usr/local/share/snmp/snmpd.conf or /etc/snmp).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
My new agent is ignoring the old snmpd.conf file. Why?
Packit fcad23
-----------------------------------------------------
Packit fcad23
Packit fcad23
    The most likely explanation is that the new version of the agent is
Packit fcad23
  looking in a different location than the previous one.  This is commonly
Packit fcad23
  experienced when replacing a ready-installed version (e.g. from a vendor
Packit fcad23
  distribution), with the current release installed from the source.
Packit fcad23
Packit fcad23
  Try moving the old config file to the new location, and restart the agent.
Packit fcad23
  If you're not sure where this should go, see the next entry.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where should the snmpd.conf file go?
Packit fcad23
-----------------------------------
Packit fcad23
Packit fcad23
    The default location for this file with the basic distribution is
Packit fcad23
  /usr/local/share/snmp/snmpd.conf (or PREFIX/share/snmp/snmpd.conf).
Packit fcad23
  Ready-installed versions often look for the file as /etc/snmpd.conf,
Packit fcad23
  or /etc/snmp/snmpd.conf.
Packit fcad23
Packit fcad23
  If you are still not sure, try running the command
Packit fcad23
Packit fcad23
      snmpd -f -Le -Dread_config 2>&1 | grep "config path"
Packit fcad23
Packit fcad23
  The first line of output will display the list of locations where
Packit fcad23
  the agent is looking for configuration information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why am I getting "Connection refused"?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
    This is actually nothing to do with the access control mechanism
Packit fcad23
  (though that's an understandable mistake).  This is the result of
Packit fcad23
  the TCP wrapper mechanism using the files 'hosts.allow' and 'hosts.deny'
Packit fcad23
  to control access to the service.  Some distributions may come with
Packit fcad23
  this enabled automatically - otherwise you need to explicitly activate
Packit fcad23
  this by running
Packit fcad23
         configure --with-libwrap
Packit fcad23
  and recompiling the agent.
Packit fcad23
Packit fcad23
  If TCP wrappers are enabled, and both hosts.allow and hosts.deny are
Packit fcad23
  empty, then all requests will be rejected (with "Connection refused").
Packit fcad23
  The simplest way to avoid this problem and allow incoming requests is
Packit fcad23
  to add the line
Packit fcad23
Packit fcad23
		snmpd: ALL
Packit fcad23
Packit fcad23
  to the file /etc/hosts.allow.  Be aware that doing this removes one
Packit fcad23
  level of protection and allows anyone to try and query your agent.
Packit fcad23
  The agent's own access control mechanisms can still be used to restrict
Packit fcad23
  what - if anything - they can see.
Packit fcad23
Packit fcad23
  If you do wish to use the TCP wrappers to restrict access, it's sensible
Packit fcad23
  to have an explicit entry:
Packit fcad23
Packit fcad23
		snmpd: ALL
Packit fcad23
Packit fcad23
  in the file /etc/hosts.deny, which makes it crystal clear that access
Packit fcad23
  to the SNMP agent has been denied.  This mechanism can also be used to
Packit fcad23
  restrict access to specific management hosts, using a hosts.deny entry
Packit fcad23
  such as:
Packit fcad23
Packit fcad23
		snmpd: ALL EXCEPT 127.
Packit fcad23
Packit fcad23
  which will allow connections from localhost, and nothing else.
Packit fcad23
Packit fcad23
  Note that personal firewalls, such as the Linux iptables mechanism,
Packit fcad23
  may have a similar effect (though typically this won't be logged).
Packit fcad23
  See the earlier entry
Packit fcad23
    Requests always seem to timeout, and don't give me anything back.  Why?
Packit fcad23
Packit fcad23
Packit fcad23
 
Packit fcad23
Why can't I see values in the UCDavis 'proc' or 'disk' trees?
Packit fcad23
------------------------------------------------------------------
Packit fcad23
Packit fcad23
  Both these trees are designed to report precisely those things that
Packit fcad23
  have been explicitly configured for monitoring.  If there are no
Packit fcad23
  relevant configuration entries in the snmpd.conf file, then these
Packit fcad23
  tables will be empty.  See the snmpd.conf manual page and the
Packit fcad23
  EXAMPLE.conf file for details on configuring the agent.
Packit fcad23
Packit fcad23
  Optionally, run snmpconf -g monitoring to help you set up this
Packit fcad23
  section of the snmpd.conf file.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why can't I see values in the UCDavis 'memory' or 'vmstat' trees?
Packit fcad23
----------------------------------------------------------------
Packit fcad23
Packit fcad23
  These trees do not need any explicit configuration, and should
Packit fcad23
  be present automatically.
Packit fcad23
Packit fcad23
  However the C code necessary to implement these particular MIB
Packit fcad23
  modules are not supported on all operating systems.  These trees
Packit fcad23
  will be omitted on any system for which there is no underlying
Packit fcad23
  code.   Currently, they are only supported on Linux, HP-UX (memory
Packit fcad23
  only), Solaris, BSDi (vmstat on BSDi4 only), Dynix, FreeBSD, NetBSD
Packit fcad23
  and OpenBSD.
Packit fcad23
    If you want to help port it to other systems, let us know.
Packit fcad23
Packit fcad23
  Note that these subtrees only report the current usage when
Packit fcad23
  explicitly queried.  They do *not* automatically generate traps
Packit fcad23
  when the usage strays outside the configured bounds.
Packit fcad23
  See the earlier FAQ entry
Packit fcad23
    What traps are sent by the agent?
Packit fcad23
  or the snmpd.conf section on active monitoring, for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What do the CPU statistics mean - is this the load average?
Packit fcad23
----------------------------------------------------------
Packit fcad23
Packit fcad23
  No.  Unfortunately, the original definition of the various CPU
Packit fcad23
  statistics was a little vague.  It referred to a "percentage",
Packit fcad23
  without specifying what period this should be calculated over.
Packit fcad23
  It was therefore implemented slightly differently on different
Packit fcad23
  architectures.
Packit fcad23
Packit fcad23
  The 5.4 release has clarified the situation, and standardised on
Packit fcad23
  calculating these percentages over a minute.  The relevant MIB
Packit fcad23
  descriptions have been updated to make the desired behaviour
Packit fcad23
  more explicit.
Packit fcad23
Packit fcad23
  The Net-SNMP agent also includes "raw counters", which can be used
Packit fcad23
  to calculate the percentage usage over any desired period.  This is
Packit fcad23
  the "right" way to handle things in the SNMP model.  The original
Packit fcad23
  percentage objects have been deprecated, and may possibly be removed
Packit fcad23
  in a future release of the agent.
Packit fcad23
Packit fcad23
    Note that this is different from the Unix load average, which is
Packit fcad23
  available via the loadTable, and is supported on all architectures.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How do I get percentage CPU utilization using ssCpuRawIdle?
Packit fcad23
-----------------------------------------------------------
Packit fcad23
Packit fcad23
  This one of the "raw counters" mentioned in the previous entry.
Packit fcad23
  You need to take two readings of this object and look at the
Packit fcad23
  difference between them.  That difference divided by the total
Packit fcad23
  number of 'ticks' between the two readings (where one tick is
Packit fcad23
  probably 0.01 seconds) will give you the percentage utilization
Packit fcad23
  over that period.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What about multi-processor systems?
Packit fcad23
----------------------------------
Packit fcad23
Packit fcad23
  The CPU objects (both percentages and raw counters) were designed to
Packit fcad23
  monitor the overall CPU activity of a system, and typically reflect
Packit fcad23
  whatever the underlying operating system reports for the (single)
Packit fcad23
  CPU statistics information.  How these are handled for a multi-CPU
Packit fcad23
  system will differ from one O/S to another, and will need
Packit fcad23
  to be investigated for each system individually.
Packit fcad23
Packit fcad23
  The htProcessorTable was designed to handle monitoring multi-CPU
Packit fcad23
  machines, but the Net-SNMP implementation has up to now treated
Packit fcad23
  most systems (with the honourable exception of Solaris, and more
Packit fcad23
  recently Linux) as implicitly single-CPU.
Packit fcad23
Packit fcad23
  With the 5.4 release, there is now a cleaner framework for reporting
Packit fcad23
  on multi-CPU equipment, and it is hoped that an increasing number
Packit fcad23
  of systems will be able to report suitable processor information.
Packit fcad23
  Also with the 5.4 release, for the first time the agent will report
Packit fcad23
  the hrProcessorLoad value properly, which should provide some simple
Packit fcad23
  per-CPU statistics.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
The speed/type of my network interfaces is wrong - how can I fix it?
Packit fcad23
-------------------------------------------------------------------
Packit fcad23
Packit fcad23
    Some operating systems will provide a mechanism for determining
Packit fcad23
  the speed and type of network interfaces, but many do not.  In such
Packit fcad23
  cases, the agent attempts to guess the most appropriate values,
Packit fcad23
  usually based on the name of the interface.
Packit fcad23
Packit fcad23
  The snmpd.conf directive "interface" allows you to override these
Packit fcad23
  guessed values, and provide alternative values for the name, type
Packit fcad23
  and speed of a particular interface.  This is particularly useful
Packit fcad23
  for fast-ethernet, or dial-up interfaces, where the speed cannot be
Packit fcad23
  guessed from the name.
Packit fcad23
Packit fcad23
    See the snmpd.conf(5) man page for details.
Packit fcad23
  
Packit fcad23
Packit fcad23
Packit fcad23
The interface statistics for my subinterfaces are all zero - why?
Packit fcad23
----------------------------------------------------------------
Packit fcad23
Packit fcad23
    Unfortunately, most kernels that support multiple logical
Packit fcad23
  interfaces on a single physical interface, don't keep separate
Packit fcad23
  statistics for each of these.  They simply report the overall
Packit fcad23
  statistics for the physical interface itself.
Packit fcad23
Packit fcad23
    There's no easy way around this problem - the agent can only
Packit fcad23
  report such information as is available.  If the kernel doesn't
Packit fcad23
  keep track of these figures, the agent can't report them.
Packit fcad23
Packit fcad23
    Sorry!
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Does the agent support the RMON-MIB?
Packit fcad23
-----------------------------------
Packit fcad23
Packit fcad23
    Not really.
Packit fcad23
Packit fcad23
    There is an "Rmon" code module included within the agent source
Packit fcad23
  code tree, but this is best thought of as a template for the
Packit fcad23
  RMON-MIB statistics groups, rather than a full implementation.
Packit fcad23
Packit fcad23
    With most MIBs, the hardest part of implementing the MIB is often
Packit fcad23
  getting hold of the data to report.  This is definitely true of the
Packit fcad23
  RMON-MIB, which relies on gathering (and analysing) a potentially
Packit fcad23
  large quantity of network traffic.   The Rmon code distributed with
Packit fcad23
  the Net-SNMP agent code avoids this problem, by using random data.
Packit fcad23
Packit fcad23
    Some of the functionality of the RMON-MIB, such as the alarm and
Packit fcad23
  event groups, has since been superseded by the work of the DisMan
Packit fcad23
  IETF working group.  The Net-SNMP agent does implement these (more
Packit fcad23
  general) MIB modules.  But the statistics gathering aspects of
Packit fcad23
  the RMON-MIB are not readily available.
Packit fcad23
Packit fcad23
    Note too that none of the core developers have any significant
Packit fcad23
  experience with this code, and the person who originally wrote it
Packit fcad23
  is no longer active on the mailing lists.  So there's no point in
Packit fcad23
  asking on the lists whether these modules work or not.  You've got
Packit fcad23
  the source - how badly do you need this functionality?
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What does "klread:  bad address" mean?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  This means that the agent was unable to extract some of the
Packit fcad23
  necessary information from the kernel structures.  This is
Packit fcad23
  possibly due to:
Packit fcad23
	- either looking in the wrong place for kernel information
Packit fcad23
		(check the value of KERNEL_LOC)
Packit fcad23
	- an error in the implementation of part of the MIB tree
Packit fcad23
		for that architecture.  Try and identify which
Packit fcad23
		OID is generating the error, and contact the
Packit fcad23
		list 'net-snmp-coders@lists.sourceforge.net'
Packit fcad23
		Remember to tell us what architecture you have!
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What does "nlist err:  wombat not found" (or similar) mean?
Packit fcad23
----------------------------------------------------------
Packit fcad23
Packit fcad23
  This means that the agent wasn't able to locate one of the
Packit fcad23
  kernel structures it was looking for.  This may or may not
Packit fcad23
  be important - some systems provide alternative mechanisms
Packit fcad23
  for obtaining the necessary information - Solaris, for example,
Packit fcad23
  can produce a whole slew of such messages, but still provide
Packit fcad23
  the correct information.
Packit fcad23
    This error only occurs if you have used the flag
Packit fcad23
  '--enable-debugging' as part of the initial configuration.
Packit fcad23
  Reconfigure the agent with '--disable-debugging' and these
Packit fcad23
  messages will disappear.  (It won't fix the underlying problem,
Packit fcad23
  but at least you won't be nagged about it).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What does "Can't open /dev/kmem" mean?
Packit fcad23
-------------------------------------
Packit fcad23
Packit fcad23
  This device is normally restricted to just being accessible by root
Packit fcad23
  (or possibly by a special group such as 'kmem' or 'sys').  The agent
Packit fcad23
  must be able to read this device to obtain the necessary information
Packit fcad23
  about the running system.
Packit fcad23
    Check that the agent was started by root, and is running with UID 0
Packit fcad23
  (or suitable GID if appropriate).  The agent will normally continue
Packit fcad23
  to run without this level of access permission, but won't be able to
Packit fcad23
  report values for many of the variables (particularly those relating
Packit fcad23
  to network statistics).
Packit fcad23
Packit fcad23
 
Packit fcad23
Packit fcad23
The system uptime (sysUpTime) returned is wrong!
Packit fcad23
-----------------------------------------------
Packit fcad23
Packit fcad23
  Oh no it's not.
Packit fcad23
  The defined meaning of 'sysUpTime' is
Packit fcad23
	"the time ... since the *network management*
Packit fcad23
	 portion of the system was re-initialized."
Packit fcad23
Packit fcad23
  In other words, when the snmp agent was started, not when the
Packit fcad23
  system itself last booted.  This latter information is available
Packit fcad23
  in the Host Resources MIB as "hrSystemUpTime.0"
Packit fcad23
  Note that even if the full Host Resources is not supported on
Packit fcad23
  your system, it's worth configuring in the system portion using
Packit fcad23
Packit fcad23
		'--with-mib-modules=host/hr_system'
Packit fcad23
Packit fcad23
  and recompiling.  This particular group is reasonably likely to work,
Packit fcad23
  even if some of the other more architecture-specific groups don't.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Can the agent run multi-threaded?
Packit fcad23
--------------------------------
Packit fcad23
Packit fcad23
  Short answer - no.
Packit fcad23
  Longer answer - not easily.
Packit fcad23
Packit fcad23
  Net-SNMP within a single thread of an threaded application is fine,
Packit fcad23
  as long as *all* snmp code is kept within the same thread. This lets
Packit fcad23
  you add SNMP support to an existing threaded application.
Packit fcad23
Packit fcad23
  If you are concerned with the time taken for to process requests for
Packit fcad23
  a particular agent, object or subtree, and you want the agent to
Packit fcad23
  continue to respond to other requests in the meantime, there are
Packit fcad23
  two options.
Packit fcad23
Packit fcad23
  The first method is using AgentX sub-agents. If you have several
Packit fcad23
  tables, each implemented by a separate subagent, then a single
Packit fcad23
  request for entries from each of the tables will be processed
Packit fcad23
  in parallel (and the agent will continue to respond to other
Packit fcad23
  requests while it waits for the subagents to return the necessary
Packit fcad23
  information).  But a request for several objects from the same
Packit fcad23
  table will be passed off to the relevant subagent, where it will
Packit fcad23
  (normally) be processed serially.
Packit fcad23
Packit fcad23
  The second method is to use delegated requests + IPC to another
Packit fcad23
  process.  If takes a long time to retrieve a value for a given object,
Packit fcad23
  then the object handler could do whatever necessary to start or
Packit fcad23
  communicate with another (non-SNMP) process/thread to actually
Packit fcad23
  retrieve the value, and mark the request as delegated.
Packit fcad23
    The main agent (or subagent) can then receive and process other
Packit fcad23
  requests while waiting for the delegated request to finish.
Packit fcad23
  Dealing with resource contention is all up to you.
Packit fcad23
Packit fcad23
  All of this only applies to the GET family of requests.  A SET
Packit fcad23
  request will block until all pending GET requests have finished,
Packit fcad23
  and then will not accept new requests until the SET is complete.
Packit fcad23
Packit fcad23
  Adding full multi-thread support directly to the agent would be
Packit fcad23
  nice.  We just need someone with time/money to do/sponsor the work.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Can I use AgentX (or an embedded SNMP agent) in a threaded application?
Packit fcad23
-----------------------------------------------------------------------
Packit fcad23
Packit fcad23
  With care.
Packit fcad23
Packit fcad23
  As mentioned in the earlier "thread-safe" FAQ entry, the Net-SNMP
Packit fcad23
  agent (including the AgentX subagent) has not been designed for
Packit fcad23
  threaded operation.  In particular, it makes use of various global
Packit fcad23
  variables without attempting to protect them against simultaneous
Packit fcad23
  use.  This means that it is *NOT* safe to have SNMP or AgentX
Packit fcad23
  related processing in two separate threads.  This also applies to
Packit fcad23
  handling GET (and SET) processing in one thread, and generating traps
Packit fcad23
  in another.  This is still vulnerable to the usual threading problems.
Packit fcad23
Packit fcad23
    However, as long as *all* of the SNMP-related activity is limited
Packit fcad23
  to the one thread, then there should be no reason why this cannot
Packit fcad23
  safely communicate with other threads within the same application,
Packit fcad23
  using private (thread-safe) mechanisms.
Packit fcad23
Packit fcad23
    But in terms of the Net-SNMP-provided code, the agent (and AgentX
Packit fcad23
  subagent) should *not* be regarded as thread-safe.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
COMPILING
Packit fcad23
=========
Packit fcad23
Packit fcad23
How do I control the environment used to compile the software?
Packit fcad23
-------------------------------------------------------------
Packit fcad23
Packit fcad23
  The basic mechanism for compiling the Net-SNMP project software is to
Packit fcad23
  run "configure", followed by "make" (to compile it), "make test" (to
Packit fcad23
  check that it's working properly) and then "make install" (to install
Packit fcad23
  the files into the correct locations - which typicalyl needs to be done
Packit fcad23
  as root.
Packit fcad23
Packit fcad23
  The primary role of "configure" is to determines various aspects about
Packit fcad23
  the system that the software is being compiled on.  However there are
Packit fcad23
  also a number of options to configure which can be used to control
Packit fcad23
  various aspects of the compilation environment.
Packit fcad23
Packit fcad23
  The most common options are "--with-mib-modules" and "--with-out-mib-modules"
Packit fcad23
  which control the set of MIB module code files that are included within
Packit fcad23
  the agent binary.  Adding or removing these modules will affect what MIB
Packit fcad23
  information the agent can return.
Packit fcad23
     See the entry "How do I add a MIB to the agent?" for more details.
Packit fcad23
Packit fcad23
  
Packit fcad23
  The configure script can also specify the compiler to use for compiling
Packit fcad23
  the source code  (e.g. "configure --with-cc=cc"), the flags passed to
Packit fcad23
  this compiler (e.g. "configure --with-cflags=-g"), or to the linker
Packit fcad23
  (e.g. "configure --with-ldflags=-Bstatic"), and various other aspects of
Packit fcad23
  the build environment.
Packit fcad23
     Run "configure --help" for a full list.
Packit fcad23
 
Packit fcad23
Packit fcad23
Packit fcad23
How do I control the environment used to compile the software under Windows?
Packit fcad23
---------------------------------------------------------------------------
Packit fcad23
Packit fcad23
  If you are compiling the project within the MinGW or Cygwin environments,
Packit fcad23
  then these use the same "configure" mechanism as Unix-based systems.  See
Packit fcad23
  the previous entry for more information.
Packit fcad23
Packit fcad23
  If you are compiling the project from within Visual Studio, then this does
Packit fcad23
  not use the standard configure mechanism.  Instead, there is a separate
Packit fcad23
  "Configure" script within the 'win32' directory.  This can be used enable
Packit fcad23
  or disable various aspects of the build environment, such as support for
Packit fcad23
  encryption or IPv6.
Packit fcad23
    Run "Configure --help" for more information
Packit fcad23
Packit fcad23
  Note that this script does not include an equivalent of "--with-mib-modules"
Packit fcad23
  for extending the MIB information supported by the agent.  Instead, this
Packit fcad23
  needs to be done by tweaking the build environment manually.  See the file
Packit fcad23
  README.win32 for more details of this, and various other aspects of building
Packit fcad23
  the project on Windows systems.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does the compilation complain about missing libraries?
Packit fcad23
---------------------------------------------------------
Packit fcad23
Packit fcad23
  This has been seen in a number of guises over the years - most commonly
Packit fcad23
  on Linux systems (although the problem may also occur elsewhere).  The
Packit fcad23
  underlying problem is that typical installation may not always include
Packit fcad23
  the full set of library links required for building the Net-SNMP software.
Packit fcad23
Packit fcad23
  This problem can usually be fixed by installing the missing packages
Packit fcad23
  (typically the development version of a package that is already there).
Packit fcad23
Packit fcad23
  Examples of this that we have come across include:
Packit fcad23
Packit fcad23
     -lelf       elfutils-devel      (later renamed to elfutils-libelf-devel)
Packit fcad23
     -lbz2       bzip2-devel
Packit fcad23
     -lselinux   libselinux-devel
Packit fcad23
     -lcrypto    openssl/openssl-devel
Packit fcad23
     -lbeecrypt  libbeecrypt/beecrypt/beecrypt-devel.
Packit fcad23
Packit fcad23
  These are the names of the RedHat/Fedora RPMs.  Other distributions
Packit fcad23
  or O/S's may use different names, but the basic idea should be the
Packit fcad23
  same.
Packit fcad23
Packit fcad23
  If the compilation is complaining about a missing .so file, then an
Packit fcad23
  alternative quick fix is to add the missing symbolic link, using
Packit fcad23
  something like:
Packit fcad23
          ln -s libelf.so.1 /usr/lib/libelf.so
Packit fcad23
Packit fcad23
  giving the appropriate generic library name from the error message,
Packit fcad23
  and the correct number for whichever version of this library you
Packit fcad23
  have installed.
Packit fcad23
Packit fcad23
  If the compilation is complaining about a .la file, then you should
Packit fcad23
  install the relevant development package, as listed above.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I reduce the memory footprint?
Packit fcad23
--------------------------------------
Packit fcad23
Packit fcad23
  In order to reduce the memory footprint (for instance, to
Packit fcad23
  embed the snmpd into a device), the following configure options
Packit fcad23
  could be used.
Packit fcad23
Packit fcad23
  '--disable-debugging'
Packit fcad23
     This turns off the compilation of all debugging statements.
Packit fcad23
Packit fcad23
  '--enable-mini-agent' '--with-out-mib-modules=examples/ucdDemoPublic'
Packit fcad23
     This creates an agent with just the essential MIB modules included.
Packit fcad23
     NOTE: If you need additional MIB modules, then simply add them
Packit fcad23
     using the option '--with-mib-modules=...' but this will of course
Packit fcad23
     increase the memory footprint.
Packit fcad23
Packit fcad23
  '--with-transports=UDP'
Packit fcad23
     This option specifies the transport domains to include.
Packit fcad23
     For a simple standalone agent, just UDP should be sufficient.
Packit fcad23
     (Although the 'disman' and 'agentx' modules may require the
Packit fcad23
      Callback, TCP and/or Unix transport domains as well).
Packit fcad23
Packit fcad23
   '--without-kmem-usage'
Packit fcad23
     This can be used in order to omit the code that operates on the
Packit fcad23
     /dev/kmem interface. Clearly, this option cannot be used when
Packit fcad23
     one of the configured MIB modules depends on it.
Packit fcad23
Packit fcad23
   '--with-mibdirs=' and '--with-mibs='
Packit fcad23
     These options tell the agent not to load any MIB modules. 
Packit fcad23
     This doesn't affect the size of libraries or application
Packit fcad23
     binaries, but will reduce the memory footprint during runtime.
Packit fcad23
Packit fcad23
   '--disable-mib-loading'
Packit fcad23
     This can be used in order to omit the code that loads and
Packit fcad23
     parses the MIB files altogether.  This will reduce both the
Packit fcad23
     runtime memory footprint, and the binary sizes.
Packit fcad23
Packit fcad23
  Once the agent (snmpd) has been linked, you might also try running
Packit fcad23
  'strip snmpd' to remove un-necessary debug/symbol information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I reduce the installation footprint or speed up compilation?
Packit fcad23
-------------------------------------------------------------------
Packit fcad23
Packit fcad23
  The following configure options may also be useful:
Packit fcad23
                                                                                
Packit fcad23
  --disable-agent                 Do not build the agent (snmpd).
Packit fcad23
  --disable-applications          Do not build the apps (snmpget, ...).
Packit fcad23
  --disable-manuals               Do not install the manuals.
Packit fcad23
  --disable-scripts               Do not install the scripts (mib2c, ...).
Packit fcad23
  --disable-mibs                  Do not install the mib files.
Packit fcad23
  --disable-mib-loading           Do not include code that parses and
Packit fcad23
                                  manipulates the mib files.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I compile the project for use on an embedded system?
Packit fcad23
-----------------------------------------------------------
Packit fcad23
Packit fcad23
  Although this is definitely a Frequently Asked Question on the project
Packit fcad23
  mailing lists, it hasn't really been a Frequently _Answered_ Question.
Packit fcad23
  The basic problem is that none of the core development team have much
Packit fcad23
  involvement or experience with embedded systems.  And although we have
Packit fcad23
  repeatedly put out a plea for implementation reports and advice, this
Packit fcad23
  has not so far been particularly successful.  So the first thing to say
Packit fcad23
  is that the following suggestions should be treated with a greater than
Packit fcad23
  usual level of suspicion.
Packit fcad23
Packit fcad23
  The second thing to say is that compiling the Net-SNMP project for use
Packit fcad23
  on an embedded system typically means compiling the *agent* (rather than
Packit fcad23
  the trap receiver, or command-line tools).  So that is what this entry
Packit fcad23
  will concentrate on.
Packit fcad23
Packit fcad23
  There are three main aspects to consider:
Packit fcad23
     - how to compile the code,
Packit fcad23
     - *what* code to compile, and
Packit fcad23
     - how to install the resulting agent binary.
Packit fcad23
Packit fcad23
  The Net-SNMP project uses the standard "configure" mechanism, so the
Packit fcad23
  usual cross-compilation options are available - in particular "--host"
Packit fcad23
  and "--target".  It is also possible to specify the compiler and linker
Packit fcad23
  to use ("--with-cc" and "--with-ld"), and any special flags to pass
Packit fcad23
  to them ("--with-cflags" and "--with-ldflags").   There shouldn't be
Packit fcad23
  anything particularly special about compiling the Net-SNMP code, so
Packit fcad23
  see the documentation for your target environment for more information.
Packit fcad23
  (And please let us know if there *is* anything special that should be
Packit fcad23
  mentioned here!)
Packit fcad23
Packit fcad23
  If the aim is simply to generate an SNMP agent to run on the target
Packit fcad23
  system, it's probably not necessary to compile the command-line tools
Packit fcad23
  or trap receiver.  The configure option "--disable-applications" will
Packit fcad23
  omit these elements.  See the previous entry for other potentially
Packit fcad23
  relevant useful options.
Packit fcad23
Packit fcad23
  Unfortunately, the SNMP agent (and in particular, the code for individual
Packit fcad23
  MIB modules) is the most system-specific part of the Net-SNMP software.
Packit fcad23
  It may prove necessary to disable particular MIB modules if they do not
Packit fcad23
  compile successfully, or attempt to use the wrong system-specific APIs.
Packit fcad23
  This can be done using the configure option "--with-out-mib-modules".
Packit fcad23
  Alternatively, the option "--enable-mini-agent" will omit all but the
Packit fcad23
  core MIB module code.  Additional modules can then be added individually
Packit fcad23
  using "--with-mib-modules".
Packit fcad23
Packit fcad23
  Further information about how to deal with problems with individual MIB
Packit fcad23
  modules is reliant on suitable reports being forthcoming from the wider
Packit fcad23
  Net-SNMP community.  The ball is in your court!
Packit fcad23
Packit fcad23
  Finally, installing the agent binary is _not_ simply a matter of copying
Packit fcad23
  the "snmpd" file onto the target system.  The agent typically relies on
Packit fcad23
  a number of additional libraries (and possibly the presence of assorted
Packit fcad23
  MIB files, unless this has been explicitly omitted).  It is normally
Packit fcad23
  necessary to run "make install", before copying the installed framework
Packit fcad23
  to the target system.
Packit fcad23
Packit fcad23
  If the install destination needs to be different to the eventual location
Packit fcad23
  on the target system, this can be handled using the configure options
Packit fcad23
  "--prefix" (for the target location) and "--with-install-prefix" (for the
Packit fcad23
  temporary install location).  Alternatively, this can be handled as part
Packit fcad23
  of the install command:
Packit fcad23
       make install prefix={target location} INSTALL_PREFIX={temp location}
Packit fcad23
Packit fcad23
  Alternatively, if the agent is compiled with static linking (and no MIB
Packit fcad23
  files), then it may be possible to simply copy the agent binary across to
Packit fcad23
  the target system.  See the next entry for details.
Packit fcad23
Packit fcad23
Packit fcad23
  
Packit fcad23
How can I compile the project to use static linking?
Packit fcad23
---------------------------------------------------
Packit fcad23
Packit fcad23
  For totally static net-snmp executables, use
Packit fcad23
	configure --with-ldflags=-Bstatic
Packit fcad23
Packit fcad23
  To compile your application with static libraries (eg for easier
Packit fcad23
  debugging), and to link to a non-installed build directory, try the
Packit fcad23
  following Makefile fragment:
Packit fcad23
                                                                                
Packit fcad23
     NETSNMPDIR=/usr/local/build/snmp/full-clean-cvs-V5-1-patches
Packit fcad23
     NETSNMPCONFIG=$(NETSNMPDIR)/net-snmp-config
Packit fcad23
Packit fcad23
     NETSNMPBASECFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags)
Packit fcad23
     NETSNMPINCLUDES := $(shell $(NETSNMPCONFIG) --build-includes $(NETSNMPDIR))
Packit fcad23
     # base flags after build/src include, in case it has /usr/local/include
Packit fcad23
     NETSNMPCFLAGS=$(NETSNMPINCLUDES) $(NETSNMPBASECFLAGS)
Packit fcad23
Packit fcad23
     NETSNMPBASELIBS := $(shell $(NETSNMPCONFIG) --base-agent-libs)
Packit fcad23
     NETSNMPEXTLIBS := $(shell $(NETSNMPCONFIG) --external-agent-libs)
Packit fcad23
     NETSNMPLIBDIRS := $(shell $(NETSNMPCONFIG) --build-lib-dirs $(NETSNMPDIR))
Packit fcad23
     NETSNMPLIBDEPS := $(shell $(NETSNMPCONFIG) --build-lib-deps $(NETSNMPDIR))
Packit fcad23
     LIB_DEPS=$(NETSNMPLIBDEPS)
Packit fcad23
     LIBS=$(NETSNMPLIBDIRS) -Wl,-Bstatic $(NETSNMPBASELIBS) -Wl,-Bdynamic $(NETSNMPEXTLIBS)
Packit fcad23
Packit fcad23
     STRICT_FLAGS = -Wall -Wstrict-prototypes
Packit fcad23
     CFLAGS=-I. $(NETSNMPCFLAGS) $(STRICT_FLAGS)
Packit fcad23
                                                                                
Packit fcad23
  This replaces the standard Makefile section, which will used installed
Packit fcad23
  libraries:
Packit fcad23
                                                                                
Packit fcad23
     NETSNMPCONFIG=net-snmp-config
Packit fcad23
                                                                                
Packit fcad23
     # uncomment this if you have GNU make
Packit fcad23
     #NETSNMPCFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags)
Packit fcad23
     #NETSNMPLIBS := $(shell $(NETSNMPCONFIG) --agent-libs)
Packit fcad23
     NETSNMPCFLAGS=`$(NETSNMPCONFIG) --base-cflags`
Packit fcad23
     NETSNMPLIBS=`$(NETSNMPCONFIG) --agent-libs`
Packit fcad23
Packit fcad23
     LIBS=$(NETSNMPLIBS)
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does 'make test' skip various tests?
Packit fcad23
---------------------------------------
Packit fcad23
Packit fcad23
  Some of the tests are only relevant to particular operating systems,
Packit fcad23
  or rely on specific areas of functionality.  The test framework will
Packit fcad23
  check whether the relevant elements are available before running the
Packit fcad23
  relevant tests, and will skip them if these modules have been omitted
Packit fcad23
  from the build environment (or do not apply to the current system).
Packit fcad23
Packit fcad23
  One example of this are the tests T053agentv1trap, T054agentv2ctrap,
Packit fcad23
  T055agentv1mintrap, T056agentv2cmintrap and T113agentxtrap,  which
Packit fcad23
  rely upon functionality from the NET-SNMP-EXAMPLES-MIB implementation.
Packit fcad23
  This module is not included in the default agent configuration, so the
Packit fcad23
  test framework will skip these tests.
Packit fcad23
    To include them, run
Packit fcad23
        "configure --with-mib-modules=examples/example"
Packit fcad23
  and re-compile.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does 'make test' complain about a pid file?
Packit fcad23
-----------------------------------------------
Packit fcad23
Packit fcad23
    Typically it says something like:
Packit fcad23
Packit fcad23
    cat:  cannot open /tmp/snmp-test-1-8694/*pid*
Packit fcad23
Packit fcad23
    It's trying to tell you the port is blocked - typically because
Packit fcad23
  another copy of the agent is still running, left over from from a
Packit fcad23
  previous testing run.
Packit fcad23
Packit fcad23
  If you type 'ps -ef' you should notice an orphaned process like:
Packit fcad23
Packit fcad23
  snmpd -d -r -U -P /tmp/snmp-test-5-27295/snmpd.pid...
Packit fcad23
Packit fcad23
  Kill this process.
Packit fcad23
Packit fcad23
  This could be happening for several reasons including:
Packit fcad23
Packit fcad23
    1.  You are trying to do concurrent runs of 'make test'.
Packit fcad23
Packit fcad23
    2.  On a slow machine, the agent might be taking too long to
Packit fcad23
      start up. Try changing the value of the variable SNMP_SLEEP
Packit fcad23
      in testing/RUNTESTS from 1 to something higher - say 3 or 5.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
CODING
Packit fcad23
======
Packit fcad23
Packit fcad23
How do I write C code to integrate with the agent?
Packit fcad23
-------------------------------------------------
Packit fcad23
Packit fcad23
  There are three main methods for integrating external C code
Packit fcad23
  within the agent.  The code can be compiled directly into the
Packit fcad23
  agent itself, it can be loaded dynamically while the agent is
Packit fcad23
  running, or it can be compiled into a separate application
Packit fcad23
  (a "subagent") which communicates with the main master agent.
Packit fcad23
  All three approaches have been touched on elsewhere within this FAQ.
Packit fcad23
Packit fcad23
    As far as the module code is concerned, all three mechanisms
Packit fcad23
  use exactly the same module API.  So a module developed for use
Packit fcad23
  directly within the agent, could also be included within a subagent,
Packit fcad23
  or loaded dynamically with no (or minimal) code changes needed.
Packit fcad23
Packit fcad23
    Most of this section is concerned with more detailed aspects
Packit fcad23
  of developing such code - including the 'mib2c' tool, which can
Packit fcad23
  handle generating a basic code framework for implementing a
Packit fcad23
  given set of MIB objects.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How does the agent fetch the value of a MIB variable from the system?
Packit fcad23
--------------------------------------------------------------------
Packit fcad23
Packit fcad23
  That's typically the hardest bit of implementing a new MIB module,
Packit fcad23
  and is the one thing that 'mib2c' can't help with.  It very much
Packit fcad23
  depends on the MIB variable concerned (and often the underlying
Packit fcad23
  operating system as well).
Packit fcad23
Packit fcad23
  Relatively few MIB modules are completely self-contained, with all
Packit fcad23
  the information held internally within the agent, and all updates
Packit fcad23
  being done via SNMP requests.  Such MIB modules can be implemented
Packit fcad23
  fairly easily.
Packit fcad23
Packit fcad23
  More commonly, the agent needs to provide an SNMP-based interface to
Packit fcad23
  information held elsewhere, perhaps in the operating system kernel or
Packit fcad23
  some other application.  Handling this is much more complex - since
Packit fcad23
  a lot depends on what mechanisms are provided for retrieving (and
Packit fcad23
  possibly updating) this information.  The mib2c tool can generate code
Packit fcad23
  for processing SNMP requests, based on some internal cache of management
Packit fcad23
  information, but it cannot help with populating this cache with the
Packit fcad23
  underlying data.  That is up to the MIB implementer.
Packit fcad23
Packit fcad23
  See the existing MIB modules in the Net-SNMP source tree for various
Packit fcad23
  examples of assorted approaches to this task.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Mib2c complains about a missing "mib reference" - what does this mean?
Packit fcad23
---------------------------------------------------------------------
Packit fcad23
Packit fcad23
    This basically means that it hasn't loaded the MIB file containing
Packit fcad23
  the definition of the MIB subtree you're trying to implement.  This
Packit fcad23
  might be because it hasn't been installed, the name is wrong, or
Packit fcad23
  (most likely), because it isn't in the default list.  See the MIBS
Packit fcad23
  section for more details, or the next entry for suitable invocations
Packit fcad23
  of 'mib2c'.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Mib2c complains about not having a "valid OID" - what does this mean?
Packit fcad23
---------------------------------------------------------------------
Packit fcad23
Packit fcad23
    This probably means that you gave it the name of a MIB file (or
Packit fcad23
  module), rather than the name of an object defined in that file.
Packit fcad23
  Mib2c expects the name of a 'root' object, and will generate a
Packit fcad23
  template for the sub-tree starting from there.
Packit fcad23
Packit fcad23
    If you've got a file 'MY-MIB.txt', defining the MIB module
Packit fcad23
  'MY-MIB' which contains a subtree based on the object 'myMib',
Packit fcad23
  then you should invoke mib2c as
Packit fcad23
            "mib2c .... myMib"
Packit fcad23
  rather than
Packit fcad23
            "mib2c .... MY-MIB.txt"
Packit fcad23
  or        "mib2c .... MY-MIB"
Packit fcad23
Packit fcad23
    Note that you'll probably also have to add your MIB to the list of
Packit fcad23
  MIBs that are loaded automatically, in order for mib2c to recognise
Packit fcad23
  the name of this object.  So the command would typically be
Packit fcad23
            "MIBS=+MY-MIB mib2c .... myMib"
Packit fcad23
  or        "MIBS=ALL     mib2c .... myMib"
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why doesn't mib2c like the MIB file I'm giving it?
Packit fcad23
-------------------------------------------------
Packit fcad23
Packit fcad23
  This is most likely the same problem as the previous entry.  Mib2c
Packit fcad23
  takes the name of a MIB _object_, not the name of a file (or MIB
Packit fcad23
  module).  Try using the name of the MODULE-IDENTITY definition.
Packit fcad23
Packit fcad23
    Another possibility is that the MIB may contain syntax errors.
Packit fcad23
  Try running it through 'snmptranslate' or a dedicated SMI
Packit fcad23
  validation tool (such as 'smilint' or the on-line interface at
Packit fcad23
  http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/)
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Mib2c ignores my MIB and generates a pair of 'mib-2' code files.  Why?
Packit fcad23
---------------------------------------------------------------------
Packit fcad23
Packit fcad23
    This is usually a sign of the same problem as the previous entries,
Packit fcad23
  giving mib2c the name of the file containing the MIB (or of the MIB
Packit fcad23
  itself), rather than an object within it.
Packit fcad23
Packit fcad23
  Earlier versions of mib2c didn't detect this situation, and merrily
Packit fcad23
  constructed a template for a default starting point of the mib-2 node.
Packit fcad23
Packit fcad23
  More recent versions complain about not having a valid OID instead.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What's the difference between the various mib2c configuration files?
Packit fcad23
-------------------------------------------------------------------
Packit fcad23
Packit fcad23
    Most of the mib2c config files are concerned with implementing
Packit fcad23
  MIB tables, and generate various alternative code templates.
Packit fcad23
  These basically fall into four distinct categories.
Packit fcad23
Packit fcad23
    'mib2c.raw-table.conf' is the lightest of the templates, and
Packit fcad23
  just provides a fairly basic table framework.  Most of the work
Packit fcad23
  of implementing the table - detecting which row is required for a
Packit fcad23
  given request, retrieving or updating the relevant column values,
Packit fcad23
  and interacting with the underlying subsystem - are all left to
Packit fcad23
  the MIB programmer.
Packit fcad23
Packit fcad23
    The second group of templates - 'table_data', 'container' and
Packit fcad23
  'tdata' - all share the same basic model (although the internal
Packit fcad23
  details are rather different).  The MIB implementer should define a
Packit fcad23
  data structure to represent a row of the table, and the helper then
Packit fcad23
  takes care of holding the table internally, as a collection of such
Packit fcad23
  per-row data structures.  This includes identifying which row is
Packit fcad23
  required for a given request.  Retrieving or updating the appropriate
Packit fcad23
  column value is left to the MIB programmer, although the generated
Packit fcad23
  framework includes most of the necessary code.
Packit fcad23
    Allied to this is a fourth "internal data" mib2c configuration 
Packit fcad23
  file ('create-dataset') which handles the individual columns as
Packit fcad23
  well.  This is the closest to a Plug-and-Play configuration, and
Packit fcad23
  the MIB implementer only needs to be concerned with any special
Packit fcad23
  processing, such as linking the table with the underlying subsystem.
Packit fcad23
Packit fcad23
    The third style of mib2c config assumes that the table data is
Packit fcad23
  held externally to the helper - either within the MIB module code
Packit fcad23
  itself, or in the external subsystem.  The generated code framework
Packit fcad23
  includes routines to "iterate" through the rows of the table, with
Packit fcad23
  the iterator helper simply deciding which row is required for a
Packit fcad23
  particular request.  Once again, the MIB programmer must handle
Packit fcad23
  retrieving or updating the appropriate column value, although the
Packit fcad23
  generated framework includes most of the necessary code.
Packit fcad23
    There is a variant of this config ('iterate_access') which works
Packit fcad23
  in basically the same way. However this tries to separate out the
Packit fcad23
  standard processing, from the code that needs to be amended by the
Packit fcad23
  programmer for retrieving and updating the individual column values.
Packit fcad23
Packit fcad23
    This is also the idea behind the final table-oriented mib2c config
Packit fcad23
  template - 'mib2c.mfd.conf' (or "MIBs for Dummies").  This is a much
Packit fcad23
  more flexible framework, which can be used with either internally
Packit fcad23
  held data, or iterating through an external representation.  The
Packit fcad23
  distinguishing feature of this framework is that it separates out
Packit fcad23
  standard and table-specific processing, at a much finer level of
Packit fcad23
  detail than the others.
Packit fcad23
Packit fcad23
Packit fcad23
    The other mib2c config templates are concerned with implementing
Packit fcad23
  scalar objects ('scalar', 'int_watch'), code to generating traps
Packit fcad23
  ('notify'), and various specialised requirements.  There is also a
Packit fcad23
  template ('old-api') to generate code suitable for the previous v4
Packit fcad23
  UCD agent - though this is not particularly complete or reliable.
Packit fcad23
  It's probably better to use a pure v4 mib2c environment (or switch
Packit fcad23
  wholeheartedly to the v5 style).
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Which mib2c configuration file should I use?
Packit fcad23
-------------------------------------------
Packit fcad23
Packit fcad23
    The answer to that heavily depends on the characteristics of the
Packit fcad23
  MIB objects being implemented.  Of the handler-based table frameworks,
Packit fcad23
  'tdata' is more appropriate for tables that can be stored (or a copy
Packit fcad23
  cached) within the agent itself, while 'iterate' is more relevant to
Packit fcad23
  reporting data from outside the agent.
Packit fcad23
    The raw interface is only suitable in very specific circumstances,
Packit fcad23
  so it's probably sensible to start with one of the other frameworks
Packit fcad23
  first, and only look at this if none of the alternatives seem to work.
Packit fcad23
Packit fcad23
    The decision between the handler-based configs and MfD is more a
Packit fcad23
  matter of the style of programming to use.  Most of the frameworks
Packit fcad23
  define a single handler routine to process an incoming request, so
Packit fcad23
  all of the code is listed together, with the MIB programmer inserting
Packit fcad23
  table-specific processing into this single block of code.
Packit fcad23
    The MfD provides a series of individual object-specific routines,
Packit fcad23
  each concerned with one very specific task, and hides as much as
Packit fcad23
  possible from the programmer.
Packit fcad23
Packit fcad23
    If you like to understand the broad thrust of what's happening,
Packit fcad23
  then one of the handler-based approaches would be the best choice.
Packit fcad23
  If you prefer to concentrate on the nitty-gritty of a given table,
Packit fcad23
  and are happy to trust that the rest of the processing will work
Packit fcad23
  correctly, then the MfD framework would be more appropriate.
Packit fcad23
Packit fcad23
    For implementing a group of scalar objects, then the choice is
Packit fcad23
  simple - use 'mib2c.scalar.conf'.  Similarly, for generating traps
Packit fcad23
  or informs, use 'mib2c.notify.conf'.  But note that this only assists
Packit fcad23
  with the code to actually generate the trap.  It does not address the
Packit fcad23
  issue of _when_ to send the trap.  See the FAQ entry "How can I get
Packit fcad23
  the agent to generate a trap?" for more information.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I have mib2c generate code for both scalars and tables?
Packit fcad23
--------------------------------------------------------------
Packit fcad23
Packit fcad23
    This uses a very powerful tool called a "text editor" :-)
Packit fcad23
Packit fcad23
    The mib2c tool uses separate configuration files to generate code
Packit fcad23
  for scalar objects, and for tables.  This means that it's not possible
Packit fcad23
  to automatically generate a single code file that supports both scalars
Packit fcad23
  and tables.
Packit fcad23
Packit fcad23
    Instead, the two code files need to be generated separately, and
Packit fcad23
  then combined manually.  This will typically mean copying the handler
Packit fcad23
  routines for the scalar object(s) into the table file, and adding the
Packit fcad23
  code to register these handler(s) to the table initialisation routine.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Are there any examples, or documentation for developing MIB modules?
Packit fcad23
-------------------------------------------------------------------
Packit fcad23
Packit fcad23
    Many of the MIB modules shipped with the Net-SNMP agent still
Packit fcad23
  use the v4 "traditional" MIB module API, but an increasing number
Packit fcad23
  use one of the newer v5 helper-based handlers.  All of these can
Packit fcad23
  be found under 'agent/mibgroup'
Packit fcad23
Packit fcad23
    The 'tdata' helper is used in the new DisMan Event, Expression
Packit fcad23
  and Schedule MIB modules (see 'disman/{event,expr,schedule}/*').
Packit fcad23
  The similar 'dataset' helper is used in the older DisMan Event
Packit fcad23
  MIB implementation (see 'disman/mteEvent*') and the Notification
Packit fcad23
  Log MIB (see 'notification-log-mib/*'), used by 'snmptrapd' to
Packit fcad23
  log incoming traps.
Packit fcad23
 
Packit fcad23
    The basic iterator handler is used in the TCP and UDP table
Packit fcad23
  implementations (mibII/tcpTable & mibII/udpTable), VACM context
Packit fcad23
  handling (mibII/vacm_context) and various tables relating to agent
Packit fcad23
  internals (agent/*).  These show a number of different approaches
Packit fcad23
  to using the iterator helper, so it's worth comparing them.
Packit fcad23
Packit fcad23
    The two examples/netSnmpHostsTable* modules provide a contrast
Packit fcad23
  between the iterator and iterator_access helpers.
Packit fcad23
Packit fcad23
    There are several examples based on the MfD framework (see
Packit fcad23
  '{if,ip,tcp,udp}-mib/').  Much of this code is not intended to
Packit fcad23
  be viewed directly, but individual files are clearly commented
Packit fcad23
  to distinguish between internal implementation and public code.
Packit fcad23
Packit fcad23
    The Net-SNMP agent does not currently include any MIB modules
Packit fcad23
  using the array-user container-based helper.  The best examples
Packit fcad23
  of this are to be found in the net-policy project.
Packit fcad23
  See http://net-policy.sourceforge.net/
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Where should I put the files produced by 'mib2c'?
Packit fcad23
------------------------------------------------
Packit fcad23
Packit fcad23
  If you're using the main source tree to compile your new module, then
Packit fcad23
  put these two files (mymib.[ch]) in the directory 'agent/mibgroup'.
Packit fcad23
  You should then re-run configure to add in your new module
Packit fcad23
        configure --with-mib-modules=mymib
Packit fcad23
  and recompile.
Packit fcad23
Packit fcad23
    If you've got a number of new modules to add, it might be
Packit fcad23
  sensible to put them all into a single subdirectory of 'mibgroup'.
Packit fcad23
  Then create a header file, listing the individual components.
Packit fcad23
  This might look something like:
Packit fcad23
Packit fcad23
		config_require(mymib/myObjects)
Packit fcad23
		config_require(mymib/myTable)
Packit fcad23
		config_require(mymib/myOtherTable)
Packit fcad23
Packit fcad23
  If this was saved as the file 'mymib.h', then the same configure
Packit fcad23
  line given above, would pull in all three modules.  See the current
Packit fcad23
  contents of 'agent/mibgroup' for examples of this.  Note that the
Packit fcad23
  MfD framework will generate a similar grouping automatically.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why doesn't my new MIB module report anything?
Packit fcad23
---------------------------------------------
Packit fcad23
Packit fcad23
    There are probably four main reasons why a new MIB module isn't working.
Packit fcad23
  Either it hasn't been included in the running agent,  the code is present
Packit fcad23
  but hasn't been initialised,  the module has been initialised but the
Packit fcad23
  handler isn't being called, or there's a problem with the module code itself.
Packit fcad23
Packit fcad23
  To check whether the code files are being compiled, the easiest approach is
Packit fcad23
  simply to look at the directory where the code is located.  When the agent is
Packit fcad23
  compiled, this should produce .o files (and probably .lo files) corresponding
Packit fcad23
  to the C code files for this module.  Alternatively, run 'nm' (or 'strings')
Packit fcad23
  on the MIB module library (libnetsnmpmibs), and look for the names of the
Packit fcad23
  initialisation routines or handlers (or the text of any messages displayed by
Packit fcad23
  the module code).
Packit fcad23
Packit fcad23
  One other thing to check is whether you have multiple copies of the software
Packit fcad23
  installed on the system.  This is a particular problem when compiling from
Packit fcad23
  source (to include your new module), without first removing any vendor-supplied
Packit fcad23
  version of the agent (which won't include this new code).
Packit fcad23
Packit fcad23
Packit fcad23
  Assuming that you have confirmed that the module code is present in the agent,
Packit fcad23
  the next step is to check whether the initialisation routine is being called
Packit fcad23
  to register the MIB objects.  The simplest way to do this is to include a
Packit fcad23
  suitable debugging statement within the initialisation routine, and start
Packit fcad23
  the agent with the corresponding '-Dtoken'.  Alternatively, try walking the
Packit fcad23
  nsModuleName column object, and look for mention of the new MIB module.
Packit fcad23
Packit fcad23
Packit fcad23
  Assuming the module has been registered, the next step is to check whether
Packit fcad23
  the handler is being called, when the agent receives a suitable SNMP request.
Packit fcad23
  Again, the simplest way to do this is to include debugging statements within
Packit fcad23
  the handler routine, and start the agent with the corresponding '-Dtoken'.
Packit fcad23
  Then issue an "snmpget" request for an instance within the new MIB module.
Packit fcad23
  (This command is preferable to the usual "snmpwalk" command, as it is more
Packit fcad23
  closely focused on the MIB module in question).
Packit fcad23
Packit fcad23
  If this indicates that the handler routine isn't being called, then there are
Packit fcad23
  two main likely causes.  Firstly, check the access control settings.  If these
Packit fcad23
  are configured to block access to this portion of the OID tree, then the MIB
Packit fcad23
  handler will never be called.  Secondly, several of the table helpers are
Packit fcad23
  designed to know which rows of the table are valid, and will call the main
Packit fcad23
  MIB handler with information about the relevant row.  If the requested row is
Packit fcad23
  not valid (or the table is empty), then the handler will not be called.
Packit fcad23
Packit fcad23
Packit fcad23
  Finally, if the handler _is_ being called, but is still not returning any
Packit fcad23
  information, then the cause probably lies with your MIB module code.  In which
Packit fcad23
  case, it's really up to you to find the problem and fix it!  Either activate
Packit fcad23
  any debugging code that you have included within the handler routine, or run
Packit fcad23
  the agent under a source code debugger, and step through the handler processing.
Packit fcad23
  In either case, it's much easier to debug these problems when processing an
Packit fcad23
  "snmpget" request, rather than "snmpgetnext" or "snmpwalk".
Packit fcad23
Packit fcad23
  Remember that 'mib2c' simply generates template code for your MIB module.
Packit fcad23
  It's up to you to fill in the details, to report the actual information from
Packit fcad23
  whatever underlying subsystem is being monitored.   Mib2c cannot help with
Packit fcad23
  the semantics of the MIB module - it's purely there to provide an initial
Packit fcad23
  code framework, based on the _syntax_ of the MIB module objects.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does the iterator call my get_{first,next} routines so often?
Packit fcad23
-----------------------------------------------------------------------
Packit fcad23
Packit fcad23
    The first thing to realise is that the 'get_first' and 'get_next'
Packit fcad23
  hook routines are concerned with processing a single SNMP request, not
Packit fcad23
  with walking the whole table.  A full "snmpwalk" command will typically
Packit fcad23
  involve a series of individual 'GetNext' requests, and every one of
Packit fcad23
  these will trigger a separate 'get_first/get_next/get_next/....' cycle.
Packit fcad23
Packit fcad23
    It's usually more efficient to use 'snmptable' which will walk
Packit fcad23
  each column in parallel (as well as displaying the results in a
Packit fcad23
  more natural manner).
Packit fcad23
Packit fcad23
    Secondly, the iterator helper was originally designed to handle
Packit fcad23
  unsorted data, so will look at every row of the internal table for
Packit fcad23
  each request.  If the data is actually held in the correct order,
Packit fcad23
  then it's worth setting the NETSNMP_ITERATOR_FLAG_SORTED flag:
Packit fcad23
      iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
Packit fcad23
      iinfo->flags |= NETSNMP_ITERATOR_FLAG_SORTED;
Packit fcad23
  This will help the situation somewhat.
Packit fcad23
Packit fcad23
    But the iterator helper is inherently a relatively inefficient
Packit fcad23
  mechanism, and it may be worth looking at one of the other helpers,
Packit fcad23
  particularly if the data will be held within the agent itself.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get the agent to generate a trap (or inform)?
Packit fcad23
------------------------------------------------------
Packit fcad23
Packit fcad23
    There are two aspects to having the agent generate a trap -
Packit fcad23
  knowing *how* to do this, and knowing *when* to do so.
Packit fcad23
Packit fcad23
    Actually generating a trap is reasonably simple - just call one
Packit fcad23
  of the trap API routines ('send_easy_trap()' or 'send_v2trap()')
Packit fcad23
  with the relevant information (generic and specific trap values,
Packit fcad23
  or a varbind list respectively).
Packit fcad23
Packit fcad23
    The 'mib2c.notify.conf' configuration file can be used to
Packit fcad23
  construct a suitable template routine for generating a trap,
Packit fcad23
  including building the variable list from the MIB trap
Packit fcad23
  definition.  These variables can then be given suitable values,
Packit fcad23
  before invoking the 'send_v2trap()' call to actually send the trap.
Packit fcad23
  See the 'snmp_trap_api(3)' man page for further details.
Packit fcad23
Packit fcad23
    Note that these APIs are only available within the agent (or
Packit fcad23
  subagents), and are not available to stand-alone applications.
Packit fcad23
  The code for 'snmptrap' shows an approach to use in such a case.
Packit fcad23
Packit fcad23
Packit fcad23
    Determining *when* to generate the trap (either directly or
Packit fcad23
  via the mib2c-generated routine) is often harder.  If the trap
Packit fcad23
  is generated in response to some action within the agent, (e.g.
Packit fcad23
  as the result of a SET), then this isn't too much of a problem.
Packit fcad23
Packit fcad23
    But if the trap is intended to report on a change of status
Packit fcad23
  (e.g. a network interface going up or down, or a disk filling up),
Packit fcad23
  then actually detecting this is non-trivial.   Unless the underlying
Packit fcad23
  system can signal this situation to the agent, then it's typically
Packit fcad23
  necessary to poll the value(s) on a regular basis, save the results
Packit fcad23
  and compare them with the new values the next time round.
Packit fcad23
Packit fcad23
    The simplest way to handle this is via the DisMan Event MIB,
Packit fcad23
  which is designed for exactly this purpose.  As long as you can
Packit fcad23
  specify a MIB object to monitor, and the value or thresholds
Packit fcad23
  that should trigger a notification, then this module can check
Packit fcad23
  these values regularly, and automatically send a suitable trap
Packit fcad23
  when appropriate.  See the 'snmpd.conf(5)' man page (under
Packit fcad23
  ACTIVE MONITORING) for details.
Packit fcad23
  
Packit fcad23
    Otherwise, you'd need to use the routines documented in
Packit fcad23
  'snmp_alarm(3)' to regularly invoke a monitoring routine. This
Packit fcad23
  would check the necessary conditions (which need not be MIB
Packit fcad23
  objects), and call the 'send_xxx_trap()' routine (as generated
Packit fcad23
  by 'mib2c.notify.conf') when appropriate.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get an AgentX sub-agent to generate a trap (or inform)?
Packit fcad23
----------------------------------------------------------------
Packit fcad23
Packit fcad23
  This is done in exactly the same manner as with the main SNMP agent.
Packit fcad23
  Calling one of the routines described in 'snmp_trap_api(3)' will cause
Packit fcad23
  the AgentX sub-agent to send a notification to the master agent, which
Packit fcad23
  will then pass this on to the configured trap destination(s).
Packit fcad23
  
Packit fcad23
  One of the original design aims of the Net-SNMP AgentX support was that
Packit fcad23
  the agent (or subagent) framework should be transparent to a MIB module
Packit fcad23
  implementer. The interface between the agent framework and a MIB module
Packit fcad23
  should be independent of the protocol used to receive the original request.
Packit fcad23
  So the exact same MIB module code could be used within a traditional
Packit fcad23
  SNMP-only agent, or an AgentX subagent, with no changes needed.
Packit fcad23
Packit fcad23
    This also holds for sending traps.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get the agent to send an SNMPv1 (or SNMPv2c) trap?
Packit fcad23
-----------------------------------------------------------
Packit fcad23
Packit fcad23
    It doesn't make any difference whether you use the v1-style
Packit fcad23
  API call 'send_easy_trap()' or the v2-style 'send_v2trap()'.
Packit fcad23
  What matters is the directive(s) in the snmpd.conf file.
Packit fcad23
Packit fcad23
    If this file contains 'trapsink', then the agent will send
Packit fcad23
  an SNMPv1 trap.  If this file contains 'trap2sink', then the
Packit fcad23
  agent will send an SNMPv2c trap.  And if this file contains
Packit fcad23
  both, then the agent will send *two* copies of this trap.
Packit fcad23
Packit fcad23
  See the entry
Packit fcad23
     Where are these traps sent to?
Packit fcad23
  in the AGENT section for details.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get the agent to include varbinds with an SNMPv1 trap?
Packit fcad23
---------------------------------------------------------------
Packit fcad23
Packit fcad23
    There are two ways to do this.  You can either use the
Packit fcad23
  'send_v2trap()' call and give a varbind list, starting with
Packit fcad23
  the v2-equivalent of the SNMPv1 trap, followed by the
Packit fcad23
  additional varbinds.
Packit fcad23
Packit fcad23
    Alternatively, you can use the API call 'send_trap_vars()'
Packit fcad23
  which takes the same generic/specific trap values as
Packit fcad23
  'send_easy_trap()', plus the list of additional varbinds.
Packit fcad23
Packit fcad23
    In either case, you also need to have 'trapsink' in the
Packit fcad23
  snmpd.conf file.  The resulting trap will be identical,
Packit fcad23
  whichever approach is used.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get the agent to send an SNMPv1 enterprise-specific trap?
Packit fcad23
------------------------------------------------------------------
Packit fcad23
Packit fcad23
    There are two ways to do this.  You can either use the
Packit fcad23
  'send_v2trap()' call and give a varbind list, starting
Packit fcad23
  with the v2-equivalent of the SNMPv1 trap, followed by the
Packit fcad23
  additional varbinds.
Packit fcad23
Packit fcad23
    Alternatively, you can use the (undocumented) API call
Packit fcad23
  'send_enterprise_trap_vars()' which takes the same parameters
Packit fcad23
  as 'send_trap_vars()', plus the enterprise OID to use (in the
Packit fcad23
  usual name/length form).  See the code file 'agent_trap.c'
Packit fcad23
Packit fcad23
    In either case, you also need to have 'trapsink' in the
Packit fcad23
  snmpd.conf file.  The resulting trap will be identical,
Packit fcad23
  whichever approach is used.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I get the agent to send an SNMPv3 trap (or inform)?
Packit fcad23
----------------------------------------------------------
Packit fcad23
Packit fcad23
    It doesn't matter which API call you use to specify the
Packit fcad23
  trap - 'send_easy_trap()', 'send_v2trap()' or one of the other
Packit fcad23
  calls mentioned above.  Generating an SNMPv3 notification
Packit fcad23
  (rather than a community-based one) is controlled by the
Packit fcad23
  snmpd.conf file.
Packit fcad23
  
Packit fcad23
    To send an SNMPv3 trap, this file should contain a
Packit fcad23
  'snmpsess' directive, specifying the version, security
Packit fcad23
  level, user name and passphrases (if applicable), as
Packit fcad23
  well as the destination address.  This is basically
Packit fcad23
  the same as the command line required for sending the
Packit fcad23
  trap manually, using 'snmptrap'.
Packit fcad23
Packit fcad23
    Note that (unlike 'snmptrap') this directive does *not*
Packit fcad23
  read default settings from an 'snmp.conf' file, so these
Packit fcad23
  must be specified explicitly in the 'snmpsess' line.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
Why does calling 'send_v2trap' generate an SNMPv1 trap (or vice versa)?
Packit fcad23
----------------------------------------------------------------------
Packit fcad23
Packit fcad23
    The two versions of the trap API calls are concerned with how
Packit fcad23
  the trap is represented when it is passed *in* to the API, not
Packit fcad23
  the version of the trap PDU that will actually be generated by
Packit fcad23
  the agent.  That is determined by the configuration token used
Packit fcad23
  to set up the trap destination.
Packit fcad23
Packit fcad23
    Remember that in general, all traps are sent to all destinations.
Packit fcad23
  This means that a trap specified using the SNMPv1 trap syntax
Packit fcad23
  needs to be converted to the SNMPv2 format before it can be sent
Packit fcad23
  to an SNMPv2 (or SNMPv3) destination.  Similarly, a trap specified
Packit fcad23
  using the SNMPv2 syntax needs to be converted to the SNMPv1 format
Packit fcad23
  before it can be sent to an SNMPv1 sink.
Packit fcad23
Packit fcad23
    Essentially, the API call to use depends on what you asking for,
Packit fcad23
  which is not necessarily what the recipients will actually get!
Packit fcad23
  See 'snmp_trap_api(3)' for a fuller explanation.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
How can I register a MIB module in a different (SNMPv3) context?
Packit fcad23
---------------------------------------------------------------
Packit fcad23
Packit fcad23
    Contexts are a mechanism within SNMPv3 (and AgentX) whereby
Packit fcad23
  an agent can support parallel versions of the same MIB objects,
Packit fcad23
  referring to different underlying data sets.  By default, a MIB
Packit fcad23
  module registrations will use the default empty context of "".
Packit fcad23
  But it's also possible to provide MIB information using a different
Packit fcad23
  (non-default) context.
Packit fcad23
Packit fcad23
    There are three aspects involved in doing this.  Firsly, it's necessary
Packit fcad23
  to register the MIB module in this non-default context.  With the v4 API,
Packit fcad23
  this uses the call 'register_mib_context()' rather than the REGISTER_MIB
Packit fcad23
  macro.  This is significantly more detailed, but most of the additional
Packit fcad23
  parameters can take fixed values, if all that's needed is to change the
Packit fcad23
  registration context.
Packit fcad23
Packit fcad23
  Instead of the macro call:
Packit fcad23
        REGISTER_MIB("my_token", my_variables, variable1, my_variables_oid);
Packit fcad23
  use the function call:
Packit fcad23
        register_mib_context( "my_token",
Packit fcad23
                               my_variables, sizeof(variable1),
Packit fcad23
                               sizeof(my_variables)/sizeof(variable1),
Packit fcad23
                               my_variables_oid,
Packit fcad23
                               sizeof(my_variables_oid)/sizeof(oid),
Packit fcad23
                               DEFAULT_MIB_PRIORITY, 0, 0, NULL,
Packit fcad23
                               "my_context", -1, 0);
Packit fcad23
Packit fcad23
    Things are much easier with the v5 helper-based API.  Having
Packit fcad23
  created the registration structure, this just requires setting the
Packit fcad23
  'contextName' field before actually registering the MIB module:
Packit fcad23
        netsnmp_handler_registration *reg;
Packit fcad23
        reg = netsnmp_create_handler_registration(.....);
Packit fcad23
        reg->contextName = strdup("my_context");
Packit fcad23
        netsnmp_register_handler(reg);
Packit fcad23
Packit fcad23
Packit fcad23
  Secondly, it is necessary to configure the access control settings to allow
Packit fcad23
  access to information in the new context.  This is handled automatically
Packit fcad23
  when using the simple "rouser" or "rwuser" directives.  But if access control
Packit fcad23
  is configured using the fuller com2sec/group/view/access mechanism, then the
Packit fcad23
  "access" line must specify the appropriate context(s), either explicitly:
Packit fcad23
Packit fcad23
	access {group} "my_context" any noauth exact  ......
Packit fcad23
Packit fcad23
  or using a single entry to cover all possible contexts:
Packit fcad23
Packit fcad23
	access {group} ""           any noauth prefix ......
Packit fcad23
Packit fcad23
Packit fcad23
  Finally, the SNMP request used to retrieve (or update) the information
Packit fcad23
  must also specify the required context.  With SNMPv3 requests, the context
Packit fcad23
  is part of the protocol, so this can be done using a command-line option:
Packit fcad23
Packit fcad23
      snmpwalk -v 3 -n my_context .....
Packit fcad23
Packit fcad23
  With community-based requests (SNMPv1 and SNMPv2c), things aren't so simple.
Packit fcad23
  Although the "rocommunity" and "rwcommunity" settings also configure access
Packit fcad23
  for all possible contexts, there's no way to specify a non-default context
Packit fcad23
  as part of the request.
Packit fcad23
Packit fcad23
  The only way to handle non-default contexts with community-based SNMP requests
Packit fcad23
  is to set up a mapping from the community string to the desired context.  This
Packit fcad23
  uses the "com2sec" directive, with an additional "-Cn" parameter.   Note that
Packit fcad23
  this also means that the access control must be configured using the full
Packit fcad23
  com2sec/group/view/access mechanism.  The short-form access control directives
Packit fcad23
  do not handle the mapping of community strings to non-default contexts.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
MISC
Packit fcad23
======
Packit fcad23
Packit fcad23
What ASN.1 parser is used?
Packit fcad23
-------------------------
Packit fcad23
Packit fcad23
  The parser used by both the agent and client programs is coded by hand.
Packit fcad23
  This parser has recently been re-vamped to allow control of which of 
Packit fcad23
  the available MIBs should be included, and to handle duplicate object
Packit fcad23
  subidentifiers.
Packit fcad23
    The source code can be found in the snmplib directory (in 'parse.c'),
Packit fcad23
  and the parser is usually bundled into the library 'libnetsnmp.a'
Packit fcad23
Packit fcad23
    Note that the parser attempts to be fairly forgiving of some common
Packit fcad23
  errors and incompatibilities in MIB files.  The Net-SNMP tools accepting
Packit fcad23
  a MIB file without complaint does *not* imply that the MIB is strictly
Packit fcad23
  correct.
Packit fcad23
    Certain MIBs may need some amendments to allow them to be read
Packit fcad23
  correctly by the parser.  Contact the coders' list for advice.
Packit fcad23
Packit fcad23
Packit fcad23
Packit fcad23
What is the Official Slogan of the net-snmp-coders list?
Packit fcad23
-------------------------------------------------------
Packit fcad23
Packit fcad23
  "The current implementation is non-obvious and may need to be improved."
Packit fcad23
	(with thanks to Rohit Dube)
Packit fcad23
Packit fcad23
  And an alternate, added 26-Apr-2000:
Packit fcad23
  
Packit fcad23
  "In theory, it shouldn't be that hard, but it just needs to be done."
Packit fcad23
Packit fcad23
Packit fcad23