blob: d302100d9a7ae7416f537bbe344e4c52dbd1416c [file] [log] [blame]
Dave Shieldbae701f2003-10-29 10:59:23 +00001 Frequently Asked Questions (FAQ) for the UCD/Net-SNMP package
Wes Hardaker51d88c72000-11-30 18:31:56 +00002 =============================================================
Wes Hardaker7dcf0861997-04-22 06:42:01 +00003 FAQ Author: Dave Shield
Wes Hardaker18d116b2011-09-27 21:11:52 -07004 Net-SNMP Version: 5.7.1
Wes Hardaker4e175ac2009-09-23 23:36:01 +00005 Net-SNMP/UCD-SNMP Project Leader: Wes Hardaker
Dave Shield43dcec82002-03-11 15:42:08 +00006 Email: net-snmp-coders@lists.sourceforge.net
Wes Hardaker8acf73f1997-02-04 08:41:39 +00007
8TABLE OF CONTENTS
9=================
10
11 TABLE OF CONTENTS
12 GENERAL
13 What is it?
14 Where can I get it?
15 What documentation is available?
16 Are there binaries available?
Wes Hardaker51d88c72000-11-30 18:31:56 +000017 What's the difference between UCD-SNMP and Net-SNMP?
Wes Hardaker8acf73f1997-02-04 08:41:39 +000018 What operating systems does it run on?
19 What happens if mine isn't listed?
Dave Shieldceab78b1999-08-09 08:02:15 +000020 Does it run on Windows?
Wes Hardaker8acf73f1997-02-04 08:41:39 +000021 How do I find out about new releases?
Dave Shield13c14522006-12-29 17:25:33 +000022 How can I find out what other people are doing?
Wes Hardaker8acf73f1997-02-04 08:41:39 +000023 How do I submit a patch or bug report?
Wes Hardaker00cdead2002-10-07 17:57:37 +000024 Can I reuse the code in my commercial application?
Wes Hardaker468df0b1998-05-14 15:21:55 +000025 What's the difference between SNMPv1, SNMPv2 and SNMPv3?
Dave Shield4746cba2004-04-14 09:28:21 +000026 What's the difference between SNMPv2 and SNMPv2c?
Wes Hardakerb922f281997-10-20 18:45:58 +000027 Which versions of SNMP are supported in this package?
Dave Shield634ffdc2002-03-28 23:23:25 +000028 Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)?
Dave Shield5b58b2f2009-07-21 09:15:07 +000029 How can I monitor my system with SNMP?
Wes Hardakerf13d1ce1999-03-05 18:21:25 +000030 Where can I find more information about network management?
Dave Shield5b58b2f2009-07-21 09:15:07 +000031 What ports does SNMP use?
Dave Shield90059672004-07-16 16:08:50 +000032 Is Net-SNMP thread safe?
Wes Hardakerf13d1ce1999-03-05 18:21:25 +000033 APPLICATIONS
Wes Hardaker8acf73f1997-02-04 08:41:39 +000034 How do I add a MIB?
Wes Hardakerb922f281997-10-20 18:45:58 +000035 How do I add a MIB to the tools?
Dave Shield5da154e2002-03-12 16:35:01 +000036 Why can't I see anything from the agent?
Dave Shieldab90a5e2006-11-24 11:21:53 +000037 Why doesn't the agent respond?
Wes Hardaker51d88c72000-11-30 18:31:56 +000038 I can see the system group, but nothing else. Why?
Dave Shield13c14522006-12-29 17:25:33 +000039 Why can't I see values in the <ENTERPRISE> tree?
Dave Shield5da154e2002-03-12 16:35:01 +000040 The agent worked for a while, then stopped responding. Why?
Wes Hardaker6241ebf2001-04-06 19:12:28 +000041 Requesting an object fails with "Unknown Object Identifier" Why?
42 Why do I get "noSuchName" when asking for "sysUpTime" (or similar)?
Wes Hardaker3eb7caf1998-05-20 14:34:31 +000043 Why do I sometimes get "End of MIB" when walking a tree, and sometimes not?
Dave Shieldab90a5e2006-11-24 11:21:53 +000044 How do I use SNMPv3?
Dave Shield13c14522006-12-29 17:25:33 +000045 Why can't I set any variables in the MIB?
Wes Hardakerf13d1ce1999-03-05 18:21:25 +000046 Variables seem to disappear when I try to set them. Why?
Dave Shieldab90a5e2006-11-24 11:21:53 +000047 Why can't I change sysLocation (or sysContact)?
Wes Hardaker51d88c72000-11-30 18:31:56 +000048 I get an error when trying to set a negative value - why?
Dave Shield49ac3782009-05-28 10:41:30 +000049 I get an error when trying to query a string-indexed table value - why?
50 How should I specify string-indexed table values?
Wes Hardaker51d88c72000-11-30 18:31:56 +000051 How do I send traps and notifications?
Dave Shield49ac3782009-05-28 10:41:30 +000052 How do I receive traps and notifications?
53 How do I receive SNMPv1 traps?
54 Why don't I receive incoming traps?
Dave Shield679c10d2002-06-10 08:28:43 +000055 My traphandler script doesn't work when run like this - why not?
Dave Shield49ac3782009-05-28 10:41:30 +000056 How can the agent receive traps and notifications?
Wes Hardaker51d88c72000-11-30 18:31:56 +000057 How big can an SNMP request (or reply) be?
Wes Hardaker00be2092000-12-01 17:10:30 +000058 How can I monitor my systems (disk, memory, etc)?
Dave Shieldceab78b1999-08-09 08:02:15 +000059 Applications complain about entries in your example 'snmp.conf' file. Why?
Wes Hardaker51d88c72000-11-30 18:31:56 +000060 OK, what should I put in snmp.conf?
Dave Shield24569f72009-05-28 11:31:51 +000061 How do I specify IPv6 addresses in tools command line arguments?
Dave Shield5da154e2002-03-12 16:35:01 +000062 PERL
Dave Shield5b58b2f2009-07-21 09:15:07 +000063 What is the purpose of the Perl SNMP module?
Thomas Andersb3905ba2006-11-24 13:13:36 +000064 Where can I get the Perl SNMP package?
Dave Shield6f04d7b2003-01-09 16:55:35 +000065 How do I install the Perl SNMP modules?
Dave Shield5da154e2002-03-12 16:35:01 +000066 But compiling this fails! Why?
Thomas Andersb3905ba2006-11-24 13:13:36 +000067 Compiling the Perl module works OK, but 'make test' fails. Why?
Dave Shield13c14522006-12-29 17:25:33 +000068 Why can't mib2c (or tkmib) locate SNMP.pm?
69 Why can't mib2c (or tkmib) load SNMP.so?
70 Why can't tkmib locate Tk.pm?
71 Why does your RPM complain about missing Perl modules?
Dave Shield6f04d7b2003-01-09 16:55:35 +000072 I've got a problem with the Net-SNMP module. Can you help?
Wes Hardaker51d88c72000-11-30 18:31:56 +000073 MIBS
74 Where can I find a MIB compiler?
Dave Shield45090bc2009-05-28 12:41:35 +000075 Why aren't my MIB files being read in?
76 Where should I put my MIB files?
Dave Shield92e01512002-03-13 12:03:22 +000077 What does "Cannot find module (XXX-MIB)" mean?
Dave Shield45090bc2009-05-28 12:41:35 +000078 I'm getting answers, but they're all numbers. Why?
79 What does "unlinked OID" mean?
Dave Shieldceab78b1999-08-09 08:02:15 +000080 The parser doesn't handle comments properly. Why not?
Dave Shield80489f92006-11-24 13:41:23 +000081 How can I get more information about problems with MIB files?
Wes Hardakerf13d1ce1999-03-05 18:21:25 +000082 What's this about "too many imported symbols"?
Dave Shield90059672004-07-16 16:08:50 +000083 Do I actually need the MIB files?
Wes Hardaker51d88c72000-11-30 18:31:56 +000084 AGENT
85 What MIBs are supported?
86 What protocols are supported?
Wes Hardaker74c2e712000-12-01 22:36:54 +000087 How do I configure the agent?
Dave Shielda8e43f52004-11-09 16:12:38 +000088 How do I remove a MIB from the agent?
Dave Shield90059672004-07-16 16:08:50 +000089 I've installed a new MIB file. Why can't I query it?
Dave Shield80489f92006-11-24 13:41:23 +000090 How do I add a MIB to the agent?
91 What's the difference between 'exec', 'sh', 'extend' and 'pass'?
Wes Hardaker51d88c72000-11-30 18:31:56 +000092 What's the difference between AgentX, SMUX and proxied SNMP?
Dave Shield5a33a462009-06-15 15:25:06 +000093 What is the purpose of 'dlmod'?
Wes Hardaker6241ebf2001-04-06 19:12:28 +000094 Which should I use?
Dave Shield74164ed2003-01-10 13:31:00 +000095 Can I use AgentX when running under Windows?
Dave Shield28c29aa2003-02-04 14:25:43 +000096 How can I run AgentX with a different socket address?
Dave Shielda8e43f52004-11-09 16:12:38 +000097 How can I turn off SMUX support?
Wes Hardaker6241ebf2001-04-06 19:12:28 +000098 How can I combine two copies of the 'mib2' tree from separate subagents?
Wes Hardaker51d88c72000-11-30 18:31:56 +000099 What traps are sent by the agent?
Dave Shieldbae701f2003-10-29 10:59:23 +0000100 Where are these traps sent to?
Dave Shield634ffdc2002-03-28 23:23:25 +0000101 How can I send a particular trap to selected destinations?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000102 When I run the agent it runs and then quits without staying around. Why?
Dave Shield6f04d7b2003-01-09 16:55:35 +0000103 After a while the agent stops responding, and starts eating CPU time. Why?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000104 How can I stop other people getting at my agent?
105 How can I listen on just one particular interface?
Dave Shield5a33a462009-06-15 15:25:06 +0000106 The agent is complaining about 'snmpd.conf'. Where is this?
107 Why does the agent complain about 'no access control information'?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000108 How do I configure access control?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000109 How do I configure SNMPv3 users?
110 The 'createUser' line disappears when I start the agent. Why?
Dave Shieldab90a5e2006-11-24 11:21:53 +0000111 What's the difference between /var/net-snmp and /usr/local/share/snmp?
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000112 My new agent is ignoring the old snmpd.conf file. Why?
Dave Shield5a33a462009-06-15 15:25:06 +0000113 Where should the snmpd.conf file go?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000114 Why am I getting "Connection refused"?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000115 Why can't I see values in the UCDavis 'extensible' or 'disk' trees?
116 Why can't I see values in the UCDavis 'memory' or 'vmstat' tree?
117 What do the CPU statistics mean - is this the load average?
Wes Hardakerd0d19c12004-02-24 00:32:03 +0000118 How do I get percentage CPU utilization using ssCpuRawIdle?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000119 What about multi-processor systems?
120 The speed/type of my network interfaces is wrong - how can I fix it?
121 The interface statistics for my subinterfaces are all zero - why?
Dave Shield4746cba2004-04-14 09:28:21 +0000122 Does the agent support the RMON-MIB?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000123 What does "klread: bad address" mean?
124 What does "nlist err: wombat not found" (or similar) mean?
Dave Shield5a33a462009-06-15 15:25:06 +0000125 What does "Can't open /dev/kmem" mean?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000126 The system uptime (sysUpTime) returned is wrong!
Dave Shielda8e43f52004-11-09 16:12:38 +0000127 Can the agent run multi-threaded?
Dave Shield5a33a462009-06-15 15:25:06 +0000128 Can I use AgentX (or an embedded SNMP agent) in a threaded application?
Dave Shieldbae701f2003-10-29 10:59:23 +0000129 COMPILING
Dave Shield9e214a62009-07-19 15:09:52 +0000130 How do I control the environment used to compile the software?
131 How do I control the environment used to compile the software under Windows?
132 Why does the compilation complain about missing libraries?
Dave Shield90059672004-07-16 16:08:50 +0000133 How can I reduce the memory footprint?
Dave Shielda8e43f52004-11-09 16:12:38 +0000134 How can I reduce the installation footprint or speed up compilation?
Dave Shield9e214a62009-07-19 15:09:52 +0000135 How can I compile the project for use on an embedded system?
Dave Shielda8e43f52004-11-09 16:12:38 +0000136 How can I compile the project to use static linking?
Dave Shield9e214a62009-07-19 15:09:52 +0000137 Why does 'make test' skip various tests?
Dave Shieldb9dfd6d2004-02-26 14:32:39 +0000138 Why does 'make test' complain about a pid file?
Dave Shieldbae701f2003-10-29 10:59:23 +0000139 CODING
140 How do I write C code to integrate with the agent?
Dave Shield90059672004-07-16 16:08:50 +0000141 How does the agent fetch the value of a MIB variable from the system?
Dave Shieldbae701f2003-10-29 10:59:23 +0000142 Mib2c complains about a missing "mib reference" - what does this mean?
143 Mib2c complains about not having a "valid OID" - what does this mean?
Dave Shield02138782005-11-15 10:28:50 +0000144 Why doesn't mib2c like the MIB file I'm giving it?
Dave Shieldbae701f2003-10-29 10:59:23 +0000145 Mib2c ignores my MIB and generates a pair of 'mib-2' code files. Why?
Dave Shield02138782005-11-15 10:28:50 +0000146 What's the difference between the various mib2c configuration files?
Dave Shieldbae701f2003-10-29 10:59:23 +0000147 Which mib2c configuration file should I use?
Dave Shield02138782005-11-15 10:28:50 +0000148 How can I have mib2c generate code for both scalars and tables?
Dave Shield79269022009-07-20 19:24:09 +0000149 Are there any examples, or documentation for developing MIB modules?
Dave Shieldbae701f2003-10-29 10:59:23 +0000150 Where should I put the files produced by 'mib2c'?
Dave Shield79269022009-07-20 19:24:09 +0000151 Why doesn't my new MIB module report anything?
Dave Shield90059672004-07-16 16:08:50 +0000152 Why does the iterator call my get_{first,next} routines so often?
Dave Shieldbae701f2003-10-29 10:59:23 +0000153 How can I get the agent to generate a trap (or inform)?
Dave Shield79269022009-07-20 19:24:09 +0000154 How can I get an AgentX sub-agent to generate a trap (or inform)?
Dave Shield90059672004-07-16 16:08:50 +0000155 How can I get the agent to send an SNMPv1 (or SNMPv2c) trap?
156 How can I get the agent to include varbinds with an SNMPv1 trap?
157 How can I get the agent to send an SNMPv1 enterprise-specific trap?
158 How can I get the agent to send an SNMPv3 trap (or inform)?
159 Why does calling 'send_v2trap' generate an SNMPv1 trap (or vice versa)?
Dave Shield4746cba2004-04-14 09:28:21 +0000160 How can I register a MIB module in a different (SNMPv3) context?
Dave Shieldbae701f2003-10-29 10:59:23 +0000161 MISC
Wes Hardaker51d88c72000-11-30 18:31:56 +0000162 What ASN.1 parser is used?
Dave Shieldbae701f2003-10-29 10:59:23 +0000163 What is the Official Slogan of the net-snmp-coders list?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000164
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000165
166GENERAL
167=======
168
169What is it?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000170----------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000171
172 - Various tools relating to the Simple Network Management Protocol
173 including:
174
175 * An extensible agent
176 * An SNMP library
177 * tools to request or set information from SNMP agents
178 * tools to generate and handle SNMP traps
179 * a version of the unix 'netstat' command using SNMP
Wes Hardakerd4b0c911999-02-08 23:08:57 +0000180 * a graphical Perl/Tk/SNMP based mib browser
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000181
182 This package is originally based on the Carnegie Mellon University
Wes Hardaker468df0b1998-05-14 15:21:55 +0000183 SNMP implementation (version 2.1.2.1), but has developed significantly
184 since then.
185
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000186
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000187
188Where can I get it?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000189------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000190
Wes Hardaker74c2e712000-12-01 22:36:54 +0000191 Download:
Wes Hardaker9743e9f2001-10-11 21:01:50 +0000192 - http://www.net-snmp.org/download/
Wes Hardakerb01738d2001-12-24 23:41:43 +0000193 - ftp://ftp.net-snmp.org/pub/sourceforge/net-snmp/
Wes Hardaker74c2e712000-12-01 22:36:54 +0000194 Web page:
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000195 - http://www.net-snmp.org/
196 Sourceforge Project page:
Wes Hardaker9743e9f2001-10-11 21:01:50 +0000197 - http://www.net-snmp.org/project/
Wes Hardakerd2433952002-10-08 22:55:48 +0000198 Mirrors (note that sourceforge download servers are mirrored themselves):
Dave Shield43dcec82002-03-11 15:42:08 +0000199 - US: ftp://ftp.freesnmp.com/mirrors/net-snmp/
Wes Hardakerf8a32812003-11-24 17:38:18 +0000200 - Greece: ftp://ftp.ntua.gr/pub/net/snmp/net-snmp/
Wes Hardakerdc8282f1998-06-08 17:50:12 +0000201
Wes Hardaker51d88c72000-11-30 18:31:56 +0000202
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000203What documentation is available?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000204-------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000205
206 This FAQ (!)
Wes Hardakerd0d19c12004-02-24 00:32:03 +0000207 README and individual READMEs for various platforms
Dave Shieldb9dfd6d2004-02-26 14:32:39 +0000208 README.thread (discusses threading issues)
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000209 INSTALL
210 PORTING
211 EXAMPLE.conf
212 man pages for the individual tools, files and the API
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000213 A guide for extending the agent
Dave Shield754ec232002-05-29 09:42:26 +0000214 Tutorials for both ucd-snmp v4 and net-snmp v5
215 at http://www.net-snmp.org/tutorial/
216 and http://www.net-snmp.org/tutorial-5/ respectively
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000217
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000218 Most of this documentation (plus archives of the mailing lists)
219 is also available on our web page:
220
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000221 http://www.net-snmp.org/
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000222
Dave Shieldab90a5e2006-11-24 11:21:53 +0000223 There is also a Wiki (including a community-maintained version
224 of this FAQ) at
225
226 http://www.net-snmp.org/wiki/
227
Wes Hardaker468df0b1998-05-14 15:21:55 +0000228
229
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000230Are there binaries available?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000231----------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000232
Dave Shieldab90a5e2006-11-24 11:21:53 +0000233 There are binaries for some versions/systems available under
Dave Shield13c14522006-12-29 17:25:33 +0000234 the "net-snmp binaries" package on the SourceForge "Files"
235 page, which is linked to from the main project download web
236 page at http://www.net-snmp.org/download.html.
237
238 These binaries are also available on the project FTP site,
239 with a link on the same web page.
240
241 There is also a mirror at ftp://ftp.freesnmp.org/mirrors/net-snmp/
Wes Hardaker468df0b1998-05-14 15:21:55 +0000242
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000243
244
Wes Hardaker51d88c72000-11-30 18:31:56 +0000245What's the difference between UCD-SNMP and Net-SNMP?
246---------------------------------------------------
Wes Hardakerf54dd3a1999-01-20 20:20:08 +0000247
Wes Hardaker51d88c72000-11-30 18:31:56 +0000248 Not a great deal, really.
249 Although the project originally started at UC Davis (hence the name),
250 and it has always been based there, most of the contributors have had
251 little or no connection with this institution.
Wes Hardaker07ba34d2000-04-25 20:08:39 +0000252
Dave Shield5da154e2002-03-12 16:35:01 +0000253 The move to SourceForge was intended to provide a more flexible
Wes Hardaker51d88c72000-11-30 18:31:56 +0000254 environment for the project, and to distribute the administrative
255 workload more evenly. The change of name simply reflects this move,
256 which was the last remaining link with UC Davis.
Wes Hardakerf54dd3a1999-01-20 20:20:08 +0000257
Dave Shieldab90a5e2006-11-24 11:21:53 +0000258 The 4.2.x line saw the last releases made using the ucd-snmp name,
259 and all releases on this line have been been bug-fixes only. Release
260 5.0 was the first version released under the Net-SNMP name, and all
261 further development is being done on the 5.x code base. The 4.2.x
Dave Shield009ee122009-05-27 15:26:02 +0000262 code line is now effectively closed down, as are the older 5.x branches.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000263
264 Much of the work done for the various 5.x releases has involved
265 some fairly significant changes to the code - in particular the
266 architecture of the agent. However attempts have been made to retain
267 backwards compatibility as much as possible, and most code written
Dave Shield009ee122009-05-27 15:26:02 +0000268 for earlier releases should continue to work. The most visible
269 change from the 4.2.x UCD suite to the 5.x Net-SNMP releases was a
Dave Shield5da154e2002-03-12 16:35:01 +0000270 restructuring of the header file organisation - not least a change
271 from <ucd-snmp/xxx.h> to <net-snmp/yyy.h>.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000272
Dave Shieldab90a5e2006-11-24 11:21:53 +0000273 But given the maturity of the Net-SNMP code, this should be less
274 of a consideration for most current SNMP development projects.
275
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000276
Wes Hardakerd4b0c911999-02-08 23:08:57 +0000277
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000278What operating systems does it run on?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000279-------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000280
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000281 Both the applications and the agent have been reported as running
Wes Hardaker51d88c72000-11-30 18:31:56 +0000282 (at least in part) on the following operating systems:
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000283
Thomas Anders71b94002005-12-27 21:45:30 +0000284 * Linux (kernels 2.6 to 1.3)
Thomas Andersf042d992005-10-07 20:38:13 +0000285 * Solaris/SPARC (11 to 2.3), Solaris/Intel (10, 9) -- see
Thomas Andersc3c9ddd2005-07-26 10:22:31 +0000286 README.solaris
Thomas Anders9d099b52008-08-22 23:47:42 +0000287 * HP-UX (11.31 to 9.01) -- see README.hpux11
288 * Mac OS X (10.5 to 10.1) -- see README.osX
Thomas Andersf042d992005-10-07 20:38:13 +0000289 * NetBSD (2.0 to 1.0)
Thomas Anders9d099b52008-08-22 23:47:42 +0000290 * FreeBSD (7.0 to 2.2)
Thomas Anderse895b9d2006-09-27 16:51:37 +0000291 * OpenBSD (4.0 to 2.6)
Thomas Anders71b94002005-12-27 21:45:30 +0000292 * BSDi (4.0.1 to 2.1)
Thomas Anders9d099b52008-08-22 23:47:42 +0000293 * AIX (6.1, 5.3, 5.2, 5.1, 4.3.3, 4.1.5, 3.2.5) -- see README.aix
Thomas Andersf042d992005-10-07 20:38:13 +0000294 * IRIX (6.5 to 5.1)
Thomas Anders9d099b52008-08-22 23:47:42 +0000295 * OSF (4.0, 3.2 and Tru64 Unix 5.1B) -- see README.tru64
Thomas Anders71b94002005-12-27 21:45:30 +0000296 * SunOS 4 (4.1.4 to 4.1.2)
297 * Ultrix (4.5 to 4.2)
Dave Shield43dcec82002-03-11 15:42:08 +0000298 * Dynix/PTX 4.4
Dave Shieldb9dfd6d2004-02-26 14:32:39 +0000299 * QNX 6.2.1A
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000300
Dave Shield597ee892003-01-03 13:05:14 +0000301 We have also been informed about a port to the Stratus VOS.
302 See http://ftp.stratus.com/vos/network/network.html for details.
303
Dave Shield13c14522006-12-29 17:25:33 +0000304 See the next question but one for the status of Windows support.
Wes Hardaker51d88c72000-11-30 18:31:56 +0000305
Dave Shield90059672004-07-16 16:08:50 +0000306 Certain systems fail to compile particular portions of the agent.
307 These can usually be persuaded to compile (at the loss of some
308 functionality) by omitting the modules affected.
Wes Hardaker51d88c72000-11-30 18:31:56 +0000309 See the next question for more details.
Dave Shieldceab78b1999-08-09 08:02:15 +0000310
311 Also note that the presence of a particular configuration in this
Dave Shield13c14522006-12-29 17:25:33 +0000312 list does not imply a perfect or complete implementation. This
313 is simply what various people have reported as seeming to work.
314 (Or more frequently, the configurations where people have reported
315 problems that we think we've subsequently fixed!)
Dave Shieldceab78b1999-08-09 08:02:15 +0000316
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000317
Wes Hardaker468df0b1998-05-14 15:21:55 +0000318
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000319What happens if mine isn't listed?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000320---------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000321
Dave Shieldab90a5e2006-11-24 11:21:53 +0000322 It's probably worth trying to compile it anyway. Unless your
323 system is significantly different to the supported configurations,
324 most of the code (library, applications and the agent infrastructure)
325 should probably compile with little or no difficulty. The most
326 likely source of problems will be MIB modules within the agent,
327 as this tends to be where the most system-specific code is found.
Michael Slifcake72b6a92000-03-07 18:13:41 +0000328
Dave Shield5da154e2002-03-12 16:35:01 +0000329 If only a few modules fail to compile, try removing them from
330 the agent by running "configure --with-out-mib-module=xxx,yyy",
331 and re-compiling. If a large number of modules fail, then it
332 might be easier to start from a relatively bare system, using
333 "configure --enable-mini-agent --with-defaults". Then if this
Dave Shieldab90a5e2006-11-24 11:21:53 +0000334 minimal agent compiles and runs successfully, try adding each of
335 the missing mibgroups individually using the configure option
336 '--with-mib-module'.
Dave Shield5da154e2002-03-12 16:35:01 +0000337
338 If configure fails with "invalid configuration" messages, or
339 you get completely stuck, contact the coders list for advice.
340 Similarly, if you manage to get this working on a new system,
Dave Shieldab90a5e2006-11-24 11:21:53 +0000341 please let us know of any code changes that you needed to make,
342 together with details of the hardware you're using, and what
343 versions of the operating system you've tried it on. The entry
344 'host' in the file 'config.status' should show this information.
345 Oh, and congratulations!
Wes Hardaker09ce9c01998-06-19 15:41:00 +0000346
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000347
Wes Hardaker468df0b1998-05-14 15:21:55 +0000348
Dave Shieldceab78b1999-08-09 08:02:15 +0000349Does it run on Windows?
350----------------------
351
Dave Shield13c14522006-12-29 17:25:33 +0000352 The suite should compile and run on Win32 platforms, including
Dave Shield5da154e2002-03-12 16:35:01 +0000353 the library, command-line tools and the basic agent framework.
354 Note that the agent now includes support for the MIB-II module,
355 but this requires Microsoft's Core Platform SDK. Instructions
356 for how to install this are given in README.win32.
Wes Hardaker51d88c72000-11-30 18:31:56 +0000357
Dave Shield13c14522006-12-29 17:25:33 +0000358 Pre-compiled binaries are available from the project web site.
Alex Burger7e46e522006-12-17 16:51:40 +0000359
Dave Shield13c14522006-12-29 17:25:33 +0000360 As of v5.4, the Net-SNMP agent is able to load the Windows SNMP
361 service extension DLLs by using the Net-SNMP winExtDLL extension.
Alex Burger7e46e522006-12-17 16:51:40 +0000362
Dave Shield13c14522006-12-29 17:25:33 +0000363 Some other Net-SNMP MIB modules, including the UCD pass-through
364 extensions, do not currently work under Windows. Volunteers to assist
365 with these missing modules are likely to welcomed with open arms :-)
Dave Shieldceab78b1999-08-09 08:02:15 +0000366
Dave Shield90059672004-07-16 16:08:50 +0000367 Further details of Windows support (currently Visual C++, MinGW
Alex Burger7e46e522006-12-17 16:51:40 +0000368 and Cygnus cygwin32) is available in the file README.win32.
Dave Shieldceab78b1999-08-09 08:02:15 +0000369
370
371
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000372How do I find out about new releases?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000373------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000374
375 There is a mailing list for these announcements
Wes Hardaker51d88c72000-11-30 18:31:56 +0000376
377 net-snmp-announce@lists.sourceforge.net
378
Wes Hardaker74c2e712000-12-01 22:36:54 +0000379 To be added to (or removed from) this list, visit
Dave Shield009ee122009-05-27 15:26:02 +0000380 http://www.net-snmp.org/lists/net-snmp-announce/
381 Or you can send a message to the address
382 net-snmp-announce-request@lists.sourceforge.net
383 with a subject line of 'subscribe' (or 'unsubscribe' as appropriate).
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000384
Dave Shield009ee122009-05-27 15:26:02 +0000385 Advance notice of upcoming releases are also made on the
386 net-snmp-users list (for "release candidates") for a week
387 or two before the full release, and on the net-snmp-coders
388 list (for "pre-releases") during the period prior to this.
389
390 Major code revisions may be announced more widely, but these
391 lists are the most reliable way to keep in touch with the
392 status of the package.
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000393
Dave Shieldceab78b1999-08-09 08:02:15 +0000394 Patches to fix known problems are also made available via the web site:
Wes Hardaker51d88c72000-11-30 18:31:56 +0000395
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000396 http://www.net-snmp.org/patches/
Dave Shieldceab78b1999-08-09 08:02:15 +0000397
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000398
Wes Hardaker468df0b1998-05-14 15:21:55 +0000399
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000400How can I find out what other people are doing?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000401----------------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000402
403 There is a general purpose discussion list
Wes Hardaker51d88c72000-11-30 18:31:56 +0000404
405 net-snmp-users@lists.sourceforge.net
406
Wes Hardaker74c2e712000-12-01 22:36:54 +0000407 To be added to (or removed from) this list, visit
Dave Shield009ee122009-05-27 15:26:02 +0000408 http://www.net-snmp.org/lists/net-snmp-users/
409 Or you can send a message to the address
410 net-snmp-users-request@lists.sourceforge.net
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000411 with a subject line of 'subscribe' (or 'unsubscribe' as appropriate).
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000412
Dave Shield009ee122009-05-27 15:26:02 +0000413 To find out what the developers are doing, and to help them
414 out, please read the PORTING file enclosed with the package.
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000415
Dave Shield009ee122009-05-27 15:26:02 +0000416 There is also a #net-snmp IRC channel set up on the freenode.net
417 chat system. You can connect to this via chat.freenode.net.
418 See http://www.freenode.net/ for more information on getting
419 started with IRC.
420 Several core developers hang out on this channel on a fairly
421 regular basis.
Wes Hardaker468df0b1998-05-14 15:21:55 +0000422
423
Dave Shield5da154e2002-03-12 16:35:01 +0000424
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000425How do I submit a patch or bug report?
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000426-------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000427
Dave Shieldab90a5e2006-11-24 11:21:53 +0000428 The best way to submit a bug report is via the bug database through
Dave Shield009ee122009-05-27 15:26:02 +0000429 the interface found at
430 http://www.net-snmp.org/bugs/
431 Be sure to include the version of the package that you've been working
432 with, the output of the command 'uname -a', the precise configuration
433 or command that triggers the problem and a copy of any output produced.
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000434
Wes Hardaker15ddba02001-12-05 16:28:59 +0000435 Questions about using the package should be directed at the
Dave Shield5da154e2002-03-12 16:35:01 +0000436 net-snmp-users@lists.sourceforge.net mailing list. Note that this
437 mailing list is relatively busy, and the people answering these
438 questions are doing so out of the goodness of their hearts, and in
439 addition to their main employment. Please note the following:
Wes Hardaker51d88c72000-11-30 18:31:56 +0000440
Dave Shield5da154e2002-03-12 16:35:01 +0000441 - use plain text mail, rather than HTML
442 - don't resend questions more than once
443 (even if no-one answered immediately)
444 - include full details of exact commands and error messages
445 ("I've tried everything, and it doesn't work" isn't much use!)
446 - do *NOT* send messages to -users and -coders mailing lists
447 (most developers read both anyway)
448 - don't mail the developers privately - keep everything on the list
Wes Hardaker51d88c72000-11-30 18:31:56 +0000449
Dave Shield5da154e2002-03-12 16:35:01 +0000450 We can't promise to be able to solve all problems, but we'll
451 certainly try and help. But remember that this is basically an
452 unsupported package. It's Open Source, so if you need something
453 fixing badly enough, fundamentally it's up to you to do the work.
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000454
Dave Shield009ee122009-05-27 15:26:02 +0000455 All patches should be submitted to the patch manager at
456 http://www.net-snmp.org/patches/
457 If possible, submit a bug report describing the patch as well
458 (referencing it by its patch number) since the patch manager
459 doesn't contain a decent description field.
460
461 The best way to submit patch (diff) information is by checking out
Wes Hardakerf2df8a22011-06-28 08:29:08 -0700462 the current code from the development git trunk, making your changes
463 and then running "git diff" or "git format-patch" after you're done.
Dave Shield009ee122009-05-27 15:26:02 +0000464
Wes Hardakeraf8b2352011-06-28 13:11:19 -0700465 (Please see http://www.net-snmp.org/wiki/index.php/Git for further
466 information on using git with the Net-SNMP project)
467
Dave Shield009ee122009-05-27 15:26:02 +0000468 If you're working from a source code distribution, and comparing old
469 and new versions of a code file, use "diff -u OLDFILE NEWFILE"
470
Dave Shield90059672004-07-16 16:08:50 +0000471
472
Wes Hardaker00cdead2002-10-07 17:57:37 +0000473Can I reuse the code in my commercial application?
474-------------------------------------------------
475
Dave Shield90059672004-07-16 16:08:50 +0000476 The details of the COPYRIGHTs on the package can be found in the COPYING
477 file. You should have your lawyer read this file if you wish to use the
478 code in your commercial application. We will not summarize here what is
479 in the file, as we're not lawyers and are unqualified to do so.
480
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000481
Wes Hardaker468df0b1998-05-14 15:21:55 +0000482
483What's the difference between SNMPv1, SNMPv2 and SNMPv3?
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000484-------------------------------------------------------
Dave Shield4746cba2004-04-14 09:28:21 +0000485What's the difference between SNMPv2 and SNMPv2c?
486------------------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000487
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000488 A full description is probably beyond the scope of this FAQ.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000489 Very briefly, the original protocol and admin framework was
490 described in RFCs 1155-1157, and is now known as SNMPv1.
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000491
Dave Shield4746cba2004-04-14 09:28:21 +0000492 Practical experience showed up various problems and deficiencies
493 with this, and a number of revised frameworks were developed to try
494 and address these problems. Unfortunately, it proved difficult to
Dave Shieldab90a5e2006-11-24 11:21:53 +0000495 achieve any sort of agreement - particularly over the details of
496 the administrative framework to use.
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000497
Dave Shield4746cba2004-04-14 09:28:21 +0000498 There was less disagreement over the proposed changes to the
499 protocol operations. These included:
500 * increasing the range of errors that could be reported
501 * introducing "exception values"
502 (so a single missing value didn't affect
503 the other varbinds in the same request)
504 * a new GETBULK operation
505 (a supercharged GETNEXT)
506 * new notification PDUs
507 (closer in structure to the other request PDUs)
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000508
Dave Shield4746cba2004-04-14 09:28:21 +0000509 Strictly speaking, it's this revised protocol (originally defined
510 in RFC 1905, and most recently in RFC 3416) that is "SNMPv2".
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000511
Dave Shield4746cba2004-04-14 09:28:21 +0000512 The only framework based on this protocol that saw a significant
Dave Shield009ee122009-05-27 15:26:02 +0000513 level of use was "Community-based SNMPv2" or "SNMPv2c" (defined
514 in RFC 1901). This retained the same administrative framework
Dave Shieldab90a5e2006-11-24 11:21:53 +0000515 as SNMPv1 (with all of the accompanying limitations), but using
Dave Shield4746cba2004-04-14 09:28:21 +0000516 the new protocol operations.
517
518 More recently, a new administrative framework has been developed,
519 building on the various competing SNMPv2 proposals, and using the
520 same SNMPv2 protocol operations. This is SNMPv3, which is defined
521 in RFCs 3411-3418. It addresses some of the deficiencies of the
522 community-based versions, including significant improvements to
523 the security of SNMP requests (like it finally has some!).
524 SNMPv3 is now a full IETF standard protocol.
525
526 Strictly speaking, SNMPv3 just defines a fairly abstract framework,
527 based around the idea of "Security Models" and "Access Control Models".
528 It's this combination of SNMPv3 plus accompanying models that actually
529 provides a working SNMP system.
530 However, the only models in common use are the "User-based Security
531 Model" (RFC 3414) and the "View-based Access Control Model" (RFC 3415).
532 So "SNMPv3" is frequently used to mean the combination of the basic
533 SNMPv3 framework with these two particular models.
534 This is also sometimes described as "SNMPv3/USM".
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000535
536
Dave Shield4746cba2004-04-14 09:28:21 +0000537 So in brief:
538 - SNMPv2c updated the protocol operations
539 but left the administrative framework unchanged.
540 - SNMPv3 updated the administrative framework
541 but left the protocol operations unchanged.
Wes Hardaker468df0b1998-05-14 15:21:55 +0000542
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000543
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000544
Wes Hardakerb922f281997-10-20 18:45:58 +0000545Which versions of SNMP are supported in this package?
546----------------------------------------------------
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000547
Dave Shield009ee122009-05-27 15:26:02 +0000548 This package currently supports the original SNMPv1 (RFC 1157),
549 Community-based SNMPv2 (RFCs 1901-1908), and SNMPv3 (RFCs 3411-3418).
Wes Hardakerb922f281997-10-20 18:45:58 +0000550 The agent will respond to requests using any of these protocols,
551 and all the tools take a command-line option to determine which
552 version to use.
553
Dave Shieldceab78b1999-08-09 08:02:15 +0000554 Support for SNMPv2 classic (a.k.a. "SNMPv2 historic" - RFCs 1441-1452)
Dave Shield5da154e2002-03-12 16:35:01 +0000555 was dropped with the 4.0 release of the UCD-snmp package.
Wes Hardaker468df0b1998-05-14 15:21:55 +0000556
Wes Hardaker82ad1f91997-02-04 08:35:02 +0000557
Wes Hardaker34ac96d1997-01-29 11:11:04 +0000558
Dave Shield634ffdc2002-03-28 23:23:25 +0000559Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)?
560------------------------------------------------------------
561
562 Yes.
563
Dave Shieldab90a5e2006-11-24 11:21:53 +0000564 The syntax used to specify a MIB file (better referred
565 to as SMIv1 or SMIv2) is purely concerned with how to define
566 the characteristics of various management objects. This is
567 (almost) completely unrelated to the versions of the protocol
568 used to operate on these values. So it is quite reasonable to
569 use SNMPv1 requests on objects defined using SMIv2, or SNMPv2
570 (or SNMPv3) requests on objects defined using SMIv1.
Dave Shield634ffdc2002-03-28 23:23:25 +0000571
Dave Shieldab90a5e2006-11-24 11:21:53 +0000572 The one exception is objects of syntax Counter64, which are
573 only accessible using SNMPv2 or higher. SNMPv1 requests will
574 either treat such objects as an error, or skip them completely.
Dave Shield634ffdc2002-03-28 23:23:25 +0000575
Dave Shield009ee122009-05-27 15:26:02 +0000576 Note that SMIv1 is effectively obsolete, and all new MIBs
577 should be written using SMIv2.
578
Dave Shield634ffdc2002-03-28 23:23:25 +0000579
580
Dave Shield5b58b2f2009-07-21 09:15:07 +0000581How can I monitor my system with SNMP?
582-------------------------------------
583
584 There are two main methods of using SNMP for monitoring. One is to regularly
585 query the SNMP agent for information of interest, graphing these values and/or
586 saving them for later analysis. That's not really the focus of the Net-SNMP
587 project - our tools are more low-level, single-shot commands. For this sort
588 of high-level management, you're really looking at a management console
589 application (such as Nagios or OpenNMS), or a data logging application
590 (such as RRDtool, or one of its front-ends - MRTG, Cacti, etc).
591
592 The other approach is to configure the SNMP agent to monitor the relevant
593 information itself, and issue an alert when the values pass suitable limits.
594 See the section ACTIVE MONITORING in the snmpd.conf(5) man page for details.
595
596 Note that this entry makes no reference as to _what_ you should monitor, or
597 what values might be significant. That's because it is impossible to provide
598 a universal answer to these questions. The information to monitor, and the
599 normal operating values will ultimately depend on your local environment.
600 SNMP is simply a tool to _help_ you manage your systems - it isn't a magic
601 panacea - you still have to think for yourself!
602
603
604
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000605Where can I find more information about network management?
606----------------------------------------------------------
Wes Hardaker3e1ced61997-02-10 08:22:03 +0000607
Wes Hardakerb922f281997-10-20 18:45:58 +0000608 There are a number of sites with network management information on
Dave Shield13c14522006-12-29 17:25:33 +0000609 the World Wide Web. Some of the most useful are
Wes Hardaker3e1ced61997-02-10 08:22:03 +0000610
Dave Shieldab90a5e2006-11-24 11:21:53 +0000611 http://www.simpleweb.org/
Dave Shield5da154e2002-03-12 16:35:01 +0000612 http://www.snmplink.org/
Dave Shieldb9dfd6d2004-02-26 14:32:39 +0000613 http://www.mibdepot.com/
Wes Hardaker3e1ced61997-02-10 08:22:03 +0000614
Dave Shield009ee122009-05-27 15:26:02 +0000615 The SNMP Usenet newsgroup is now mostly defunct, but although the
616 FAQ hasn't been updated for a while, it still contains a large
617 amount of useful information relating to SNMP, including books,
618 software, other sites, how to get an enterprise number, etc, etc.
Wes Hardakerb922f281997-10-20 18:45:58 +0000619 This is available from
Wes Hardaker3e1ced61997-02-10 08:22:03 +0000620
621 ftp://rtfm.mit.edu/pub/usenet/comp.protocols.snmp/
622
Dave Shield5da154e2002-03-12 16:35:01 +0000623 or via any of the Web sites above.
624
Wes Hardaker3e1ced61997-02-10 08:22:03 +0000625
626
Dave Shield5b58b2f2009-07-21 09:15:07 +0000627What ports does SNMP use?
628------------------------
629
630 There are three main network ports (and one named socket), which are
631 typically used by SNMP. These are:
632
633 - UDP port 161 - SNMP requests (GET* and SET)
634 - UDP port 162 - SNMP notifications (Traps/Informs)
635 - TCP port 705 - AgentX
636 - /var/agentx/master - AgentX
637
638 However, these are simply the default "well-known" ports for these purposes,
639 and it is perfectly possible to accept requests on other ports.
640
641
642
Dave Shield90059672004-07-16 16:08:50 +0000643Is Net-SNMP thread safe?
Wes Hardaker51d88c72000-11-30 18:31:56 +0000644-----------------------
Dave Shieldceab78b1999-08-09 08:02:15 +0000645
Dave Shield009ee122009-05-27 15:26:02 +0000646 Strictly speaking, no. However, it is possible to use the library within
647 a multi-threaded management application. This is covered in detail in
648 the file README.thread (shipped with the standard distribution), but can
649 be summarised as follows:
Dave Shieldceab78b1999-08-09 08:02:15 +0000650
651 - Call 'snmp_sess_init()' prior to activating any threads.
652 This reads in and parses MIB information (which isn't thread-safe)
653 as well as preparing a session structure for subsequent use.
654
655 - Open an SNMP session using 'snmp_sess_open()' which returns an
656 opaque session handle, which is essentially independent of any
657 other sessions (regardless of thread).
658
659 - Resource locking is not handled within the library, and is the
660 responsibility of the main application.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000661
Dave Shield009ee122009-05-27 15:26:02 +0000662 The Net-SNMP agent has not been designed for multi-threaded use. It
663 should be safe to use the agent library to embed a subagent within a
664 threaded application as long as *all* SNMP-related activity (including
Dave Shield90059672004-07-16 16:08:50 +0000665 generating traps, and parsing MIBs) is handled within a single thread.
Wes Hardaker51d88c72000-11-30 18:31:56 +0000666
Dave Shield009ee122009-05-27 15:26:02 +0000667 The command-line tools shipped as part of the Net-SNMP distribution
668 are simple single-threaded applications, and are not designed for
669 multi-threaded use. Adapting these to a threaded model is left as
670 an exercise for the student.
671 The same holds true for the notification receiver (snmptrapd).
672
Wes Hardaker37527b22004-12-22 18:37:49 +0000673 Unfortunately, the SNMPv3 support was added about the same time as
674 the thread support and since they occurred in parallel the SNMPv3
675 support was never checked for multi-threading correctness. It is
676 most likely that it is not thread-safe at this time.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000677
678
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000679APPLICATIONS
680============
681
682How do I add a MIB?
683------------------
684
685 This is actually two separate questions, depending on whether you
686 are referring to the tools, or the agent (or both).
687 See the next question or the next section respectively.
688
689
690
691How do I add a MIB to the tools?
692-------------------------------
693
Dave Shieldab90a5e2006-11-24 11:21:53 +0000694 Adding a MIB to the client-side tools has two main effects:
695
696 - it allows you to refer to MIB objects by name
697 (rather than having to use the numeric OIDs)
698 - it allows the results to be displayed in a more immediately
699 meaningful fashion. Not just giving the object names, but
700 also showing named enumeration values, and interpreting table
701 indexes properly (particularly for string and OID index values).
702
Dave Shieldab90a5e2006-11-24 11:21:53 +0000703 There are two steps required to add a new MIB file to the tools.
Dave Shield009ee122009-05-27 15:26:02 +0000704 Firstly, copy the MIB file into the appropriate location:
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000705
Wes Hardaker51d88c72000-11-30 18:31:56 +0000706 cp MY-MIB.txt /usr/local/share/snmp/mibs
Dave Shieldab90a5e2006-11-24 11:21:53 +0000707 (which makes it available to everyone on the system)
Dave Shield49ac3782009-05-28 10:41:30 +0000708 or
Wes Hardaker74c2e712000-12-01 22:36:54 +0000709 mkdir $HOME/.snmp
710 mkdir $HOME/.snmp/mibs
711 cp MY-MIB.txt $HOME/.snmp/mibs
Dave Shieldab90a5e2006-11-24 11:21:53 +0000712 (which makes it available to you only)
Wes Hardaker74c2e712000-12-01 22:36:54 +0000713
Dave Shieldab90a5e2006-11-24 11:21:53 +0000714 Note that the location of the shared MIB directory may be different
Dave Shield49ac3782009-05-28 10:41:30 +0000715 from that given here - see the FAQ entry "Where should I put my MIB
716 files?" for more information.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000717
718
719 Secondly, tell the tools to load this MIB:
Wes Hardaker74c2e712000-12-01 22:36:54 +0000720
Dave Shield49ac3782009-05-28 10:41:30 +0000721 snmpwalk -m +MY-MIB .....
722 (load it for this command only)
723 or
Wes Hardaker51d88c72000-11-30 18:31:56 +0000724 export MIBS=+MY-MIB
Dave Shieldab90a5e2006-11-24 11:21:53 +0000725 (load it for this session only)
Dave Shield49ac3782009-05-28 10:41:30 +0000726 or
Wes Hardaker74c2e712000-12-01 22:36:54 +0000727 echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf
Dave Shieldab90a5e2006-11-24 11:21:53 +0000728 (load it every time)
729
Dave Shield49ac3782009-05-28 10:41:30 +0000730 Note that the value for this variable is the name of the MIB
Dave Shieldab90a5e2006-11-24 11:21:53 +0000731 module, *not* the name of the MIB file. These are typically the
732 same (apart from the .txt suffix), but if in doubt, check the contents
733 of the file. The value to use is the token immediately before the
734 word DEFINITIONS at the start of the file.
735
Dave Shield49ac3782009-05-28 10:41:30 +0000736 Or use the special value "all" to have the tools load all available
737 MIBs (which may slow them down, particularly if you have a large
738 number of MIB files.
Wes Hardaker74c2e712000-12-01 22:36:54 +0000739
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000740 Note that you need *both* steps.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000741
742
Dave Shield49ac3782009-05-28 10:41:30 +0000743 Adding a MIB in this way does *not* mean that the agent will
744 automatically return values from this MIB. The agent needs to be
745 explicitly extended to support the new MIB objects, which typically
746 involves writing new code.
747 See the AGENT section for details.
748
749 Most of the tools (apart from 'snmptable') will work quite happily
750 without any MIB files at all - although the results won't be displayed
751 in quite the same way. Similarly, the agent doesn't need MIB files
752 either (other than to handle MIB object names in the configuration file).
753
754
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000755
Dave Shield5da154e2002-03-12 16:35:01 +0000756Why can't I see anything from the agent?
757---------------------------------------
758
Dave Shield49ac3782009-05-28 10:41:30 +0000759 Fundamentally, there are two basic reasons why a request may go
760 unanswered. Either the management application does not like the
761 request (so never sends it), or the agent does not like the request
762 (so never responds). The simplest way to distinguish between the
763 two is to run the command with the command-line option '-d'.
Dave Shield5da154e2002-03-12 16:35:01 +0000764
Dave Shieldab90a5e2006-11-24 11:21:53 +0000765 If this doesn't display a hex dump of the raw outgoing packet, then
766 it's the client side which is dropping the request. Hopefully you
Dave Shield49ac3782009-05-28 10:41:30 +0000767 should also see an error message, to help identify what's wrong.
Dave Shield5da154e2002-03-12 16:35:01 +0000768
Dave Shieldab90a5e2006-11-24 11:21:53 +0000769 If this displays one or more outgoing dumps (but nothing coming back),
770 then the request is failing at the agent end. See the next entry for
771 more details.
772
Dave Shield49ac3782009-05-28 10:41:30 +0000773
774 There are three further possibilities to consider:
775
776 One is that the agent may return a response to the original query,
777 but the management application may not like this response, and refuse
778 to display it. This is relatively unusual, and typically indicates
779 a flaw with the remote agent. (I hope you're not contemplating the
780 suggestion that the Net-SNMP command-line tools might contain bugs!)
781
782 The typical symptoms of this would be that the '-d' option would
783 display a sequence of sending and received packet dumps, with the
784 same contents each time. Ask on the mailing list for advice.
785
786
787 Alternatively, the agent may simply not support the MIB objects being
788 requested. This is most commonly seen when using the "snmpwalk" tool
789 (particularly with SNMPv1).
790
791 The symptoms here would be that '-d' would show two pairs of raw
792 packet dumps - one a GETNEXT request (A1 in the sending packet),
793 followed by a GET request (A0). Repeating the same request with the
794 "snmpgetnext" command-line tool should show the information (if any)
795 that the agent returned, which was then discarded by snmpwalk as
796 irrelevant.
797
798 Note that this is how snmpwalk was designed to work. It is not an error.
799
800
801 Finally, it may be that the agent is simply taking too long to respond.
802 The easiest way to test for this is to add the command-line options
803 "-t 60 -r 0", which will send a single request (with no repetitions)
804 and wait for a minute before giving up. This ought to be long enough
805 for all but the most-overloaded agent, or inefficient MIB module!
806
807 If this turns out to be the cause, then ask on the mailing list for
808 advice on options for improving the performance.
Dave Shield90059672004-07-16 16:08:50 +0000809
Dave Shield5da154e2002-03-12 16:35:01 +0000810
811
Dave Shieldab90a5e2006-11-24 11:21:53 +0000812Why doesn't the agent respond?
813-----------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000814
Dave Shield49ac3782009-05-28 10:41:30 +0000815 Assuming that the tests outlined in the previous entry indicate that
816 the problem lies with the agent not responding, the obvious question
817 is "why not".
Dave Shield5da154e2002-03-12 16:35:01 +0000818
Dave Shield49ac3782009-05-28 10:41:30 +0000819 Again, there are two basic possibilities - either the agent never
820 sees the request, or it receives it but is unwilling (or unable) to
821 process it. If the remote system is running the Net-SNMP agent,
822 then the easiest way to distinguish between these two cases is to
823 shut down the agent, and re-start it manually using the options
Dave Shieldab90a5e2006-11-24 11:21:53 +0000824 -f -Le -d
Dave Shield49ac3782009-05-28 10:41:30 +0000825 Then send the same query as before. This should display raw dumps of
826 packets seen (or sent) by the agent, just as with the client side in
827 the previous entry.
Dave Shield5da154e2002-03-12 16:35:01 +0000828
Dave Shield49ac3782009-05-28 10:41:30 +0000829
830 If the agent does not display anything, then it is simply not receiving
831 the requests. This may be because they are being blocked by network
832 or local firewall settings ('iptables -L'), or the agent may not be
833 listening on the expected interfaces ('netstat -a').
834
835 This is most commonly encountered when running queries from a remote
836 host, particularly if the same request succeeds when run on the same
837 system as the agent itself.
838
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000839
Dave Shieldab90a5e2006-11-24 11:21:53 +0000840 If the agent displays a dump of the incoming request, but nothing going
841 out, then the most likely cause is access control settings. See the
Dave Shield49ac3782009-05-28 10:41:30 +0000842 relevant entries in the AGENT section for details. Note that if the agent
843 receives an SNMPv1 or SNMPv2c request with a unknown community string,
844 then it will not return an error response - the request is simply discarded.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000845
Dave Shield49ac3782009-05-28 10:41:30 +0000846 Another possibility is that the request may be rejected by settings in
847 /etc/hosts.{allow,deny}. Again, '-d' will display an incoming packet
848 dump but no corresponding outgoing response. However in this situation,
849 the agent should also log a message that the request is being refused.
850
851
852 Running the agent with '-d' can also help identify situations where the
853 agent *is* responding to the request, but only after a long delay. This
854 would be indicated by a series of incoming packet dumps (showing various
855 retries from the client side), followed by several outgoing dumps - possibly
856 long after the client tool has given up in disgust.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000857 See the entry
858 The agent worked for a while, then stopped responding. Why?
859 later in this section.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000860
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000861
862
Wes Hardaker51d88c72000-11-30 18:31:56 +0000863I can see the system group, but nothing else. Why?
864--------------------------------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000865
Dave Shield90059672004-07-16 16:08:50 +0000866 This is almost definitely due to the access configuration of the agent.
867 Many pre-configured systems (such as most Linux distributions) will only
868 allow access to the system group by default, and need to be configured
869 to enable more general access.
Dave Shield5da154e2002-03-12 16:35:01 +0000870
Dave Shield49ac3782009-05-28 10:41:30 +0000871 The easiest way to test this is to try a GETNEXT request on one of
872 the other standard groups
Wes Hardaker51d88c72000-11-30 18:31:56 +0000873 e.g.
Dave Shield49ac3782009-05-28 10:41:30 +0000874 snmpgetnext ..... interfaces
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000875
Dave Shield49ac3782009-05-28 10:41:30 +0000876 If the agent responds with "hrSystemUptime.0" or "end of MIB", then it
877 is clearly configured in this way. See the entries on access control
878 in the AGENT section for more information.
Wes Hardaker51d88c72000-11-30 18:31:56 +0000879
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000880
Dave Shield5da154e2002-03-12 16:35:01 +0000881
Dave Shield13c14522006-12-29 17:25:33 +0000882Why can't I see values in the <ENTERPRISE> tree?
Dave Shield24569f72009-05-28 11:31:51 +0000883-----------------------------------------------
Dave Shieldab90a5e2006-11-24 11:21:53 +0000884
Dave Shield49ac3782009-05-28 10:41:30 +0000885 If you can see most of the standard information (not just the system and
886 hrSystem groups), but not in the vendor-specific 'enterprises' tree, then
887 once again there are several possible causes.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000888
Dave Shield49ac3782009-05-28 10:41:30 +0000889 Firstly, it's possible that the agent does not implement this particular
890 enterprise tree. Remember that adding a MIB to the client tools does
891 *not* automatically add support for these object to the agent. See the
892 AGENT section for more information.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000893
Dave Shield49ac3782009-05-28 10:41:30 +0000894
895 Alternatively, it may be that the agent does implement some or all of this
896 enterprise tree, but the access control settings are configured to block
897 access to it.
898
899 The simplest way to checks whether the agent implements a given portion
900 of the OID tree is to run
901
902 snmpwalk .... nsModuleName
903
904 and look for index values that fall in the area of interest.
905 (Always assuming that you have access to this particular section
906 of the Net-SNMP enterprise tree, of course!)
907
908 Checking the access control settings can be done by examining the tables
909 vacmAccessTable and vacmViewTreeFamilyTable. Note that these are used
910 to configure access control for *all* versions of SNMP - not just SNMPv3.
911
912
913 The third possibility is that simply isn't any information in the specified
914 tree. For example, several of the tables in the UCDavis enterprise tree
915 (such as prTable, extTable, dskTable and fileTable) require explicit
916 configuration in the snmpd.conf file. If you query this particular tables
917 without the necessary configuration entries, then they will be empty.
918
919
920 Finally, if you can't see anything from *any* enterprise-specific tree,
921 then this may be down to how you are asking for the information. By
922 default, if "snmpwalk" is run without an explicitly starting OID, then
923 it will display the contents of the 'mib-2' tree, containing most of the
924 IETF-standard management information supported by the agent.
925
Dave Shieldab90a5e2006-11-24 11:21:53 +0000926 When the agent reaches the end of this tree, it will return the first
Dave Shield49ac3782009-05-28 10:41:30 +0000927 enterprise-specific value, 'snmpwalk' will recognise that this marks the
928 end of the (implicit) requested tree, and stop. No enterprise-specific
929 information will be displayed.
Dave Shieldab90a5e2006-11-24 11:21:53 +0000930
931 To walk the whole tree, and see *all* the information that the
932 agent supports, specify a starting point of '.iso' or '.1'.
933 To walk a specific enterprise subtree, specify the root of this tree
934 as the starting point - e.g:
935
936 snmpwalk -v1 -c public localhost UCD-SNMP-MIB::ucdavis
937
938 There is more information about particular UCD-specific subtrees in
939 the AGENT section.
940
941
942
Dave Shield5da154e2002-03-12 16:35:01 +0000943The agent worked for a while, then stopped responding. Why?
944-----------------------------------------------------------
945
Dave Shieldab90a5e2006-11-24 11:21:53 +0000946 There are three basic possibilities:
947 - the agent has crashed
948 - it is hanging
949 - it is temporarily overloaded
Dave Shield5da154e2002-03-12 16:35:01 +0000950
Dave Shieldab90a5e2006-11-24 11:21:53 +0000951 Detecting whether the agent has crashed should be fairly straighforward.
952 If you can reliably reproduce this crash (e.g. by sending a particular
953 SNMP request), then contact the coders list for advice.
954 It's the other two cases that are probably more significant.
955
956 To tell the difference between these two, try leaving the agent
Dave Shield90059672004-07-16 16:08:50 +0000957 undisturbed for a while, and then probe it using a single 'snmpget'
Dave Shieldab90a5e2006-11-24 11:21:53 +0000958 request, specifying a longer timeout (e.g. '-t 120'). If it now
959 responds, then something was probably sending requests (including
960 duplicate retries) faster than the agent could process them, and it
961 was building up a backlog. Try adjusting the timeout period and retry
962 frequency of these client requests, or look at improving the efficiency
963 of the implementation of the relevant MIB objects.
Dave Shield5da154e2002-03-12 16:35:01 +0000964
Dave Shieldab90a5e2006-11-24 11:21:53 +0000965 If the agent remains unresponsive (particularly if the load on the
966 system is steadily climbing), then it's probably hanging, and all
967 you can really do is restart the agent. If you can identify what
968 causes this to happen, then contact the coders list for advice.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000969
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000970
971
972Requesting an object fails with "Unknown Object Identifier" Why?
973----------------------------------------------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000974
Dave Shieldab90a5e2006-11-24 11:21:53 +0000975 If a general snmpwalk shows a particular entry, but asking for it more
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000976 specifically gives a "sub-identifier not found:" or "Unknown Object
Dave Shield5da154e2002-03-12 16:35:01 +0000977 Identifier" error, then that's a problem with the tool, rather than
978 the agent.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000979
Dave Shieldab90a5e2006-11-24 11:21:53 +0000980 Firstly, make sure that you're asking for the object by the right name.
Wes Hardaker51d88c72000-11-30 18:31:56 +0000981 Object descriptors are case-sensitive, so asking for 'sysuptime' will
982 not be recognised, but 'sysUpTime' will.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000983
Dave Shieldab90a5e2006-11-24 11:21:53 +0000984 Alternatively, the object may be defined in a MIB that hasn't been
985 loaded. Try loading in all the MIB files:
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000986
John Naylond9f152d2002-08-19 14:46:02 +0000987 snmpget -m ALL -v1 -c public localhost sysUpTime.0
Wes Hardaker51d88c72000-11-30 18:31:56 +0000988
Dave Shieldab90a5e2006-11-24 11:21:53 +0000989 or specify the name of the appropriate MIB explicitly:
Wes Hardaker51d88c72000-11-30 18:31:56 +0000990
Dave Shieldab90a5e2006-11-24 11:21:53 +0000991 snmpget -v1 -c public myhost SNMPv2-MIB::sysUpTime.0
Wes Hardakerf13d1ce1999-03-05 18:21:25 +0000992
Dave Shieldab90a5e2006-11-24 11:21:53 +0000993 Note that this uses the name of the *module*, not the name of the file.
Dave Shield49ac3782009-05-28 10:41:30 +0000994 However, if 'snmpwalk' displays the object by name, this is unlikely to
995 be the cause, and you should look closely at the exact object name you
996 are using. In particular, see the next entry.
Wes Hardaker6241ebf2001-04-06 19:12:28 +0000997
998
999
1000Why do I get "noSuchName" when asking for "sysUpTime" (or similar)?
1001------------------------------------------------------------------
1002
Dave Shield49ac3782009-05-28 10:41:30 +00001003 Assuming that you do have access to this object, the most likely cause
1004 is forgetting the instance subidentifier.
Dave Shieldab90a5e2006-11-24 11:21:53 +00001005
Dave Shield49ac3782009-05-28 10:41:30 +00001006 If you try walking the 'system' group (or any other part of the MIB tree),
1007 you should notice that all of the results have a number after the object
1008 name. This is the "instance subidentifier" of that particular MIB instance.
Dave Shieldab90a5e2006-11-24 11:21:53 +00001009
Dave Shield49ac3782009-05-28 10:41:30 +00001010 For values in tables (such as the sysORTable), this acts as an index into
1011 the table - a very familiar concept. But *all* SNMP values will display an
1012 instance number, whether or not they are part of a table. For non-table
Dave Shieldab90a5e2006-11-24 11:21:53 +00001013 objects ("scalars"), this instance subidentifier will always be '0',
1014 and it *must* be included when making a GET request.
1015
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001016 Compare the following:
1017
John Naylond9f152d2002-08-19 14:46:02 +00001018 $ snmpget -v1 -c public localhost sysUpTime
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001019 Error in packet
1020 Reason: (noSuchName) There is no such variable name in this MIB.
1021 This name doesn't exist: system.sysUpTime
Dave Shield49ac3782009-05-28 10:41:30 +00001022
John Naylond9f152d2002-08-19 14:46:02 +00001023 $ snmpget -v1 -c public localhost sysUpTime.0
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001024 system.sysUpTime.0 = Timeticks: (69189271) 8 days, 0:11:32.71
1025
1026 This is a little less obscure when using SNMPv2c or v3 requests:
1027
John Naylond9f152d2002-08-19 14:46:02 +00001028 $ snmpget -v 2c -c public localhost sysUpTime
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001029 system.sysUpTime = No Such Instance currently exists
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001030
1031
1032
1033Why do I sometimes get "End of MIB" when walking a tree, and sometimes not?
1034--------------------------------------------------------------------------
1035
Wes Hardaker51d88c72000-11-30 18:31:56 +00001036 This depends on which MIB modules are supported by the agent you are
Dave Shieldab90a5e2006-11-24 11:21:53 +00001037 querying and exactly what you're asking for.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001038
Dave Shieldab90a5e2006-11-24 11:21:53 +00001039 Note that a tree is walked by repeatedly asking for "the next entry" until
Dave Shield5da154e2002-03-12 16:35:01 +00001040 all the values under that tree have been retrieved. However, the agent has
John Naylond9f152d2002-08-19 14:46:02 +00001041 no idea that this is what's happening - all it sees is a request for "the
1042 next entry after X".
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001043
Wes Hardaker51d88c72000-11-30 18:31:56 +00001044 If the object X happens to be the last entry in a sub-tree, the agent will
1045 provide the next object supported (as requested) even though this will be
1046 in a different subtree. It's up to the querying tool to recognise that
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001047 this last result lies outside the area of interest, and simply discard it.
1048
Dave Shield5da154e2002-03-12 16:35:01 +00001049 If the object X happens to be the last entry supported by the agent, it
John Naylond9f152d2002-08-19 14:46:02 +00001050 doesn't have another object to provide, so returns an "end of MIB"
Dave Shieldbae701f2003-10-29 10:59:23 +00001051 indication. The Net-SNMP tools report this with the message above.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001052
1053 But in either case, the actual information provided will be the same.
1054
1055
1056
Dave Shieldab90a5e2006-11-24 11:21:53 +00001057How do I use SNMPv3?
1058-------------------
1059
Dave Shield49ac3782009-05-28 10:41:30 +00001060 The simplest form of SNMPv3 request is unauthenticated and unencrypted
1061 (noAuthNoPriv). It simply requires a user name, and would look something
1062 like:
Dave Shieldab90a5e2006-11-24 11:21:53 +00001063
Dave Shield52ae0172007-01-29 11:12:29 +00001064 snmpget -v 3 -l noAuthNoPriv -u dave localhost sysUpTime.0
Dave Shieldab90a5e2006-11-24 11:21:53 +00001065
Dave Shield49ac3782009-05-28 10:41:30 +00001066 However this approach foregoes the security protection which is the
1067 main advantage of using SNMPv3 (and the agent must also be explicitly
1068 configured to allow unauthenticated requests from that user).
1069
1070 The most common form of SNMPv3 request is authenticated but not encrypted
1071 (authNoPriv). This specifies the pass phrase to authenticate with:
Dave Shieldab90a5e2006-11-24 11:21:53 +00001072
1073 snmpget -v 3 -l authNoPriv -u dave -A "Open the Door"
1074 localhost sysUpTime.0
1075
Dave Shield49ac3782009-05-28 10:41:30 +00001076 A fully secure (i.e. encrypted) request (authPriv) would also specify
1077 the privacy pass phrase:
Dave Shieldab90a5e2006-11-24 11:21:53 +00001078
1079 snmpget -v 3 -l authPriv -u dave -A "Open the Door"
1080 -X "Bet you can't see me" localhost sysUpTime.0
1081
1082 In practise, most of these would probably be set via configuration
1083 directives in a personal $HOME/.snmp/snmp.conf file (note, *not* the
Dave Shield49ac3782009-05-28 10:41:30 +00001084 agent's snmpd.conf file).
1085 The equivalent settings for the third example would be:
Dave Shieldab90a5e2006-11-24 11:21:53 +00001086
1087 defSecurityName dave
1088 defSecurityLevel authPriv
1089 defAuthPassphrase "Open the Door"
1090 defPrivPassphrase "Bet you can't see me"
1091
1092 If the AuthPassphrase and the PrivPassphrase are the same, then you
1093 can use the single setting
1094 defPassphrase "Open the Door and see me"
1095 instead.
1096
1097 See the AGENT section for how to configure the agent for SNMPv3 access.
1098
1099
1100
Dave Shield13c14522006-12-29 17:25:33 +00001101Why can't I set any variables in the MIB?
1102----------------------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001103
1104 There are three possible reasons for this:
1105
Dave Shieldab90a5e2006-11-24 11:21:53 +00001106 Many MIB objects are defined as "read-only" and inherently cannot be
Dave Shield49ac3782009-05-28 10:41:30 +00001107 changed via SET requests. Attempts to do so will typically be rejected
Dave Shieldab90a5e2006-11-24 11:21:53 +00001108 by the 'snmpset' command without ever being sent to the agent.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001109
Dave Shieldab90a5e2006-11-24 11:21:53 +00001110 Of those objects that can in principle be changed, the agent may not
1111 include the code necessary to support SET requests. (GET and GETNEXT
1112 are much easier to handle - particularly for objects relating to the
1113 internals of the underlying operating system).
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001114
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001115 Even if SET support has been implemented, the agent may not be configured
1116 to allow write access to this object.
1117
Wes Hardaker51d88c72000-11-30 18:31:56 +00001118 Ready-installed distributions (such as those shipped with Linux) tend
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001119 to be configured with read-only access to part of the mib tree (typically
1120 just the system group) and no write access at all.
1121
1122 To change this, you will need to set up the agent's access control
1123 configuration. See the AGENT section for more details.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001124
1125 Note that neither the community string "public" nor "private" can be
Dave Shield43dcec82002-03-11 15:42:08 +00001126 used to set variables in a typical default configuration.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001127
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001128
1129
1130Variables seem to disappear when I try to set them. Why?
1131--------------------------------------------------------
1132
1133 This is actually the same as the previous question - it just isn't
Wes Hardaker51d88c72000-11-30 18:31:56 +00001134 particularly obvious, particularly when using SNMPv1. A typical
1135 example of this effect would be
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001136
Dave Shield49ac3782009-05-28 10:41:30 +00001137 $ snmpget -v1 -c public localhost sysLocation.0
1138 sysLocation.0 = somewhere nearby
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001139
Dave Shield49ac3782009-05-28 10:41:30 +00001140 $ snmpset -v1 -c public localhost sysLocation.0 s "right here"
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001141 Error in packet.
1142 Reason: (noSuchName) There is no such variable name in this MIB.
Dave Shield49ac3782009-05-28 10:41:30 +00001143 This name doesn't exist: sysLocation.0
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001144
Wes Hardaker51d88c72000-11-30 18:31:56 +00001145 Trying the same request using SNMPv2 or above is somewhat more informative:
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001146
Dave Shield49ac3782009-05-28 10:41:30 +00001147 $ snmpset -v 2c -c public localhost sysLocation.0 s "right here"
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001148 Error in packet.
1149 Reason: notWritable
1150
Wes Hardaker51d88c72000-11-30 18:31:56 +00001151 The SNMPv1 error 'noSuchName' actually means:
1152
1153 "You can't do that to this variable"
1154
Dave Shield49ac3782009-05-28 10:41:30 +00001155 rather than "this variable doesn't exist".
1156 It may be the case that it doesn't exist at all. It may exist but you
1157 don't have access to it (although different administrative credentials
1158 might be accepted). Or it may exist, but you simply can't perform that
1159 particular operation (e.g. changing it).
1160 Similarly, the SNMPv2 error 'notWritable' means "not writable in this
1161 particular case" rather than "not writable under any circumstances".
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001162
Dave Shield49ac3782009-05-28 10:41:30 +00001163 If you are sure that the object is both defined as writable, and has been
1164 implemented as such, then you probably need to look at the agent access
1165 control. See the AGENT section for more details.
1166 But see the next entry first.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00001167
1168
Wes Hardaker34ac96d1997-01-29 11:11:04 +00001169
Dave Shieldab90a5e2006-11-24 11:21:53 +00001170Why can't I change sysLocation (or sysContact)?
1171----------------------------------------------
Dave Shield4912e8d2002-07-26 14:24:26 +00001172
Dave Shield49ac3782009-05-28 10:41:30 +00001173 There is one final possibility to consider for why a SET request might
1174 be rejected.
Dave Shield4912e8d2002-07-26 14:24:26 +00001175
Dave Shield49ac3782009-05-28 10:41:30 +00001176 The values for certain MIB objects (including 'sysLocation' and 'sysContact')
1177 can be configured via the snmpd.conf file. If this is done, then these
1178 particular objects become read-only, and cannot be updated via SET commands,
1179 even if the access control settings would otherwise allow it.
1180
1181 This may seem perverse, but there is good reason for it. If there is a
1182 configuration setting for one of these objects, then that value will be
1183 used whenever the agent re-starts. If the object was allowed to be updated
1184 using SET, this new value would be forgotten the next time the agent was
1185 re-started.
1186
1187 Hence the Net-SNMP agent rejects such requests if there's a value configured
1188 via the 'snmpd.conf' file. If there isn't such a config setting, then the
1189 write request will succeed (assuming suitable access control settings), and
1190 the new value will be retained the next time the agent restarts.
Dave Shield4912e8d2002-07-26 14:24:26 +00001191
1192
1193
Wes Hardaker51d88c72000-11-30 18:31:56 +00001194I get an error when trying to set a negative value - why?
1195--------------------------------------------------------
1196
1197 This is a different problem. What's happening here is that the
1198 routine that parses the arguments to the 'snmpset' command is seeing
1199 the '-' of the new value, and treating it as a command-line option.
Dave Shieldab90a5e2006-11-24 11:21:53 +00001200 This normally generates an error (since digits typically aren't valid
1201 command line options).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001202
1203 The easiest way to solve this is include the "end-of-option"
1204 indicator '--' in the command line, somewhere before the new value
1205 (but after all of the options, obviously). For example:
1206
John Naylond9f152d2002-08-19 14:46:02 +00001207 snmpset -v 2c -c public localhost -- versionRestartAgent.0 i -1
Wes Hardaker51d88c72000-11-30 18:31:56 +00001208
Dave Shield49ac3782009-05-28 10:41:30 +00001209 (This command will still fail, since -1 isn't an acceptable value for
1210 this particular object, but that's not the point here!)
Wes Hardaker51d88c72000-11-30 18:31:56 +00001211
1212
1213
Dave Shield49ac3782009-05-28 10:41:30 +00001214I get an error when trying to query a string-indexed table value - why?
1215----------------------------------------------------------------------
Dave Shielda25a9a72002-07-30 08:39:05 +00001216
Dave Shield49ac3782009-05-28 10:41:30 +00001217 The Net-SNMP library will normally try to interpret string-based
1218 index values, and display them in a meaningful manner:
Dave Shielda25a9a72002-07-30 08:39:05 +00001219
Dave Shield49ac3782009-05-28 10:41:30 +00001220 $ snmpgetnext .... vacmGroupName
1221 vacmGroupName.3."dave" = theWorkers
1222
1223 The command-line tools will also accept string-valued indexes within
1224 an OID, and convert them into the appropriate numeric form before
1225 sending an SNMP request. However the Unix shell will typically
1226 swallow the quotes around the string index value, before the SNMP
1227 tools can get a chance to interpret them.
1228
1229 The answer is to escape the quotes, to protect them from the shell,
1230 and allow them to be passed through to the OID parser:
1231
1232 snmpget .... vacmGroupName.3.\"dave\"
1233 or
1234 snmpget .... 'vacmGroupName.3."dave"'
Dave Shielda25a9a72002-07-30 08:39:05 +00001235
1236
Dave Shield49ac3782009-05-28 10:41:30 +00001237 Another alternative is to avoid trying to specify the index value as
1238 a string, and provide the numeric subidentifiers directly:
1239
1240 snmpget .... vacmGroupName.3.4.100.97.118.101
1241
1242 (where '3' indicates SNMPv3, '4' is the length of the string index,
1243 followed by the ASCII values of the individual characters).
1244
1245 The command-line option '-Ob' will display the results of querying
1246 a string-indexed table in this format:
1247
1248 $ snmpgetnext -Ob .... vacmGroupName
1249 vacmGroupName.3.4.100.97.118.101 = theWorkers
1250
1251
1252
1253How should I specify string-indexed table values?
1254------------------------------------------------
1255
1256 There's one other aspect of string-indexed tables that can cause
1257 problems - the difference between implicit- and explicit-length
1258 strings, and how to represent these when making an SNMP query.
1259
1260 The most common style of string index uses an explicit length,
1261 followed by the individual ASCII character values:
1262
1263 "dave" = 4.'d'.'a'.'v'.'e'
1264
1265 (as shown in the previous entry).
1266
1267 However if the string index is defined in the MIB file as IMPLIED
1268 (or if it has a fixed length, such as a physical ethernet address),
1269 then the length subidentifier is omitted, and the index simply
1270 consists of the character values:
1271
1272 "dave" = 'd'.'a'.'v'.'e'
1273
1274 Note that IMPLIED index objects can only appear as the *last* index
1275 for a table.
1276
1277 The Net-SNMP library uses double quotes (i.e. "dave) to indicate an
1278 explicit length string index value, and single quotes (i.e. 'dave')
1279 to indicate an implicit length one. If you use the wrong style of
1280 quotes, then the resulting OID will be incorrect, and you'll get
1281 confusing results to your query.
1282
1283
1284
Wes Hardaker51d88c72000-11-30 18:31:56 +00001285How do I send traps and notifications?
1286---------------------------------------
1287
1288 Traps and notifications can be sent using the command 'snmptrap'.
Dave Shield49ac3782009-05-28 10:41:30 +00001289 The following examples generate the generic trap 'warmStart(1)' and a
Wes Hardaker51d88c72000-11-30 18:31:56 +00001290 (dummy) enterprise specific trap '99' respectively:
1291
Dave Shield49ac3782009-05-28 10:41:30 +00001292 snmptrap -v 1 -c public localhost "" "" 1 0 ""
Wes Hardaker9743e9f2001-10-11 21:01:50 +00001293 snmptrap -v 1 -c public localhost "" "" 6 99 ""
Wes Hardaker51d88c72000-11-30 18:31:56 +00001294
1295 The empty parameters "" will use suitable defaults for the relevant
Dave Shieldab90a5e2006-11-24 11:21:53 +00001296 values (enterprise OID, address of sender and current sysUptime).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001297
1298 An SNMPv2 or SNMPv3 notification (either trap or inform) takes
1299 the OID of the trap to send:
1300
Wes Hardaker9743e9f2001-10-11 21:01:50 +00001301 snmptrap -v 2c -c public localhost "" UCD-SNMP-MIB::ucdStart
1302 snmptrap -v 2c -c public localhost "" .1.3.6.1.4.1.2021.251.1
Wes Hardaker51d88c72000-11-30 18:31:56 +00001303
Dave Shield49ac3782009-05-28 10:41:30 +00001304 (These two are equivalent ways of specifying the same trap). Again,
1305 the empty parameter "" will use a suitable default for the relevant
1306 value (sysUptime).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001307
1308 Any of these commands can be followed by one or more varbinds,
1309 using the same (OID/type/value) syntax as for 'snmpset':
1310
Wes Hardaker9743e9f2001-10-11 21:01:50 +00001311 snmptrap -v 2c -c public localhost "" ucdStart sysContact.0 s "Dave"
Wes Hardaker51d88c72000-11-30 18:31:56 +00001312
Dave Shield49ac3782009-05-28 10:41:30 +00001313 Generating traps from within the agent, or other applications, is
1314 covered in the AGENT and CODING sections.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001315
Wes Hardaker74c2e712000-12-01 22:36:54 +00001316 You should also read the snmptrap tutorial at
Wes Hardakerf5e9ead2011-02-22 23:55:43 +00001317 http://www.net-snmp.org/wiki/index.php/TUT:snmptrap
Wes Hardaker74c2e712000-12-01 22:36:54 +00001318 which will help you understand everything you need to know about traps.
1319
Wes Hardaker51d88c72000-11-30 18:31:56 +00001320
1321
Dave Shield49ac3782009-05-28 10:41:30 +00001322How do I receive traps and notifications?
1323----------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001324
Dave Shield49ac3782009-05-28 10:41:30 +00001325 Handling incoming traps is the job of a "notification receiver".
1326 The Net-SNMP suite include the tool 'snmptrapd' to act in this role.
1327 This can log traps to a file or via the syslog mechanism, forward them
1328 to another notification receiver and/or invoke a specified command
1329 whenever a particular notification is received.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001330
Dave Shield49ac3782009-05-28 10:41:30 +00001331 Logging notifications would be done by starting snmptrapd as:
1332 snmptrapd -Ls 7 (log to syslog using 'LOCAL7')
1333 or
1334 snmptrapd -f -Lo (log to standard output)
Wes Hardaker51d88c72000-11-30 18:31:56 +00001335
Dave Shield49ac3782009-05-28 10:41:30 +00001336 Invoking a command to process a received notification uses one or
1337 more 'traphandle' directives in the configuration file 'snmptrapd.conf'.
1338 A typical configuration might look something like:
Wes Hardaker51d88c72000-11-30 18:31:56 +00001339
Dave Shield49ac3782009-05-28 10:41:30 +00001340 traphandle .1.3.6.1.6.3.1.5.1 /path/to/page_me up
1341 traphandle .1.3.6.1.4.1.2021.251.1 /path/to/page_me up
1342 traphandle .1.3.6.1.4.1.2021.251.2 /path/to/page_me down
1343 traphandle default /path/to/log_it
Wes Hardaker51d88c72000-11-30 18:31:56 +00001344
Dave Shield49ac3782009-05-28 10:41:30 +00001345 where 'page_me' and 'log_it' are the commands to be run.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001346
Dave Shield49ac3782009-05-28 10:41:30 +00001347 Forwarding notifications to another receiver would be done using
1348 similar 'snmptrapd.conf' directives:
Wes Hardaker51d88c72000-11-30 18:31:56 +00001349
Dave Shield49ac3782009-05-28 10:41:30 +00001350 forward .1.3.6.1.4.1.8072.4.0.3 10.0.0.1
1351 forward default 10.0.0.2
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001352
Dave Shield49ac3782009-05-28 10:41:30 +00001353 There's a tutorial with more details on the web site at
Wes Hardakerf5e9ead2011-02-22 23:55:43 +00001354 http://www.net-snmp.org/wiki/index.php/TUT:snmptrap
Dave Shield49ac3782009-05-28 10:41:30 +00001355
1356
1357
1358How do I receive SNMPv1 traps?
1359-----------------------------
1360
1361 Directives in the 'snmptrapd.conf' file use the (SNMPv2) snmpTrapOID
1362 value to identify individual notifications. This applies to *all*
1363 versions of SNMP - including SNMPv1 traps. See the co-existence spec
1364 (RFC 2576) for details of mapping SNMPv1 traps to SNMPv2 OIDs.
1365
1366 Note that the first traphandle directive in the previous entry uses
1367 the OID corresponding to the SNMPv1 'coldStart' trap.
1368
1369
1370
1371Why don't I receive incoming traps?
1372----------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001373
Dave Shieldab90a5e2006-11-24 11:21:53 +00001374 Starting with net-snmp 5.3, snmptrapd will no longer automatically
1375 accept all incoming traps. It must be configured with authorized
1376 SNMPv1/v2c community strings and/or SNMPv3 users. Non-authorized
1377 traps/informs will be dropped.
1378 Please refer to the snmptrapd.conf(5) manual page for details.
Thomas Anders71b94002005-12-27 21:45:30 +00001379
Wes Hardaker51d88c72000-11-30 18:31:56 +00001380
1381
Dave Shield679c10d2002-06-10 08:28:43 +00001382My traphandler script doesn't work when run like this - why not?
1383---------------------------------------------------------------
1384
1385 If a traphandler script works fine when run manually from the
Dave Shieldab90a5e2006-11-24 11:21:53 +00001386 command line, but fails or generates an error when triggered by
1387 an incoming notification, then there are two likely causes.
Dave Shield679c10d2002-06-10 08:28:43 +00001388
1389 Firstly, the interactive shell environment may not be precisely
1390 the same as that for programs executed by the snmptrapd daemon.
1391 In particular, it's quite possible that the PATH environmental
1392 variable may not include all the additional directories that are
1393 commonly set up for a personal login configuration. To avoid this
1394 problem (particularly for traphandler shell scripts), it's worth
1395 giving the full path to all programs used within the script.
1396
1397 Secondly, the snmptrapd daemon may not always recognise the
1398 appropriate interpreter to use for a particular trap handler.
1399 If this is the case, then you can specify this interpreter
1400 explicitly as part of the trap handle directive:
1401
1402 traphandle default /usr/bin/perl /usr/local/bin/log_it
1403
Dave Shieldab90a5e2006-11-24 11:21:53 +00001404 In this case, it's almost certain that you'll also
Dave Shield679c10d2002-06-10 08:28:43 +00001405 need to give the full path to the traphandle script (as shown)
1406
1407
1408
Dave Shield49ac3782009-05-28 10:41:30 +00001409How can the agent receive traps and notifications?
1410-------------------------------------------------
1411
1412 It can't.
1413
1414 The primary purpose of an SNMP agent is to handle requests for
1415 information from management applications. In SNMP terminology,
1416 it acts as a "command responder".
1417
1418 It may also issue traps to report significant events or conditions
1419 ("notification generator"). But responding to such notifications
1420 is a significantly different role, and this is handled by a separate
1421 application ('snmptrapd'). Note that it is perfectly possible (even
1422 normal) for both agent and trap receiver to run on the same host.
1423
1424
1425
Wes Hardaker51d88c72000-11-30 18:31:56 +00001426How big can an SNMP request (or reply) be?
1427-----------------------------------------
1428
1429 The protocol definition specifies a "minimum maximum" packet size
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001430 (484 bytes for UDP), which all systems must support, but does not
Wes Hardaker51d88c72000-11-30 18:31:56 +00001431 attempt to define an upper bound for this maximum size. This is left
1432 to each individual implementation.
1433
Dave Shieldab90a5e2006-11-24 11:21:53 +00001434 The UCD software used a fixed size buffer of 1472 bytes to hold the
1435 encoded packet, so all requests and responses had to fit within this.
1436 The Net-SNMP releases handle packet buffers rather differently, and
1437 are not subject to the same fixed restrictions.
Dave Shieldbae701f2003-10-29 10:59:23 +00001438
Wes Hardaker51d88c72000-11-30 18:31:56 +00001439
1440
Wes Hardaker00be2092000-12-01 17:10:30 +00001441How can I monitor my systems (disk, memory, etc)?
1442------------------------------------------------
1443
Dave Shieldbae701f2003-10-29 10:59:23 +00001444 In general, the Net-SNMP suite consists of relatively low-level
1445 tools, and there is nothing included that is designed for high-level,
Wes Hardaker00be2092000-12-01 17:10:30 +00001446 long-term monitoring of trends in network traffic, disk or memory
1447 usage, etc.
1448
1449 There are a number of packages available that are designed for this
1450 purpose. Two of the most widely used are MRTG (http://www.mrtg.org/)
Dave Shieldab90a5e2006-11-24 11:21:53 +00001451 and RRDtool (http://oss.oetiker.ch/rrdtool/). There are also several
1452 frontends built on top of RRDtool, including Cacti (http://www.cacti.net/)
Wes Hardaker00be2092000-12-01 17:10:30 +00001453 and Cricket (http://cricket.sourceforge.net/). There are details of
1454 how to set up Cricket to monitor some of the UCD extensions at
Dave Shieldfadfa632001-10-17 14:52:30 +00001455 http://www.afn.org/~jam/software/cricket/
1456
1457 We have also set up a page that describes in detail how MRTG
1458 can be set up to monitor disk, memory and cpu activity at
Wes Hardaker56bf9592002-05-11 00:09:02 +00001459 http://www.net-snmp.org/tutorial-5/mrtg/index.html
Wes Hardaker00be2092000-12-01 17:10:30 +00001460
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00001461 There is also a web-based network configuration system "Net-Policy",
1462 based upon SNMP. This is not strictly connected to the Net-SNMP project,
1463 but a number of the core developers are also involved with that system.
1464 See http://net-policy.sourceforge.net for more details.
Wes Hardaker00be2092000-12-01 17:10:30 +00001465
1466
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001467
Wes Hardaker51d88c72000-11-30 18:31:56 +00001468Applications complain about entries in your example 'snmp.conf' file. Why?
1469--------------------------------------------------------------------------
1470
Dave Shieldab90a5e2006-11-24 11:21:53 +00001471 There *is* no example 'snmp.conf' shipped with the standard distribution.
1472
1473 The configuration file 'EXAMPLE.conf' is designed as a config for
1474 the agent, and should be installed as 'snmpd.conf' (note the 'd').
Wes Hardaker51d88c72000-11-30 18:31:56 +00001475 The file 'snmp.conf' is intended for general configuration options,
1476 applicable to all applications (via the SNMP library).
Dave Shieldab90a5e2006-11-24 11:21:53 +00001477 Rename (or merge) the 'snmp.conf' file to 'snmpd.conf', and this
1478 should fix the problem.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001479
Dave Shield49ac3782009-05-28 10:41:30 +00001480 See the AGENT section or the 'snmpd.conf(5)' man page for more information
1481 about what should go in this file.
1482
Wes Hardaker51d88c72000-11-30 18:31:56 +00001483
1484
1485OK, what should I put in snmp.conf?
1486----------------------------------
1487
1488 This is used to set common configuration values for most of the
1489 applications, to avoid having to specify them every time. Examples
Dave Shieldab90a5e2006-11-24 11:21:53 +00001490 are the SNMPv3 settings mentioned above, defaults for which MIBs to
Dave Shield13c14522006-12-29 17:25:33 +00001491 load and where from (see the second entry in this section),
Dave Shieldab90a5e2006-11-24 11:21:53 +00001492 and the default SNMP version, port and (if appropriate) community
1493 string to use.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001494
Dave Shield49ac3782009-05-28 10:41:30 +00001495 Some of these (such as MIB information), might be best put in a
1496 shared snmp.conf file (typically /usr/local/share/snmp/snmp.conf or
Dave Shield5da154e2002-03-12 16:35:01 +00001497 /etc/snmp/snmp.conf) to apply to all users of the system. Others
1498 (particularly the SNMPv3 security settings), are more likely to refer
Dave Shield49ac3782009-05-28 10:41:30 +00001499 to a particular user, and should probably go in a personal snmp.conf
1500 file (typically $HOME/.snmp/snmp.conf).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001501
Dave Shieldab90a5e2006-11-24 11:21:53 +00001502 See 'snmpget -H' and/or the snmp.conf(5) man page for more details.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001503
Wes Hardaker74c2e712000-12-01 22:36:54 +00001504 You can also use the "snmpconf" command to help you generate your
1505 snmp.conf configuration file (just run it and answer its questions).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001506
1507
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001508
Dave Shield24569f72009-05-28 11:31:51 +00001509How do I specify IPv6 addresses in tools command line arguments?
1510---------------------------------------------------------------
1511
1512 IPv6 addresses pose a particular problem for the Net-SNMP command
1513 line tools, which parse host names into pieces. In particular, normally
1514 if you specify a simple host name, it assumes you want UDP in IPv4 on
1515 port 161. By default, these two commands are actually the same:
1516
1517 snmpget 127.0.0.1 sysUpTime.0
1518 snmpget udp:127.0.0.1:161 sysUpTime.0
1519
1520 However, for IPv6 this causes a problem because IPv6 addresses also use
1521 a colon to separate addressing parts. Thus you need to enclose the address
1522 in square brackets ( [ and ] ).
1523 Because most shells use these brackets too, you also likely need to quote it:
1524
1525 snmpget 'udp6:[::1]:161' sysUpTime.0
1526
1527
1528
Wes Hardaker51d88c72000-11-30 18:31:56 +00001529PERL
1530====
1531
Dave Shield5b58b2f2009-07-21 09:15:07 +00001532What is the purpose of the Perl SNMP module?
1533-------------------------------------------
1534
1535 Short, comprehensive (but ultimately unhelpful) anwer - to provide a
1536 perl interface for SNMP operations.
1537
1538 Longer, incomplete (but more useful) answer - there are probably two
1539 main uses for the Perl SNMP module. The first is for developing client
1540 management applications, using perl to send SNMP requests, and manipulating
1541 or displaying the results. As such, this is a straight alternative to
1542 various other SNMP toolkits currently available (for both perl and other
1543 programming languages).
1544
1545 The second is as a means for extending the functionality of the Net-SNMP
1546 agent, by implementing new MIB modules. This is an alternative to the
1547 other script-based extension mechanisms, but is more tightly bound to the
1548 Net-SNMP agent (and hence more efficient), while still avoiding the need
1549 to write C code.
1550
1551 It is also possible to use the perl SNMP module in the snmpd.conf file,
1552 or to process incoming notifications, but the above are probably the
1553 two primary uses.
1554
1555
1556
Thomas Andersb3905ba2006-11-24 13:13:36 +00001557Where can I get the Perl SNMP package?
Wes Hardaker51d88c72000-11-30 18:31:56 +00001558-------------------------------------
1559
Thomas Andersb3905ba2006-11-24 13:13:36 +00001560 Joe Marzot's excellent Perl 'SNMP' module, is included in the Net-SNMP
Dave Shieldab90a5e2006-11-24 11:21:53 +00001561 source releases. It can be found located in the perl/SNMP subdirectory
Thomas Andersb3905ba2006-11-24 13:13:36 +00001562 of the source tree. This is accompanied by a number of Perl modules
Dave Shieldab90a5e2006-11-24 11:21:53 +00001563 grouped together under the NetSNMP namespace.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001564
Dave Shieldab90a5e2006-11-24 11:21:53 +00001565 The basic SNMP module (though not the NetSNMP additions), can also
1566 be found at any Comprehensive Perl Archive Network (CPAN) mirror site,
1567 under modules/by-module/SNMP. To find the CPAN site nearest you,
1568 please see http://www.cpan.org/SITES.html.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001569
Thomas Andersb3905ba2006-11-24 13:13:36 +00001570 These Perl modules need to be used in conjunction with a compatible
Dave Shieldab90a5e2006-11-24 11:21:53 +00001571 version of the Net-SNMP library. Consult the README file in the SNMP
Thomas Andersb3905ba2006-11-24 13:13:36 +00001572 Perl distribution to find out which version of the library it needs.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001573
1574
1575
Dave Shield6f04d7b2003-01-09 16:55:35 +00001576How do I install the Perl SNMP modules?
1577--------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001578
Thomas Andersb3905ba2006-11-24 13:13:36 +00001579 Assuming you have a reasonably new (and properly configured) Perl system,
Wes Hardaker51d88c72000-11-30 18:31:56 +00001580 this should be simply:
1581
Dave Shieldab90a5e2006-11-24 11:21:53 +00001582 cd perl
Wes Hardaker51d88c72000-11-30 18:31:56 +00001583 perl Makefile.PL
1584 (press RETURN when prompted for host and community)
1585 make
1586 make test
1587 make install (probably as root)
1588
Dave Shieldab90a5e2006-11-24 11:21:53 +00001589
1590 It might be possible to install the basic module using
1591
1592 perl -MCPAN -e shell ; "install SNMP"
1593
1594 but this has not been reliably tested, and very much relies on
1595 having the correct version of the Net-SNMP library.
1596
Thomas Andersb3905ba2006-11-24 13:13:36 +00001597 There may also be appropriate pre-compiled versions of the Perl modules
Dave Shieldab90a5e2006-11-24 11:21:53 +00001598 available from the Net-SNMP project website, or your O/S vendor.
Dave Shield21ee7032002-06-10 09:07:59 +00001599
Wes Hardaker51d88c72000-11-30 18:31:56 +00001600
1601
1602But compiling this fails! Why?
1603-----------------------------
1604
Thomas Andersb3905ba2006-11-24 13:13:36 +00001605 The Perl module tends to delve quite deeply into the internals of the
Dave Shieldbae701f2003-10-29 10:59:23 +00001606 main Net-SNMP library, and so is quite sensitive to changes within the
Wes Hardaker51d88c72000-11-30 18:31:56 +00001607 library. It's important to use the correct version of the module, that
1608 corresponds to the version of the library you have installed. If you're
Dave Shield13c14522006-12-29 17:25:33 +00001609 working with a Net-SNMP source distribution, the appropriate versions of
Thomas Andersb3905ba2006-11-24 13:13:36 +00001610 the Perl modules are shipped as part of the source code, but you *must*
Dave Shieldab90a5e2006-11-24 11:21:53 +00001611 have run "make install" on the main Net-SNMP distribution *first*.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001612
1613 If you're working with a ready-installed version of the library, make
Thomas Andersb3905ba2006-11-24 13:13:36 +00001614 sure you obtain a compatible version of the Perl module.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001615
Thomas Andersb3905ba2006-11-24 13:13:36 +00001616 Note that the Perl modules will be compiled using the compiler
Dave Shield74164ed2003-01-10 13:31:00 +00001617 (and compiler settings) used for compiling the original perl binary,
1618 *not* those used for compiling the Net-SNMP (or UCD) library.
1619 If these are different (e.g. 'gcc' used for one and 'cc' for the other)
1620 then this may well cause problems. It's much safer to use a consistent
Dave Shield428fc472003-01-10 14:04:36 +00001621 environment for both. This issue is discussed in greater detail in
1622 the README.solaris file.
Dave Shield74164ed2003-01-10 13:31:00 +00001623
1624 Also note that the v5 Net-SNMP suite *must* be configured to provide
Thomas Andersb3905ba2006-11-24 13:13:36 +00001625 shared libraries in order for the Perl modules to work correctly. This
Dave Shield74164ed2003-01-10 13:31:00 +00001626 is not necessary with the v4 UCD-SNMP libraries.
1627
Wes Hardaker51d88c72000-11-30 18:31:56 +00001628
1629
Thomas Andersb3905ba2006-11-24 13:13:36 +00001630Compiling the Perl module works OK, but 'make test' fails. Why?
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001631--------------------------------------------------------------
1632
1633 That's difficult to answer in general.
Thomas Andersb3905ba2006-11-24 13:13:36 +00001634 Some of the Perl tests are rather picky, so this may simply be
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001635 some minor inconsistency between your precise setup, and the
1636 expectations of the test environment.
1637
Thomas Andersb3905ba2006-11-24 13:13:36 +00001638 Check that you are working with the Perl distribution that matches
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001639 the SNMP libraries (use the 'perl/SNMP' in preference to CPAN), and
1640 that you have installed the main libraries successfully (uninstall
1641 any old versions if you're having trouble).
1642
1643 If all this looks OK, and if most of the tests pass, then it's
1644 probably safe to run 'make install' anyway. Probably.
1645
1646
1647
Dave Shield13c14522006-12-29 17:25:33 +00001648Why can't mib2c (or tkmib) locate SNMP.pm?
1649-----------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001650
Dave Shield13c14522006-12-29 17:25:33 +00001651 That's probably because the SNMP Perl module hasn't been installed.
1652 It's not part of the standard Perl distribution, nor is it included
1653 in the default Fedora Linux installation (for example).
1654 You'll need to install it yourself.
1655
1656 See the second entry in this section.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001657
1658
1659
Dave Shield13c14522006-12-29 17:25:33 +00001660Why can't mib2c (or tkmib) load SNMP.so?
1661---------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001662
1663 This is probably the same problem. Either the SNMP module
1664 hasn't been installed, or it's the wrong version. See the
Dave Shieldab90a5e2006-11-24 11:21:53 +00001665 previous questions.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001666
1667
1668
Dave Shield13c14522006-12-29 17:25:33 +00001669Why can't tkmib locate Tk.pm?
1670----------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001671
1672 Tk.pm is another Perl package that needs to be installed before tkmib
1673 will run. It's also available on Perl CPAN. We suggest using version
1674 "Tk800.011" or later. It can be installed by issuing the command:
1675
1676 perl -MCPAN -e shell ; "install Tk"
1677
1678
1679
Dave Shield9c981282009-05-28 11:56:37 +00001680Why does your RPM complain about missing Perl modules?
1681-----------------------------------------------------
Dave Shieldddd57ec2004-07-28 09:17:33 +00001682
1683 This has been particularly noted on RedHat 9, complaining about the
1684 module "perl(Term::ReadKey)" - even if this is actually present (e.g.
1685 having been installed directly from CPAN). In fact, this is not
Thomas Andersb3905ba2006-11-24 13:13:36 +00001686 specific to Perl modules - the same issue can potentially arise with
Dave Shieldddd57ec2004-07-28 09:17:33 +00001687 other RPM dependencies.
1688
1689 The problem is that the RPM mechanism keeps a local database of what
1690 software packages have been installed, and checks this for any other
1691 features that this RPM requires. If software is installed "manually"
1692 rather than via rpm packages, then it will not appear in this database.
1693 Attempting to install another RPM that rely on this functionality will
1694 then complain about the "missing" package, because the RPM system doesn't
1695 know that's it's actually available.
1696
1697 The ideal solution is to *always* install software using a consistent
1698 mechanism (which may involve building RPMs locally, or looking for a
1699 suitable pre-built version).
1700
1701 Failing this, it's possible to tell the "rpm" command to ignore such
1702 dependencies, and install the package anyway. Try:
1703
1704 rpm -i --nodeps {package}
1705
1706 In this situation, it's then up to you to make sure that any other
1707 necessary packages *are* actually present on the system.
1708
1709
1710
Dave Shield6f04d7b2003-01-09 16:55:35 +00001711I've got a problem with the Net-SNMP module. Can you help?
1712----------------------------------------------------------
1713
1714 Sorry, despite the similar-sounding name, the Net-SNMP (or Net::SNMP)
1715 module is nothing to do with this package, or the NetSNMP modules.
1716 Net::SNMP is a "pure-perl" implementation of SNMP support, developed
1717 by David Town. The developers of the (C-based) Net-SNMP suite do
1718 not have any significant experience in using this particular module,
1719 and you'll probably be better off asking for help via CPAN or some
1720 other perl-related forum.
1721
1722
1723
Wes Hardaker51d88c72000-11-30 18:31:56 +00001724MIBS
1725====
1726
Dave Shieldceab78b1999-08-09 08:02:15 +00001727Where can I find a MIB compiler?
1728-------------------------------
1729
1730 That depends what you mean by a "MIB compiler". There are at least two
1731 types of tool that are commonly referred to by this name.
1732
Dave Shield45090bc2009-05-28 12:41:35 +00001733 The first is a tool to check MIB files for validity. With the Net-SNMP
1734 software, this functionality is mostly integrated within the MIB parser,
Dave Shieldceab78b1999-08-09 08:02:15 +00001735 and hence included in all the applications. The tool 'snmptranslate' is
1736 probably the most appropriate for this purpose.
Dave Shieldceab78b1999-08-09 08:02:15 +00001737
Dave Shield45090bc2009-05-28 12:41:35 +00001738 Note that the parser is fairly forgiving (see 'What ASN.1 parser is used'
1739 below), so this should not be regarded as a stamp of approval. For a
1740 more rigourous validation, use a tool such as 'smilint', or the on-line
1741 interface at http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/
1742
1743 The second type of "MIB compiler" is one to turn a MIB specification
1744 into C code, specifically one designed to aid agent implementation. The
1745 command 'mib2c' is an example of such a tool for the Net-SNMP agent.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001746 See the CODING section for more information.
Dave Shieldceab78b1999-08-09 08:02:15 +00001747
1748
1749
Dave Shield45090bc2009-05-28 12:41:35 +00001750Why aren't my MIB files being read in?
Wes Hardaker51d88c72000-11-30 18:31:56 +00001751-------------------------------------
Dave Shield169203e2000-02-10 15:14:51 +00001752
Dave Shield45090bc2009-05-28 12:41:35 +00001753 There are two basic likely causes - either the library isn't attemping to
1754 load these particular MIB files, or it's trying to load them but can't
1755 locate them.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001756
Dave Shield45090bc2009-05-28 12:41:35 +00001757 By default, the Net-SNMP library loads a specific subset of MIB files.
1758 This list is set when the suite is first configured and compiled, and
1759 basically corresponds to the list of modules that the agent supports.
1760 (This is a simplification, but is a reasonable first approximation).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001761
Dave Shield45090bc2009-05-28 12:41:35 +00001762 In order to load additional MIB files, it is necessary to add them to this
1763 default list. See the FAQ entry "How do I add a MIB to the tools?" for
1764 more information about how to do this.
Dave Shieldceab78b1999-08-09 08:02:15 +00001765
1766
Dave Shield45090bc2009-05-28 12:41:35 +00001767 Alternatively, the tools may be looking in the wrong place. The directory
1768 where the library looks for MIB files is also set when the software is
1769 first configured and compiled. If you put new MIB files in the wrong
1770 location, then the library won't be able to find them (and will complain).
Wes Hardaker51d88c72000-11-30 18:31:56 +00001771
Dave Shield45090bc2009-05-28 12:41:35 +00001772 This problem may arise when switching from a vendor-supplied distribution
1773 to one compiled from source (or vice versa).
1774 See the next entry for more information.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001775
1776
1777
Dave Shield45090bc2009-05-28 12:41:35 +00001778Where should I put my MIB files?
1779-------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001780
Dave Shield45090bc2009-05-28 12:41:35 +00001781 If you've compiled the package from source (or are using binaries
1782 from the project website), then you should probably put new MIB
1783 files in the directory /usr/local/share/snmp/mibs
Dave Shield80489f92006-11-24 13:41:23 +00001784
Dave Shield45090bc2009-05-28 12:41:35 +00001785 If you are using vendor-supplied binaries, then the MIB files
1786 may well be located somewhere else (e.g. /usr/share/snmp/mibs,
1787 /opt/snmp/mibs, or /etc/sma/snmp/mibs). Have a look for where
1788 existing MIB files are installed, and try adding your MIBs to
1789 the same directory.
Dave Shield80489f92006-11-24 13:41:23 +00001790
Dave Shield45090bc2009-05-28 12:41:35 +00001791 If you compiled the source yourself, but specified a different
1792 --prefix value when running configure, then the location of the
1793 MIB directory will be {prefix}/share/snmp/mibs.
1794
1795 If you're still not sure where to put your MIB files, try running
1796 the command
1797
1798 snmpget -Dparse-mibs 2>&1 | grep directory
1799
1800 This will display the location(s) where the library is looking
1801 for MIB files.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001802
1803
1804
1805What does "Cannot find module (XXX-MIB)" mean?
1806---------------------------------------------
1807
Dave Shield80489f92006-11-24 13:41:23 +00001808 If this error is only generated for one or two modules, then it's
1809 likely that the named modules are not being found - perhaps they're
1810 not installed in the correct location, are not readable, or the
Dave Shield45090bc2009-05-28 12:41:35 +00001811 name being used is incorrect. See the previous entries and the entry
1812 "How do I add a MIB to the tools?" for more details.
1813
1814 Note that the name reported is the name of the MIB *module*, which is
1815 not necessarily the same as the name of the file.
1816
Wes Hardaker51d88c72000-11-30 18:31:56 +00001817
Dave Shield80489f92006-11-24 13:41:23 +00001818 If there are a large number of such errors, then it's more likely
Dave Shield45090bc2009-05-28 12:41:35 +00001819 that either the MIB files haven't been installed at all. If you are
1820 compiling from source, then it is necessary to run "make install" in
1821 order to set up the full run-time environment.
1822
1823 Otherwise, see the previous entry to check whether the MIBs are installed
1824 in the correct location for the tools to find them.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001825
1826
1827
Dave Shield45090bc2009-05-28 12:41:35 +00001828I'm getting answers, but they're all numbers. Why?
1829-------------------------------------------------
1830
1831 This is related to the previous questions. Remember, the results that
1832 you receive from an agent do not depend on which MIBs are loaded by the
1833 client tools - purely on how the agent was compiled and configured.
1834
1835 Because the tools don't necessarily read in every MIB file they can find
1836 (and the relevant MIB file may not be available anyway), it is quite
1837 possible for results from an agent to refer to modules that have not
1838 been loaded (particularly with GETNEXT requests, or when walking a tree).
1839
1840 The results will be reported correctly, but won't be translated to use
1841 named identifiers (or display the values in the most appropriate manner).
1842 To fix this, add the missing MIB files to the list of MIBs to be loaded.
1843 See the previous entries and the entry "How do I add a MIB to the tools?"
1844 for more information.
1845
1846
1847
1848What does "unlinked OID" mean?
1849-----------------------------
Dave Shield92e01512002-03-13 12:03:22 +00001850
1851 This means that the library has been able to find the MIB module,
1852 and parse the individual objects defined in it, but is having problems
1853 linking them together into a consistent tree. In particular, it
1854 can't find an object corresponding to the name within the braces
1855 (i.e. the 'xxx' in '{xxx 99}').
1856
1857 This is probably due either to a typo in this name (remember that
1858 names are case sensitive, so a reference to 'xxx' will *not* match
1859 a definition of 'Xxx'), or else the name is defined in another MIB
1860 file, and this dependency is missing from the IMPORT clause of this
1861 MIB file.
1862
1863
1864
Wes Hardaker51d88c72000-11-30 18:31:56 +00001865The parser doesn't handle comments properly. Why not?
Dave Shield80489f92006-11-24 13:41:23 +00001866----------------------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00001867
Dave Shield45090bc2009-05-28 12:41:35 +00001868 The way that comments are handled in a MIB file is subtly different
1869 to the equivalent syntax in most typical programming languages, and
1870 this difference can catch out the unwary. In particular, there are
1871 two common situations which can lead to problems.
1872
1873 The first scenario is where the MIB designer has attempted to "comment
1874 out" an unwanted line that already contains a comment:
Wes Hardaker51d88c72000-11-30 18:31:56 +00001875
1876 -- broken ::= { myMIB 1 } -- This isn't working yet
1877
1878 The assumption here is that a comment continues to the end of the line.
Dave Shield80489f92006-11-24 13:41:23 +00001879 Unfortunately, this is not correct. A comment will continue either to
1880 the end of the line, *or* the next occurance of a pair of dashes.
1881
1882 Thus in this case, the definition of "broken" is commented out (as
Dave Shield45090bc2009-05-28 12:41:35 +00001883 intended) but the following text ("This isn't working yet") is treated
1884 as an active part of the MIB, and will generate an error.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001885
Wes Hardaker51d88c72000-11-30 18:31:56 +00001886
Dave Shield45090bc2009-05-28 12:41:35 +00001887 The second scenario is where a line of dashes has been used to mark
1888 out separate parts of a MIB file. Depending on the exact number of
1889 dashes used, this may still result in a syntactically valid MIB file,
1890 but has a 1-in-4 possibility of triggering an error. This means that
1891 this particular situation can be particularly difficult to spot!
1892
1893
1894 Most of the Net-SNMP applications have a command-line option (-Pc) which
1895 will work around this problem by treating the whole line as a comment.
1896 But this is not strictly legal, and the offending MIB file should really
1897 be corrected.
Wes Hardaker51d88c72000-11-30 18:31:56 +00001898
1899
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001900
Dave Shield80489f92006-11-24 13:41:23 +00001901How can I get more information about problems with MIB files?
Wes Hardaker51d88c72000-11-30 18:31:56 +00001902------------------------------------------------------------
1903
1904 The command 'snmptranslate' is used to translate between numeric
Dave Shield80489f92006-11-24 13:41:23 +00001905 and symbolic forms of OIDs. It uses the same MIB parsing routines
1906 as the commands that actually communicate with a network management
1907 agent, but can be used standalone. As such, it is a useful tool
Wes Hardaker51d88c72000-11-30 18:31:56 +00001908 for identifying problems with reading in MIB files.
1909
1910 In particular, the following options may be useful in
1911 identifying problems:
1912 -Pw warns about conflicting symbols
1913 -PW prints more verbose warnings about other problems as well
1914 (in both cases, ignore the 'xmalloc' reports)
Wes Hardaker51d88c72000-11-30 18:31:56 +00001915 -T provides sub-options for various views of these entries
1916
1917 There are other '-P' options to control various aspects of MIB parsing.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001918 See the 'snmptranslate(1)' and 'snmpcmd(1)' man pages for more details,
1919 or the tutorial at
Wes Hardaker56bf9592002-05-11 00:09:02 +00001920 http://www.net-snmp.org/tutorial-5/commands/snmptranslate.html
Wes Hardaker51d88c72000-11-30 18:31:56 +00001921
Dave Shield45090bc2009-05-28 12:41:35 +00001922 For a more rigourous validation, use a tool such as 'smilint', or the
1923 on-line interface at http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/
1924
Wes Hardaker6241ebf2001-04-06 19:12:28 +00001925
Wes Hardaker51d88c72000-11-30 18:31:56 +00001926
1927What's this about "too many imported symbols"?
1928---------------------------------------------
1929
1930 Any MIB file starts with an (optional) list of identifiers that
Dave Shield80489f92006-11-24 13:41:23 +00001931 it "imports" from other files. The parser handles this using
Wes Hardaker51d88c72000-11-30 18:31:56 +00001932 a fixed size buffer to hold the import information.
1933 There are two circumstances in which this can result in the
1934 error message shown above.
1935
Dave Shield43dcec82002-03-11 15:42:08 +00001936 Firstly, if the MIB file refers to an unusually large number
Wes Hardaker51d88c72000-11-30 18:31:56 +00001937 of external identifiers. Handling this case requires a (trivial)
1938 patch to the parsing code. Contact the coders list for advice.
1939 (This is extremely rare - the only example that
1940 we've come across is the Cabletron Trap MIB).
1941
1942 Much more common is a syntax error in the IMPORTS clause of the
Dave Shield80489f92006-11-24 13:41:23 +00001943 MIB file in question. In particular, check that this section ends
1944 in a semicolon, before going on to the main MIB object definitions.
Dave Shield90059672004-07-16 16:08:50 +00001945
1946
1947
1948Do I actually need the MIB files?
1949--------------------------------
1950
1951 Probably not.
1952 The MIB files play two main roles - they are used to translate
1953 between numeric OIDs and the corresponding textual names, and
1954 they define the structure and syntax of the relevant MIB objects.
1955
1956 This second role is perhaps best thought of in terms of a design
1957 document. It's vital while developing an application (typically
1958 the MIB module or handler within the agent), since it defines
1959 what the application (MIB) must actually do. But once the code
1960 has been written, the design document becomes redundent.
1961 The agent then has the same information hardcoded into it
1962 (literally!), and no longer needs the MIB file.
1963
1964 The translation task is not strictly necessary - SNMP will
1965 operate fine without any MIB files at all, as long as you're
1966 happy to work with numeric OIDs throughout, and know which MIB
1967 objects you're interested in. But it's much easier to work with
1968 the (hopefully) meaningful names, enumeration tags and the like,
1969 and to view the description of a particular object.
1970 This requires having the relevant MIB files installed and loaded.
1971
Dave Shieldceab78b1999-08-09 08:02:15 +00001972
Dave Shield45090bc2009-05-28 12:41:35 +00001973 Since the agent needs MIBs the least and some systems are memory
1974 restricted, it is possible to completely disable loading these MIBs
1975 as well as remove the code that does the parsing by using the
1976 --disable-mib-loading flag to configure.
1977
1978 However, note that certain snmpd.conf tokens actually make use
1979 of mib information so they won't be as easily usable.
1980
1981
Dave Shieldceab78b1999-08-09 08:02:15 +00001982
Wes Hardaker34ac96d1997-01-29 11:11:04 +00001983AGENT
1984=====
1985
1986What MIBs are supported?
Wes Hardaker82ad1f91997-02-04 08:35:02 +00001987-----------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +00001988
Dave Shield5da154e2002-03-12 16:35:01 +00001989 The following MIBs are supported (at least in part and on some systems):
Wes Hardaker34ac96d1997-01-29 11:11:04 +00001990
Dave Shield80489f92006-11-24 13:41:23 +00001991 - MIB-2 General network statistics
1992 (RFC 1213 and subsequent revisions)
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00001993 - Host Resources (RFC 1514 and 2790)
Dave Shield80489f92006-11-24 13:41:23 +00001994 - SNMPv3 framework (RFCs 2571-5, 3411-3418)
Dave Shield4746cba2004-04-14 09:28:21 +00001995 (including USM, VACM, Target
1996 and Notification MIBs)
Dave Shield80489f92006-11-24 13:41:23 +00001997 - DisMan Event and Schedule MIBs
Dave Shield4746cba2004-04-14 09:28:21 +00001998 - MTA-MIB (sendmail)
Dave Shield80489f92006-11-24 13:41:23 +00001999 - private UCD/Net-SNMP agent extensions
Dave Shield4746cba2004-04-14 09:28:21 +00002000 (monitor specified processes and disks,
Dave Shield5a33a462009-06-15 15:25:06 +00002001 memory, CPU, load average, + extending
Dave Shield4746cba2004-04-14 09:28:21 +00002002 the agent using shell commands)
Wes Hardakerb922f281997-10-20 18:45:58 +00002003
Thomas Anders71b94002005-12-27 21:45:30 +00002004 See README.agent-mibs for details.
2005
Dave Shield5a33a462009-06-15 15:25:06 +00002006 Not all MIB modules are included by default on all systems. Some of
Dave Shield80489f92006-11-24 13:41:23 +00002007 these may need to be explicitly requested when the software is first
Dave Shield5a33a462009-06-15 15:25:06 +00002008 configured and built, while others may not be available on all
2009 architectures.
Dave Shield4746cba2004-04-14 09:28:21 +00002010
2011 There are a few other MIB implementations distributed as part of the
2012 source tarball, but these are basically unsupported and most of the
2013 core developers have little or no experience with using them.
Dave Shieldceab78b1999-08-09 08:02:15 +00002014
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002015
2016
Wes Hardaker51d88c72000-11-30 18:31:56 +00002017What protocols are supported?
2018----------------------------
2019
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002020 The agent supports all three current versions of SNMP (v1, v2c and v3),
Dave Shield80489f92006-11-24 13:41:23 +00002021 over both UDP and TCP transports, as well as acting as a SMUX (RFC 1227)
2022 master agent, AgentX (RFC 2741) in both master and subagent roles, and
2023 SNMP proxying.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002024
Wes Hardaker51d88c72000-11-30 18:31:56 +00002025
2026
Wes Hardaker74c2e712000-12-01 22:36:54 +00002027How do I configure the agent?
2028----------------------------
2029
Dave Shield5a33a462009-06-15 15:25:06 +00002030 That's a somewhat ambiguous question, as there are two very different
2031 stages where it is possible to "configure" the agent.
Wes Hardaker74c2e712000-12-01 22:36:54 +00002032
Dave Shield80489f92006-11-24 13:41:23 +00002033 Firstly, you can determine what capabilities and defaults are included
2034 within the library and agent, at the time that the software is first
2035 built. This uses suitable flags to the 'configure' script, before
2036 compiling the source.
2037 As far as the agent is concerned, the most significant option is
2038 '--with-mib-modules' (or '--with-out-mib-modules') to control which
2039 MIBs will be supported by the agent. See the next few entries for
2040 details.
Wes Hardaker74c2e712000-12-01 22:36:54 +00002041
Dave Shield80489f92006-11-24 13:41:23 +00002042 You can also control various aspects of the agent behaviour (and the
2043 information it returns) at run time, via the 'snmpd.conf' configuration
2044 file. Various aspects of this are touched on throughout this FAQ. Or
2045 see the snmpd.conf(5) manual page for full details.
2046 The "snmpconf" script can help in creating this config file.
2047 Start off with 'snmpconf -g basic_setup' to get you going.
Wes Hardaker74c2e712000-12-01 22:36:54 +00002048
Wes Hardaker51d88c72000-11-30 18:31:56 +00002049
Wes Hardakerb922f281997-10-20 18:45:58 +00002050
Dave Shielda8e43f52004-11-09 16:12:38 +00002051How do I remove a MIB from the agent?
2052------------------------------------
2053
Dave Shield80489f92006-11-24 13:41:23 +00002054 Deleting the text file for a MIB does not affect the agent (other than
2055 to prevent it from recognising MIB object names in the config files).
2056 It's necessary to tell the agent not to activate the relevant code that
2057 actually implements these objects. There are three ways to do this:
Dave Shielda8e43f52004-11-09 16:12:38 +00002058
Dave Shield80489f92006-11-24 13:41:23 +00002059 1) re-run 'configure' to exclude the given MIB module(s) from the
Dave Shield13c14522006-12-29 17:25:33 +00002060 build configuration, then recompile and reinstall:
Dave Shielda8e43f52004-11-09 16:12:38 +00002061
Dave Shield5a33a462009-06-15 15:25:06 +00002062 ./configure --with-out-mib-modules=path/to/unwanted ....
Dave Shield80489f92006-11-24 13:41:23 +00002063 make
2064 make install
Dave Shielda8e43f52004-11-09 16:12:38 +00002065
Dave Shield5a33a462009-06-15 15:25:06 +00002066 This specifies the path to the module code file, relative to
2067 the 'agent/mibgroup' directory. Clearly, this approach is
2068 only possible if you are working with a source distribution.
2069
2070 2) disable the MIB at runtime
Dave Shielda8e43f52004-11-09 16:12:38 +00002071
Dave Shield5a33a462009-06-15 15:25:06 +00002072 snmpd -I -unwanted
Dave Shield80489f92006-11-24 13:41:23 +00002073
2074 Note that this relies on knowing which modules are used to
2075 implement the relevant MIB objects. If you're not sure,
Dave Shield5a33a462009-06-15 15:25:06 +00002076 you could try walking the 'nsModuleName' MIB object, which
2077 indicates the module responsible for each particular range
2078 of OIDs.
2079 You can also check which MIB modules are loaded by getting
2080 the agent to report them as they are initialised:
Dave Shielda8e43f52004-11-09 16:12:38 +00002081
2082 snmpd -Dmib_init -H
2083
Dave Shield5a33a462009-06-15 15:25:06 +00002084 From this information, it should then be fairly obvious which
2085 modules to disable.
Dave Shielda8e43f52004-11-09 16:12:38 +00002086
Dave Shield5a33a462009-06-15 15:25:06 +00002087 3) use access control to exclude the mib from the view used to
2088 query the agent:
2089
2090 view almostEverything included .1
2091 view almostEverything excluded unwantedMib
2092
2093 rocommunity public default -V almostEverything
2094
2095 This approach can also be used with the full com2sec/group/access
2096 configuration directives (e.g. with versions earlier than 5.3,
2097 which don't support the above mechanism).
Dave Shielda8e43f52004-11-09 16:12:38 +00002098
2099
2100
Dave Shield90059672004-07-16 16:08:50 +00002101I've installed a new MIB file. Why can't I query it?
2102----------------------------------------------------
2103
Dave Shield5a33a462009-06-15 15:25:06 +00002104 Installing a new MIB file will not magically enable the agent to know
2105 what values to report for the objects defined in that MIB. It's
2106 necessary to have some code which can provide the relevant information.
2107 The next few entries, and the CODING section address this issue in more
2108 detail.
Dave Shield90059672004-07-16 16:08:50 +00002109
2110
2111
Dave Shield80489f92006-11-24 13:41:23 +00002112How do I add a MIB to the agent?
2113-------------------------------
2114
Dave Shield5a33a462009-06-15 15:25:06 +00002115 Adding a MIB essentially involves writing some code to implement the
2116 objects defined in the new MIB. There are three basic approaches that
2117 can be used to do this:
Dave Shield80489f92006-11-24 13:41:23 +00002118
2119 - The agent can invoke an external command or shell script to
2120 return the necessary information. There are several possible
2121 variations on this approach - see the next entry for details.
2122
2123 - The agent can pass the request off to another (sub-)agent,
2124 which already implements the required MIB. Again, there are
2125 several ways of doing this - including AgentX, SMUX and
2126 proxied SNMP. See the next entry but one for details.
2127
2128 - You can write code to implement the new MIB objects, and
2129 include this within the agent. This is most commonly C
2130 (or C++) code, although the agent can also support MIB modules
Dave Shieldfb201f72010-04-06 11:03:05 +00002131 implemented in perl.
Dave Shield80489f92006-11-24 13:41:23 +00002132 See the next section (CODING) for more details.
2133
2134 Note that there is no visible difference between external commands,
2135 subagents, and modules implemented within the main agent itself.
2136 Tools querying the agent will see a single MIB structure.
2137
2138
2139
2140What's the difference between 'exec', 'sh', 'extend' and 'pass'?
2141---------------------------------------------------------------
Dave Shieldceab78b1999-08-09 08:02:15 +00002142
Dave Shield5a33a462009-06-15 15:25:06 +00002143 'exec' will run the specified command and return the exit status and
2144 output. Any arguments are passed directly to the command, with no
2145 special interpretation.
Dave Shieldceab78b1999-08-09 08:02:15 +00002146
Dave Shield80489f92006-11-24 13:41:23 +00002147 'sh' is similar, but invokes a shell to run the command line given.
Dave Shieldceab78b1999-08-09 08:02:15 +00002148 This means that quoted arguments will be recognised as such, and also
Dave Shield80489f92006-11-24 13:41:23 +00002149 allows redirection, and other similar shell interpretation. The results
2150 are returned in exactly the same way.
Dave Shieldceab78b1999-08-09 08:02:15 +00002151
Dave Shield80489f92006-11-24 13:41:23 +00002152 'extend' is also similar, but provides a richer and more flexible MIB
2153 framework - both for configuring the exact command to be run, and for
2154 displaying the results.
Dave Shield90059672004-07-16 16:08:50 +00002155
Dave Shield80489f92006-11-24 13:41:23 +00002156 None of these mechanisms require the command to have any knowledge of
Dave Shield5a33a462009-06-15 15:25:06 +00002157 SNMP, or the fact that they are being used in this manner. But the
2158 output is returned in a fixed format, and it is up to the receiving
2159 application to interpret this appropriately.
Dave Shieldceab78b1999-08-09 08:02:15 +00002160
Dave Shield8e02ec02009-08-06 07:57:24 +00002161 Note that the "relocatable" form of the 'exec' directive ('exec OID ....')
2162 produces MIB output that is not strictly valid. For this reason, support
2163 for this has been deprecated in favour of 'extend OID ...', which produces
2164 well-formed MIB results (as well as providing fuller functionality).
2165 The most recent releases of the agent don't include support for "relocatable
2166 exec" by default. This needs to be explicitly included when the agent is
2167 first compiled, by including the module 'ucd-snmp/extensible' instead of
2168 'agent/extend'.
2169
Dave Shieldceab78b1999-08-09 08:02:15 +00002170
Dave Shield80489f92006-11-24 13:41:23 +00002171 'pass' is a more general mechanism for implementing arbitrary MIB
2172 objects. The specified command will be invoked for any request within
Dave Shield5a33a462009-06-15 15:25:06 +00002173 the named MIB subtree, and passed details of the requested OID. It
2174 should return the information relevant to the requested OID.
Dave Shieldceab78b1999-08-09 08:02:15 +00002175
2176 'pass-persist' is similar, but the command will continue running
Dave Shield5a33a462009-06-15 15:25:06 +00002177 even after the initial request has been answered. These two mechanisms
2178 can be used to implement a particular MIB, following the correct MIB
2179 structure (as opposed to the fixed format of exec/sh/extend).
Dave Shieldceab78b1999-08-09 08:02:15 +00002180
Dave Shield80489f92006-11-24 13:41:23 +00002181 All of these mechanisms are described in the 'snmpd.conf(5)' man page,
2182 in the section entitled "Extending Agent Functionality".
Dave Shieldceab78b1999-08-09 08:02:15 +00002183
2184
2185
Wes Hardaker51d88c72000-11-30 18:31:56 +00002186What's the difference between AgentX, SMUX and proxied SNMP?
2187-----------------------------------------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00002188
Wes Hardaker51d88c72000-11-30 18:31:56 +00002189 All three are protocols that can be used to make two or more agents
2190 appear as one to the querying application. In each case, one agent
2191 takes the role of "master", and delegates requests to one of the others
2192 as and where this is appropriate. The differences between them mainly
2193 relate to how data is represented, and the mechanisms for communication
2194 between master and subagents.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00002195
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002196 SMUX and proxy SNMP both essentially use the standard SNMP packet format.
2197 The main difference is that a proxy SNMP subagent need not be aware that
2198 it is acting in such a role. It typically listens on a non-standard port,
Dave Shield5a33a462009-06-15 15:25:06 +00002199 and simply receives requests as usual, forwarded from the master agent
2200 (rather than directly). The main issue to be aware of is that such requests
2201 will appear to come from the local host, and this may affect how the access
2202 control mechanisms need to be set up.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00002203
Wes Hardaker51d88c72000-11-30 18:31:56 +00002204 SMUX uses a similar packet format, but the subagent "registers" with
Dave Shieldbae701f2003-10-29 10:59:23 +00002205 the master agent, providing a suitable password. The Net-SNMP (and UCD)
2206 agent includes the possibility of acting as a SMUX master agent, but the
Dave Shield5a33a462009-06-15 15:25:06 +00002207 suite does not include a subagent API. Note that support for SMUX is not
2208 included by default, and needs to be explicitly enabled by running:
2209
2210 --with-mib-modules=smux
2211
2212 before re-compiling the agent.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002213 See the file 'agent/mibgroup/README.smux' for details.
2214
2215 AgentX uses a more compact (and simpler) packet format, with a richer
2216 range of administrative commands, and provides a more flexible and reliable
Dave Shieldbae701f2003-10-29 10:59:23 +00002217 extension mechanism. The Net-SNMP agent can be used in both master and
2218 subagent roles, and the agent library can also be used to embed an AgentX
2219 subagent within another application.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002220 See the file 'README.agentx' for details.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002221
Dave Shield80489f92006-11-24 13:41:23 +00002222 AgentX support is included by default, but needs to be explicitly
2223 activated in the master agent. Do this by adding the line
Wes Hardaker9743e9f2001-10-11 21:01:50 +00002224
2225 master agentx
2226
Dave Shield80489f92006-11-24 13:41:23 +00002227 to the snmpd.conf file before starting the agent.
Dave Shield5da154e2002-03-12 16:35:01 +00002228
2229
2230
Dave Shield5a33a462009-06-15 15:25:06 +00002231What is the purpose of 'dlmod'?
2232------------------------------
Dave Shield5da154e2002-03-12 16:35:01 +00002233
Dave Shield5a33a462009-06-15 15:25:06 +00002234 Most of the MIB information supplied by the Net-SNMP agent is provided
2235 by C-coded implementation modules, and the choice of which modules to
2236 include is usually made when the agent is first built. Adding new
Dave Shield80489f92006-11-24 13:41:23 +00002237 MIB modules would therefore require re-compiling the agent. This is
2238 not always convenient - particularly when working with a production
2239 system, and/or pre-installed binaries.
2240
Dave Shield5da154e2002-03-12 16:35:01 +00002241 Dynamically loaded modules are a means of including a MIB implementation
2242 module within the main SNMP agent (or an AgentX subagent) without needing
2243 to re-compile and re-link the agent binary. Instead, details of the
2244 module(s) to load are specified in the configuration file, and the agent
2245 locates the files listed, and merges them in at run time.
2246
Wes Hardaker56bf9592002-05-11 00:09:02 +00002247 See http://www.net-snmp.org/tutorial-5/toolkit/dlmod/ for more information.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002248
Wes Hardaker0540f281999-03-06 01:08:21 +00002249
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00002250
Dave Shield5a33a462009-06-15 15:25:06 +00002251Which extension mechanism should I use?
2252--------------------------------------
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002253
Dave Shield80489f92006-11-24 13:41:23 +00002254 That's not easy to answer in general.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002255
Dave Shield80489f92006-11-24 13:41:23 +00002256 If there's an existing agent that already implements the desired new
2257 MIB, then it makes sense to re-use that, via whatever extension protocol
Dave Shield5a33a462009-06-15 15:25:06 +00002258 that agent might support. Note that the SMUX protocol has essentially
2259 been superceded by AgentX, which provides a fuller and more reliable
2260 mechanism than either SMUX or proxied SNMP. So ideally, this would
2261 be the preferred extension approach.
Dave Shield80489f92006-11-24 13:41:23 +00002262 But if the target subagent only supports SMUX or basic SNMP, then that
2263 would dictate the extension protocol to use.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002264
Dave Shield5a33a462009-06-15 15:25:06 +00002265 Implementing the module in C within the main agent (directly or via
2266 dlmod) is probably the most efficient and reliable, closely followed
2267 by embedded perl (or python) extensions. These have the advantage of
2268 minimal overheads between the code implementing the MIB module, and
2269 the agent framework, and no inter-process communication issues. But
2270 this does assume that there's a suitable mechanism for retrieving the
2271 necessary information.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002272
Dave Shield80489f92006-11-24 13:41:23 +00002273 If the new MIB is monitoring or managing some other subsystem, external
2274 to the agent, then it may be necessary to embed a subagent within the
2275 subsystem itself - particularly if there's no suitable public API to
2276 retrieve the necessary information. In this case, AgentX is probably
2277 the most appropriate way forward.
Dave Shield5a33a462009-06-15 15:25:06 +00002278 Alternatively, you could implement the missing public management API
2279 for that subsystem, and develop a module within the main agent instead.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002280
2281
2282
Dave Shield74164ed2003-01-10 13:31:00 +00002283Can I use AgentX when running under Windows?
2284-------------------------------------------
2285
2286 Yes, but there are a couple of things to be aware of.
2287
2288 Firstly, by default the AgentX master listens on the Unix domain
2289 socket '/var/agentx/master', which doesn't work under Windows.
2290 You'll need to tell it to listen on a TCP port, either by using
2291 the command-line option "-x localhost:705", or by adding the
Wes Hardaker35874072004-09-29 21:23:48 +00002292 directive "agentxSocket localhost:705" to the snmpd.conf file.
Dave Shield74164ed2003-01-10 13:31:00 +00002293
2294 Secondly, be aware that the security of AgentX connectivity is not
2295 particularly strong. The examples given here would allow any process
2296 running on the local machine to register as an AgentX subagent. The
Wes Hardaker35874072004-09-29 21:23:48 +00002297 more obvious settings "-x 705" or "agentxSocket 705" would allow
Dave Shield74164ed2003-01-10 13:31:00 +00002298 a system *anywhere* on the network (or even from remote networks) to
2299 register as an AgentX subagent. This could potentially be used to
2300 hijack the agent, or provide false information.
2301
2302
2303
Dave Shield28c29aa2003-02-04 14:25:43 +00002304How can I run AgentX with a different socket address?
2305----------------------------------------------------
2306
2307 There are two sides to an AgentX connection, and they need to
2308 agree about which socket address to use. So if you want to use
Dave Shield80489f92006-11-24 13:41:23 +00002309 a different socket, you need to configure both parties accordingly.
Dave Shield28c29aa2003-02-04 14:25:43 +00002310
Dave Shield80489f92006-11-24 13:41:23 +00002311 The socket that the Net-SNMP master agent uses to listen for AgentX
2312 registrations (and send appropriate requests) can be specified using
2313 the option '-x'.
2314 The command
Dave Shield5a33a462009-06-15 15:25:06 +00002315 "snmpd -x tcp:localhost:705 ...."
Dave Shieldb9563bd2003-02-05 11:25:27 +00002316 would start the agent listening on the TCP port 705 for connections
Dave Shield80489f92006-11-24 13:41:23 +00002317 from the local system.
2318 The same effect can also be obtained by adding the line
Dave Shielda8e43f52004-11-09 16:12:38 +00002319 agentxsocket localhost:705
Dave Shield80489f92006-11-24 13:41:23 +00002320 to the file 'snmpd.conf'.
Dave Shield28c29aa2003-02-04 14:25:43 +00002321
Dave Shield80489f92006-11-24 13:41:23 +00002322 The same option can be used with the Net-SNMP agent when running in
Dave Shield5a33a462009-06-15 15:25:06 +00002323 This also holds when the Net-SNMP agent is running in
Dave Shield80489f92006-11-24 13:41:23 +00002324 "subagent" mode, to specify the socket to register with (and receive
2325 requests from).
2326 So a subagent might connect to the master agent above (both running
2327 on the same host), using:
Dave Shield5a33a462009-06-15 15:25:06 +00002328 "snmpd -X -x tcp:localhost:705 ...."
Dave Shield28c29aa2003-02-04 14:25:43 +00002329
2330 A subagent running embedded within some other application will
Dave Shield80489f92006-11-24 13:41:23 +00002331 typically not understand the same command-line options, so would
2332 need to set the same configuration programmatically:
2333
Dave Shield28c29aa2003-02-04 14:25:43 +00002334 netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
Dave Shield5a33a462009-06-15 15:25:06 +00002335 NETSNMP_DS_AGENT_X_SOCKET, "tcp:localhost:705");
Dave Shield80489f92006-11-24 13:41:23 +00002336
2337 With the example subagent code from the Net-SNMP tutorial, this line
2338 would be added immediately before the 'init_agent' call.
Dave Shield28c29aa2003-02-04 14:25:43 +00002339
Dave Shielda8e43f52004-11-09 16:12:38 +00002340 The same approach can also be used to listen on a different named
2341 socket, using:
2342 agentxsocket /tmp/agentx
Dave Shield13c14522006-12-29 17:25:33 +00002343 agentxperms 770 770 myuser mygroup
Dave Shielda8e43f52004-11-09 16:12:38 +00002344 or
2345 snmpd -x /tmp/agentx ....
2346 or
2347 netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
2348 NETSNMP_DS_AGENT_X_SOCKET, "/tmp/agentx");
2349 as appropriate.
Dave Shield28c29aa2003-02-04 14:25:43 +00002350
2351
2352
Dave Shielda8e43f52004-11-09 16:12:38 +00002353How can I turn off SMUX support?
2354-------------------------------
2355
Dave Shield80489f92006-11-24 13:41:23 +00002356 Normally, you would use the command-line option '-I -{module}' to
2357 disable the initialisation of a particular MIB module within the
2358 agent. Unfortunately, it's not currently possible to turn off SMUX
2359 support this way.
2360
Dave Shield5a33a462009-06-15 15:25:06 +00002361 The safest approach is to run
2362 configure --with-out-mib-modules=smux
2363 and recompile the agent.
Dave Shielda8e43f52004-11-09 16:12:38 +00002364
Dave Shield5a33a462009-06-15 15:25:06 +00002365 If this is not possible, an alternative workaround might be to have
2366 the agent bind the SMUX socket to an invalid IP address, using a
2367 snmpd.conf line such as:
Dave Shielda8e43f52004-11-09 16:12:38 +00002368
2369 smuxsocket 1.0.0.0
2370
Dave Shield5a33a462009-06-15 15:25:06 +00002371 The agent may complain at startup, but it won't accept any incoming
2372 SMUX requests.
Dave Shielda8e43f52004-11-09 16:12:38 +00002373
2374 If the agent complains about not recognising the "smuxsocket"
2375 token, then you're out of luck. You'll either have to recompile
2376 from source, or use local firewall rules to block connections
2377 to port 199.
2378
2379
2380
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002381How can I combine two copies of the 'mib2' tree from separate subagents?
2382-----------------------------------------------------------------------
2383
Dave Shield80489f92006-11-24 13:41:23 +00002384 This is the purpose of the SNMPv3 'context' field. Register the MIB
2385 module a second time in a non-default context (see the relevant entry
2386 in the CODING section for details), and specify this context when
2387 querying the agent. The MIB module can use this context information
2388 to determine which set of information to report.
2389 Or you could register two completely different handlers for the same
2390 OID (using different contexts), and the agent will invoke the appropriate
2391 code. This holds for both MIB modules implemented within the main agent,
2392 or AgentX subagents - the same approach will work for both.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002393
Dave Shield80489f92006-11-24 13:41:23 +00002394 Contexts can also be used with proxied SNMP requests - just specify
2395 the option '-Cn {context}' as part of the "proxy" entry. See the
2396 'snmpd.conf(5)' man page for details.
2397
2398 It's currently not possible to support parallel MIB trees when using
2399 SNMPv1 or SNMPv2c. In principle, it should be possible to use the
2400 community string in a similar way, but this has not (yet) been implemented.
2401
2402 This mechanism is only available with the v5 Net-SNMP agent. The v4
2403 UCD agent does not support contexts at all. Sorry about that.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002404
Dave Shield5da154e2002-03-12 16:35:01 +00002405 Another way to handle this would be to tweak one of the subagents to
2406 use a different set of (non-standard) OID assignments - perhaps by
2407 relocating the whole of the subtree to another (private) OID. This
2408 is not ideal, but should work with all configurations.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002409
2410
2411
Wes Hardakeree047991997-03-18 15:52:34 +00002412What traps are sent by the agent?
2413--------------------------------
2414
Dave Shield5a33a462009-06-15 15:25:06 +00002415 The Net-SNMP agent sends a 'coldStart(0)' trap when it first starts up,
2416 and an enterprise-specific trap 'nsNotifyShutdown' when it stops. It
2417 generates an enterprise-specific trap 'nsNotifyRestart' (rather than
2418 the standard 'coldStart(0)' or 'warmStart(1)' traps) on receiving a HUP
2419 signal - typically after being re-configured. It can also be configured
2420 to send an 'authenticationFailure(4)' trap when it receives an SNMPv1
2421 (or SNMPv2c) request using an unknown community name.
Wes Hardakerb922f281997-10-20 18:45:58 +00002422
Dave Shield13c14522006-12-29 17:25:33 +00002423 The agent does not send 'linkUp' or 'linkDown' traps by default. It can
2424 be configured to do this using the directive 'linkUpDownNotifications'.
2425 See the 'snmpd.conf(5)' man page (under ACTIVE MONITORING) for details.
Dave Shieldbae701f2003-10-29 10:59:23 +00002426
2427 Similarly, it does not generate traps by default when one of the
2428 monitored characteristics (disk usage, running processes, etc) enters or
2429 leaves an error state. This can be configured using the 'defaultMonitors'
Dave Shield13c14522006-12-29 17:25:33 +00002430 directive (again documented under ACTIVE MONITORING).
Dave Shield80489f92006-11-24 13:41:23 +00002431
Dave Shieldbae701f2003-10-29 10:59:23 +00002432
2433
2434Where are these traps sent to?
2435-----------------------------
Dave Shieldceab78b1999-08-09 08:02:15 +00002436
Dave Shield80489f92006-11-24 13:41:23 +00002437 With all these alerts, the agent needs to be told where to send them,
2438 specifying the type of notification (v1 or v2 trap, or v2 inform) and
2439 the community name to use. This uses the snmpd.conf directives 'trapsink',
2440 'trap2sink' and 'informsink' for the destination type, and 'trapcommunity'
2441 for the community name. SNMPv3 destinations can be configured using the
2442 directive 'trapsess'. See the 'snmpd.conf(5)' man page for details.
Dave Shieldbae701f2003-10-29 10:59:23 +00002443
Dave Shield80489f92006-11-24 13:41:23 +00002444 Note that the type of trap generated is totally determined by these
2445 directives - irrespective of which API call was used to trigger sending
2446 the trap. See the trap-related entries in the CODING section for details.
Dave Shieldbae701f2003-10-29 10:59:23 +00002447
Dave Shield5a33a462009-06-15 15:25:06 +00002448 Note also that you typically only want *one* of the settings:
Dave Shieldbae701f2003-10-29 10:59:23 +00002449
2450 trapsink localhost
2451 trap2sink localhost
2452 informsink localhost
2453
Dave Shield5a33a462009-06-15 15:25:06 +00002454 Including two (or all three) of these lines in the snmpd.conf file will
2455 will result in multiple copies of every notifications being sent for
2456 each call to 'send_easy_trap()' (or 'send_v2trap()').
2457 This is probably not what was intended!
Wes Hardaker51d88c72000-11-30 18:31:56 +00002458
Wes Hardakeree047991997-03-18 15:52:34 +00002459
2460
Dave Shield634ffdc2002-03-28 23:23:25 +00002461How can I send a particular trap to selected destinations?
2462----------------------------------------------------------
2463
Dave Shield80489f92006-11-24 13:41:23 +00002464 This is not currently possible. All notifications will be sent to
2465 all configured destinations. The agent does not (currently) support
2466 notification filtering.
Dave Shield634ffdc2002-03-28 23:23:25 +00002467
Dave Shield80489f92006-11-24 13:41:23 +00002468 There is a preliminary implementation of the snmpNotifyFilterTable
2469 which is designed to allow this sort of selective trap direction.
2470 However this is not currently active. (The tables are present and
2471 can be manipulated and updated, but the information is not consulted)
Dave Shield13c14522006-12-29 17:25:33 +00002472 Documentation on how to use this mechanism will appear once the
Dave Shielde7842872002-05-29 09:17:05 +00002473 functionality is working properly.
2474
Dave Shield634ffdc2002-03-28 23:23:25 +00002475
2476
Wes Hardaker82ad1f91997-02-04 08:35:02 +00002477When I run the agent it runs and then quits without staying around. Why?
2478-----------------------------------------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002479
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002480 Firstly, are you certain that this is what is happening?
Wes Hardakerb922f281997-10-20 18:45:58 +00002481
Dave Shield5a33a462009-06-15 15:25:06 +00002482 The normal operation of the agent is to 'fork' itself into the background,
2483 detaching itself from the controlling terminal so that it will continue
2484 running even when you log out, and freeing the command line for subsequent
2485 use. This looks at first sight as if the agent has died, but using 'ps'
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002486 to show all processes should reveal that the agent is still running.
2487
Dave Shield5a33a462009-06-15 15:25:06 +00002488 To prevent this behaviour (such as when attempting to debug the agent),
2489 you can start it with the '-f' flag. This suppresses the fork, and the
2490 agent will run as a 'normal' command. It's also often useful to use the
2491 '-Le' (or '-L') flag, to log messages to stderr.
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002492
Wes Hardakerb922f281997-10-20 18:45:58 +00002493 On the other hand, if 'ps' shows that the agent is not running, then
2494 this is an error, and probably show that something went wrong in
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002495 starting the agent up. Check the agent log file for any error messages,
Dave Shield4746cba2004-04-14 09:28:21 +00002496 or run it with '-f -Le' and see what it reports.
Wes Hardakerb922f281997-10-20 18:45:58 +00002497
Dave Shield5a33a462009-06-15 15:25:06 +00002498 One possible cause might be an existing agent (or some other process)
Dave Shield4746cba2004-04-14 09:28:21 +00002499 that's already listening on the SNMP port. Trying to start a second
2500 agent will fail with an error about "opening the specified endpoint".
2501
2502 If you're starting the agent as a non-root user, then this may also
2503 fail with the very same error. By default, the agent (and trap handler)
2504 will attempt to listen on the standard SNMP port 161 (or 162 for the
2505 trap handler). These are defined as "privileged ports", and processes
2506 will need to be running as root in order to open them.
2507
2508 One way to tackle this is to start the agent as root, but use the -u
2509 option to switch to run as another user once the port has been opened.
2510 Alternatively, you can specify a different port to use instead.
2511 Anything greater than 1024 is available to non-root users. In this case,
2512 you'll also need to specify the same port when issuing client commands.
2513
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002514
2515
Dave Shield6f04d7b2003-01-09 16:55:35 +00002516After a while the agent stops responding, and starts eating CPU time. Why?
2517--------------------------------------------------------------------------
2518
Dave Shield80489f92006-11-24 13:41:23 +00002519 This is basically the same problem described in the APPLICATIONS
2520 section, in the entry
2521 The agent worked for a while, then stopped responding. Why?
Dave Shield6f04d7b2003-01-09 16:55:35 +00002522
Dave Shield80489f92006-11-24 13:41:23 +00002523 See that entry for details.
Dave Shield6f04d7b2003-01-09 16:55:35 +00002524
2525
2526
Wes Hardaker468df0b1998-05-14 15:21:55 +00002527How can I stop other people getting at my agent?
2528-----------------------------------------------
2529
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002530 Firstly, are you concerned with read access or write access?
Wes Hardaker468df0b1998-05-14 15:21:55 +00002531
Dave Shield5da154e2002-03-12 16:35:01 +00002532 As far as changing things on the agent is concerned, there is relatively
Dave Shield13c14522006-12-29 17:25:33 +00002533 little that can actually be altered (see the entry "Why can't I set
2534 any variables in the MIB?" above).
Wes Hardaker468df0b1998-05-14 15:21:55 +00002535
Dave Shieldceab78b1999-08-09 08:02:15 +00002536 If you are using the example config file, this is set up to allow
2537 read access from your local network, and write access only from the
2538 system itself (accessed as 'localhost'), both using the community name
2539 specified. You will need to set appropriate values for both NETWORK
2540 and COMMUNITY in this file before using it.
2541 This mechanism can also be used to control access much more precisely.
Dave Shield4746cba2004-04-14 09:28:21 +00002542 (see the next few questions for details)
Dave Shieldceab78b1999-08-09 08:02:15 +00002543
2544 Other options include:
2545 - Blocking access to port 161 from outside your organisation
Wes Hardaker468df0b1998-05-14 15:21:55 +00002546 (using filters on network routers)
Dave Shield4746cba2004-04-14 09:28:21 +00002547 - Using kernel-level network filtering on the system itself
2548 (such as IPTables)
Dave Shieldceab78b1999-08-09 08:02:15 +00002549 - Configuring TCP wrapper support ("--with-libwrap")
Wes Hardaker468df0b1998-05-14 15:21:55 +00002550 This uses the TCP 'libwrap' library (available separately)
2551 to allow/deny access via /etc/hosts.{allow,deny}
Wes Hardaker468df0b1998-05-14 15:21:55 +00002552
Wes Hardaker74c2e712000-12-01 22:36:54 +00002553 For strict security you should use only SNMPv3, which is the secure
Dave Shield4746cba2004-04-14 09:28:21 +00002554 form of the protocol. However, note that the agent access control
2555 mechanisms does not restrict SNMPv3 traffic by location - an SNMPv3
2556 request will be accepted or rejected based purely on the user
Dave Shield80489f92006-11-24 13:41:23 +00002557 authentication, irrespective of where it originated. Source-based
2558 restrictions on SNMPv3 requests would need to use one of the "external"
2559 mechanisms listed above.
Wes Hardaker74c2e712000-12-01 22:36:54 +00002560
Wes Hardaker468df0b1998-05-14 15:21:55 +00002561
2562
Wes Hardaker51d88c72000-11-30 18:31:56 +00002563How can I listen on just one particular interface?
2564-------------------------------------------------
2565
2566 Normally, the agent will bind to the specified port on all interfaces
Dave Shield80489f92006-11-24 13:41:23 +00002567 on the system, and accept requests received from any of them. However,
2568 if a particular port (or ports) is specified when the agent is first
2569 started, then it will only listen for requests on these particular
2570 ports.
2571 For example:
Dave Shield5da154e2002-03-12 16:35:01 +00002572 snmpd 127.0.0.1:161
Dave Shield80489f92006-11-24 13:41:23 +00002573
2574 would listen (on the standard port) on the loopback interface only, and:
2575
2576 snmpd 10.0.0.1:6161
2577
Dave Shield13c14522006-12-29 17:25:33 +00002578 would listen on port 6161, on the (internal network) interface with
Dave Shield80489f92006-11-24 13:41:23 +00002579 address 10.0.0.1. To listen on both of these interfaces (and no others)
2580 provide a list of all the desired addresses:
2581
Dave Shield5da154e2002-03-12 16:35:01 +00002582 snmpd 127.0.0.1:161 127.0.0.1:6161
2583
Dave Shield80489f92006-11-24 13:41:23 +00002584 The AgentX port option ('-x') works in much the same way.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002585
2586
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002587
Dave Shield5a33a462009-06-15 15:25:06 +00002588The agent is complaining about 'snmpd.conf'. Where is this?
2589-----------------------------------------------------------
2590
2591 It doesn't exist in the distribution as shipped. You need to
2592 create it to reflect your local requirement.
2593 To get started, you can either just create this file manually,
2594 or run snmpconf to help you create one. At the very least, you
2595 will need some form of access control configuration, if the agent
2596 is to be of any use whatsoever. This can be as simple as:
2597
2598 rocommunity public
2599
2600 See the snmpd.conf(5) manual page or relevant entries in this
2601 FAQ for further details.
2602
2603
2604
2605Why does the agent complain about 'no access control information'?
2606-----------------------------------------------------------------
2607
2608 Although an SNMP agent may support a wide range of management
2609 information, it is not necessarily appropriate to report the whole
2610 of this to every SNMP management station who asks for it. Some
2611 information may be sensitive, and should restricted to authorized
2612 administrators only. SNMP therefore includes mechanisms for
2613 controlling who has access to what information - both in terms of
2614 what can be seen, and (even more importantly) what can be changed.
2615
2616 By default, the Net-SNMP agent starts up with a completely empty
2617 access control configuration. This means that *no* SNMP request
2618 would be successful. It is necessary to explicitly configure
2619 suitable access control settings, based on who should be granted
2620 access in that particular environment.
2621
2622 If there are no access control entries configured (perhaps because
2623 no snmpd.conf configuration file has been loaded, or it contains no
2624 access control settings), then the agent will not respond to any
2625 SNMP requests whatsoever. This is almost certainly not what was
2626 intended, so the agent reports this situation.
2627
2628 See the next entry for how to configure access control settings.
2629
2630
2631
Wes Hardaker51d88c72000-11-30 18:31:56 +00002632How do I configure access control?
2633---------------------------------
2634
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002635 The simplest way is to use the configure directives:
2636
Dave Shield5da154e2002-03-12 16:35:01 +00002637 rocommunity public (for SNMPv1/2c)
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002638 rwcommunity private
Dave Shield5da154e2002-03-12 16:35:01 +00002639 or
2640 rouser user1 (for SNMPv3)
2641 rwuser user2
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002642
Dave Shield5da154e2002-03-12 16:35:01 +00002643 These specify the community names or security names to accept for
2644 read-only and read-write access to the whole of the supported MIB tree.
2645 (Obviously you should change these names to match your requirements -
2646 which is a particularly good idea in the case of 'rwcommunity'!)
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002647
Dave Shield80489f92006-11-24 13:41:23 +00002648 Note that you should *not* specify the same community name for both
2649 rocommunity and rwcommunity directives. The rwcommunity setting
2650 automatically provides read access, and having both lines (with the
2651 same community name) may result in unexpected behaviour.
2652 Only use both settings when specifying *different* community names.
Dave Shieldbae701f2003-10-29 10:59:23 +00002653 The same holds true for rouser and rwuser.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002654
Dave Shield13c14522006-12-29 17:25:33 +00002655 The two community directives can be restricted to only allow requests
Dave Shield80489f92006-11-24 13:41:23 +00002656 from particular sources, and all four can be restricted to a particular
2657 subtrees or (from v5.3) a named view. See 'snmpd.conf(5)' for details.
Dave Shieldbae701f2003-10-29 10:59:23 +00002658
Wes Hardakerfae82bb1998-10-10 06:20:25 +00002659
2660
Wes Hardaker51d88c72000-11-30 18:31:56 +00002661How do I configure SNMPv3 users?
2662-------------------------------
2663
Dave Shielda8e43f52004-11-09 16:12:38 +00002664 There are three ways to configure SNMPv3 users:
2665
Dave Shield5a33a462009-06-15 15:25:06 +00002666 1) Stop the agent, and add the line
Wes Hardaker51d88c72000-11-30 18:31:56 +00002667
2668 createUser {myUser} MD5 {myPassword} DES
2669
Dave Shield5a33a462009-06-15 15:25:06 +00002670 to the file /var/net-snmp/snmpd.conf (where {myUser} and
2671 {myPassword} are the appropriate values for username and password,
Dave Shielda8e43f52004-11-09 16:12:38 +00002672 _without_ the braces!). Then re-start the snmpd agent.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002673
Dave Shielda8e43f52004-11-09 16:12:38 +00002674 2) Stop the agent, run the command
2675
2676 net-snmp-config --create-snmpv3-user
2677
Dave Shield5a33a462009-06-15 15:25:06 +00002678 and follow the prompts given. This will create an entry
Dave Shieldab90a5e2006-11-24 11:21:53 +00002679 in the /var/net-snmp/snmpd.conf file similar to the above.
Dave Shielda8e43f52004-11-09 16:12:38 +00002680 Then re-start the snmpd agent.
2681
Dave Shield5a33a462009-06-15 15:25:06 +00002682 3) Make sure the agent is running, and will respond to an SNMPv3
2683 request (using an existing user with the desired authentication
2684 and privacy protocols). Then use the 'snmpusm' command to clone
2685 this template user, and change the password.
Dave Shielda8e43f52004-11-09 16:12:38 +00002686
2687
2688 See the access control entries above and the file 'README.snmpv3'
2689 for more details about how to use SNMPv3 users,
2690
2691 Note that simply having a 'rouser' or 'rwuser' line does *not*
Dave Shield5a33a462009-06-15 15:25:06 +00002692 automatically create the corresponding SNMPv3 user. You will need
2693 the above 'createUser' line (or an equivalent 'usmUser') as well.
Dave Shieldcc0375b2004-07-22 15:49:30 +00002694
Wes Hardaker51d88c72000-11-30 18:31:56 +00002695
2696
2697The 'createUser' line disappears when I start the agent. Why?
2698-------------------------------------------------------------
2699
Dave Shield5a33a462009-06-15 15:25:06 +00002700 This is deliberate.
2701
Dave Shield80489f92006-11-24 13:41:23 +00002702 The agent removes the (human-readable) 'createUser' directive, and
2703 replaces it with an equivalent 'usmUser' entry. This contains the
2704 same information, but in a form that's only meaningful internally.
2705 Not only is the passphrase no longer visible in the config file, it
Dave Shield5a33a462009-06-15 15:25:06 +00002706 has actually been converted to a key that is only valid on this
2707 particular system. If someone stole the configuration file, they
2708 could not use the information from the usmUser entry to access any
2709 of your other agents (even if the usernames and passwords were the same).
Wes Hardaker51d88c72000-11-30 18:31:56 +00002710
2711
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002712
Dave Shieldab90a5e2006-11-24 11:21:53 +00002713What's the difference between /var/net-snmp and /usr/local/share/snmp?
Wes Hardaker51d88c72000-11-30 18:31:56 +00002714---------------------------------------------------------------------
2715
Dave Shield80489f92006-11-24 13:41:23 +00002716 The /var/net-snmp location is primarily used for information set
2717 during the running of the agent, which needs to be persistent between
2718 one run of the agent and the next. Apart from "createUser" (see
2719 the previous entry), you shouldn't need to touch this file.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002720
Dave Shield80489f92006-11-24 13:41:23 +00002721 All other user-provided configuration should go in the traditional
2722 location (typically /usr/local/share/snmp/snmpd.conf or /etc/snmp).
Wes Hardaker51d88c72000-11-30 18:31:56 +00002723
2724
2725
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002726My new agent is ignoring the old snmpd.conf file. Why?
2727-----------------------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00002728
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002729 The most likely explanation is that the new version of the agent is
2730 looking in a different location than the previous one. This is commonly
Dave Shieldbae701f2003-10-29 10:59:23 +00002731 experienced when replacing a ready-installed version (e.g. from a vendor
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002732 distribution), with the current release installed from the source.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002733
Dave Shield5a33a462009-06-15 15:25:06 +00002734 Try moving the old config file to the new location, and restart the agent.
2735 If you're not sure where this should go, see the next entry.
2736
2737
2738
2739Where should the snmpd.conf file go?
2740-----------------------------------
2741
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002742 The default location for this file with the basic distribution is
2743 /usr/local/share/snmp/snmpd.conf (or PREFIX/share/snmp/snmpd.conf).
Dave Shield5da154e2002-03-12 16:35:01 +00002744 Ready-installed versions often look for the file as /etc/snmpd.conf,
Dave Shield5a33a462009-06-15 15:25:06 +00002745 or /etc/snmp/snmpd.conf.
Dave Shield5da154e2002-03-12 16:35:01 +00002746
Dave Shield5a33a462009-06-15 15:25:06 +00002747 If you are still not sure, try running the command
2748
2749 snmpd -f -Le -Dread_config 2>&1 | grep "config path"
2750
2751 The first line of output will display the list of locations where
2752 the agent is looking for configuration information.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002753
2754
2755
2756Why am I getting "Connection refused"?
2757-------------------------------------
2758
2759 This is actually nothing to do with the access control mechanism
2760 (though that's an understandable mistake). This is the result of
2761 the TCP wrapper mechanism using the files 'hosts.allow' and 'hosts.deny'
Dave Shield5da154e2002-03-12 16:35:01 +00002762 to control access to the service. Some distributions may come with
Dave Shielda8e43f52004-11-09 16:12:38 +00002763 this enabled automatically - otherwise you need to explicitly activate
Dave Shield5a33a462009-06-15 15:25:06 +00002764 this by running
2765 configure --with-libwrap
2766 and recompiling the agent.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002767
Dave Shielda8e43f52004-11-09 16:12:38 +00002768 If TCP wrappers are enabled, and both hosts.allow and hosts.deny are
2769 empty, then all requests will be rejected (with "Connection refused").
2770 The simplest way to avoid this problem and allow incoming requests is
2771 to add the line
Wes Hardaker51d88c72000-11-30 18:31:56 +00002772
2773 snmpd: ALL
2774
Dave Shield5a33a462009-06-15 15:25:06 +00002775 to the file /etc/hosts.allow. Be aware that doing this removes one
2776 level of protection and allows anyone to try and query your agent.
2777 The agent's own access control mechanisms can still be used to restrict
2778 what - if anything - they can see.
Dave Shield5da154e2002-03-12 16:35:01 +00002779
Dave Shielda8e43f52004-11-09 16:12:38 +00002780 If you do wish to use the TCP wrappers to restrict access, it's sensible
2781 to have an explicit entry:
2782
2783 snmpd: ALL
2784
2785 in the file /etc/hosts.deny, which makes it crystal clear that access
2786 to the SNMP agent has been denied. This mechanism can also be used to
2787 restrict access to specific management hosts, using a hosts.deny entry
2788 such as:
2789
2790 snmpd: ALL EXCEPT 127.
2791
2792 which will allow connections from localhost, and nothing else.
2793
Dave Shield5a33a462009-06-15 15:25:06 +00002794 Note that personal firewalls, such as the Linux iptables mechanism,
2795 may have a similar effect (though typically this won't be logged).
2796 See the earlier entry
Dave Shieldbae701f2003-10-29 10:59:23 +00002797 Requests always seem to timeout, and don't give me anything back. Why?
Wes Hardaker51d88c72000-11-30 18:31:56 +00002798
2799
2800
Dave Shield5a33a462009-06-15 15:25:06 +00002801Why can't I see values in the UCDavis 'proc' or 'disk' trees?
Wes Hardaker51d88c72000-11-30 18:31:56 +00002802------------------------------------------------------------------
Wes Hardaker82ad1f91997-02-04 08:35:02 +00002803
Dave Shield5a33a462009-06-15 15:25:06 +00002804 Both these trees are designed to report precisely those things that
2805 have been explicitly configured for monitoring. If there are no
2806 relevant configuration entries in the snmpd.conf file, then these
2807 tables will be empty. See the snmpd.conf manual page and the
2808 EXAMPLE.conf file for details on configuring the agent.
Wes Hardaker468df0b1998-05-14 15:21:55 +00002809
Wes Hardaker74c2e712000-12-01 22:36:54 +00002810 Optionally, run snmpconf -g monitoring to help you set up this
2811 section of the snmpd.conf file.
Wes Hardaker468df0b1998-05-14 15:21:55 +00002812
2813
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002814
Wes Hardaker51d88c72000-11-30 18:31:56 +00002815Why can't I see values in the UCDavis 'memory' or 'vmstat' trees?
2816----------------------------------------------------------------
Wes Hardaker6166b741999-02-03 06:00:13 +00002817
Dave Shield5a33a462009-06-15 15:25:06 +00002818 These trees do not need any explicit configuration, and should
2819 be present automatically.
2820
2821 However the C code necessary to implement these particular MIB
2822 modules are not supported on all operating systems. These trees
2823 will be omitted on any system for which there is no underlying
2824 code. Currently, they are only supported on Linux, HP-UX (memory
2825 only), Solaris, BSDi (vmstat on BSDi4 only), Dynix, FreeBSD, NetBSD
2826 and OpenBSD.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002827 If you want to help port it to other systems, let us know.
Wes Hardaker6166b741999-02-03 06:00:13 +00002828
Dave Shield5da154e2002-03-12 16:35:01 +00002829 Note that these subtrees only report the current usage when
Dave Shield80489f92006-11-24 13:41:23 +00002830 explicitly queried. They do *not* automatically generate traps
2831 when the usage strays outside the configured bounds.
Dave Shieldbae701f2003-10-29 10:59:23 +00002832 See the earlier FAQ entry
2833 What traps are sent by the agent?
Dave Shield5a33a462009-06-15 15:25:06 +00002834 or the snmpd.conf section on active monitoring, for more information.
Dave Shield5da154e2002-03-12 16:35:01 +00002835
Wes Hardakerff4e3521997-12-01 20:33:49 +00002836
Wes Hardaker468df0b1998-05-14 15:21:55 +00002837
Wes Hardaker51d88c72000-11-30 18:31:56 +00002838What do the CPU statistics mean - is this the load average?
2839----------------------------------------------------------
2840
Dave Shield80489f92006-11-24 13:41:23 +00002841 No. Unfortunately, the original definition of the various CPU
2842 statistics was a little vague. It referred to a "percentage",
2843 without specifying what period this should be calculated over.
2844 It was therefore implemented slightly differently on different
2845 architectures.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002846
Dave Shield80489f92006-11-24 13:41:23 +00002847 The 5.4 release has clarified the situation, and standardised on
2848 calculating these percentages over a minute. The relevant MIB
2849 descriptions have been updated to make the desired behaviour
2850 more explicit.
2851
2852 The Net-SNMP agent also includes "raw counters", which can be used
2853 to calculate the percentage usage over any desired period. This is
Dave Shield5da154e2002-03-12 16:35:01 +00002854 the "right" way to handle things in the SNMP model. The original
Dave Shield80489f92006-11-24 13:41:23 +00002855 percentage objects have been deprecated, and may possibly be removed
Dave Shield5da154e2002-03-12 16:35:01 +00002856 in a future release of the agent.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002857
2858 Note that this is different from the Unix load average, which is
2859 available via the loadTable, and is supported on all architectures.
2860
2861
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00002862
Wes Hardakerd0d19c12004-02-24 00:32:03 +00002863How do I get percentage CPU utilization using ssCpuRawIdle?
2864-----------------------------------------------------------
2865
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00002866 This one of the "raw counters" mentioned in the previous entry.
2867 You need to take two readings of this object and look at the
2868 difference between them. That difference divided by the total
2869 number of 'ticks' between the two readings (where one tick is
2870 probably 0.01 seconds) will give you the percentage utilization
2871 over that period.
2872
Wes Hardakerd0d19c12004-02-24 00:32:03 +00002873
Wes Hardaker51d88c72000-11-30 18:31:56 +00002874
2875What about multi-processor systems?
2876----------------------------------
2877
Dave Shieldb601a362006-11-24 14:02:33 +00002878 The CPU objects (both percentages and raw counters) were designed to
2879 monitor the overall CPU activity of a system, and typically reflect
2880 whatever the underlying operating system reports for the (single)
2881 CPU statistics information. How these are handled for a multi-CPU
Dave Shield5a33a462009-06-15 15:25:06 +00002882 system will differ from one O/S to another, and will need
Dave Shieldb601a362006-11-24 14:02:33 +00002883 to be investigated for each system individually.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002884
Dave Shieldb601a362006-11-24 14:02:33 +00002885 The htProcessorTable was designed to handle monitoring multi-CPU
2886 machines, but the Net-SNMP implementation has up to now treated
2887 most systems (with the honourable exception of Solaris, and more
2888 recently Linux) as implicitly single-CPU.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002889
Dave Shieldb601a362006-11-24 14:02:33 +00002890 With the 5.4 release, there is now a cleaner framework for reporting
2891 on multi-CPU equipment, and it is hoped that an increasing number
2892 of systems will be able to report suitable processor information.
2893 Also with the 5.4 release, for the first time the agent will report
2894 the hrProcessorLoad value properly, which should provide some simple
2895 per-CPU statistics.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002896
2897
2898
2899The speed/type of my network interfaces is wrong - how can I fix it?
2900-------------------------------------------------------------------
2901
2902 Some operating systems will provide a mechanism for determining
Dave Shield90059672004-07-16 16:08:50 +00002903 the speed and type of network interfaces, but many do not. In such
2904 cases, the agent attempts to guess the most appropriate values,
2905 usually based on the name of the interface.
2906
Dave Shieldb601a362006-11-24 14:02:33 +00002907 The snmpd.conf directive "interface" allows you to override these
2908 guessed values, and provide alternative values for the name, type
2909 and speed of a particular interface. This is particularly useful
2910 for fast-ethernet, or dial-up interfaces, where the speed cannot be
Wes Hardaker51d88c72000-11-30 18:31:56 +00002911 guessed from the name.
Dave Shield90059672004-07-16 16:08:50 +00002912
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002913 See the snmpd.conf(5) man page for details.
Wes Hardaker51d88c72000-11-30 18:31:56 +00002914
2915
2916
2917The interface statistics for my subinterfaces are all zero - why?
2918----------------------------------------------------------------
2919
2920 Unfortunately, most kernels that support multiple logical
2921 interfaces on a single physical interface, don't keep separate
2922 statistics for each of these. They simply report the overall
2923 statistics for the physical interface itself.
Dave Shield90059672004-07-16 16:08:50 +00002924
Wes Hardaker51d88c72000-11-30 18:31:56 +00002925 There's no easy way around this problem - the agent can only
Dave Shield5a33a462009-06-15 15:25:06 +00002926 report such information as is available. If the kernel doesn't
Wes Hardaker51d88c72000-11-30 18:31:56 +00002927 keep track of these figures, the agent can't report them.
Dave Shield90059672004-07-16 16:08:50 +00002928
Wes Hardaker51d88c72000-11-30 18:31:56 +00002929 Sorry!
2930
2931
Dave Shield4746cba2004-04-14 09:28:21 +00002932
2933Does the agent support the RMON-MIB?
2934-----------------------------------
2935
2936 Not really.
2937
2938 There is an "Rmon" code module included within the agent source
2939 code tree, but this is best thought of as a template for the
2940 RMON-MIB statistics groups, rather than a full implementation.
2941
2942 With most MIBs, the hardest part of implementing the MIB is often
2943 getting hold of the data to report. This is definitely true of the
2944 RMON-MIB, which relies on gathering (and analysing) a potentially
2945 large quantity of network traffic. The Rmon code distributed with
2946 the Net-SNMP agent code avoids this problem, by using random data.
2947
2948 Some of the functionality of the RMON-MIB, such as the alarm and
Dave Shield3a71bc82007-02-05 09:48:00 +00002949 event groups, has since been superseded by the work of the DisMan
Dave Shield4746cba2004-04-14 09:28:21 +00002950 IETF working group. The Net-SNMP agent does implement these (more
2951 general) MIB modules. But the statistics gathering aspects of
2952 the RMON-MIB are not readily available.
2953
2954 Note too that none of the core developers have any significant
2955 experience with this code, and the person who originally wrote it
2956 is no longer active on the mailing lists. So there's no point in
2957 asking on the lists whether these modules work or not. You've got
2958 the source - how badly do you need this functionality?
2959
2960
2961
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002962What does "klread: bad address" mean?
Wes Hardaker82ad1f91997-02-04 08:35:02 +00002963-------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002964
2965 This means that the agent was unable to extract some of the
2966 necessary information from the kernel structures. This is
2967 possibly due to:
2968 - either looking in the wrong place for kernel information
2969 (check the value of KERNEL_LOC)
2970 - an error in the implementation of part of the MIB tree
2971 for that architecture. Try and identify which
2972 OID is generating the error, and contact the
Wes Hardaker51d88c72000-11-30 18:31:56 +00002973 list 'net-snmp-coders@lists.sourceforge.net'
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002974 Remember to tell us what architecture you have!
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002975
Wes Hardaker82ad1f91997-02-04 08:35:02 +00002976
Wes Hardaker468df0b1998-05-14 15:21:55 +00002977
Wes Hardaker82ad1f91997-02-04 08:35:02 +00002978What does "nlist err: wombat not found" (or similar) mean?
2979----------------------------------------------------------
2980
2981 This means that the agent wasn't able to locate one of the
2982 kernel structures it was looking for. This may or may not
2983 be important - some systems provide alternative mechanisms
2984 for obtaining the necessary information - Solaris, for example,
Wes Hardakeree047991997-03-18 15:52:34 +00002985 can produce a whole slew of such messages, but still provide
Wes Hardaker82ad1f91997-02-04 08:35:02 +00002986 the correct information.
2987 This error only occurs if you have used the flag
2988 '--enable-debugging' as part of the initial configuration.
2989 Reconfigure the agent with '--disable-debugging' and these
Wes Hardaker6241ebf2001-04-06 19:12:28 +00002990 messages will disappear. (It won't fix the underlying problem,
2991 but at least you won't be nagged about it).
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002992
2993
Wes Hardaker468df0b1998-05-14 15:21:55 +00002994
Dave Shield5a33a462009-06-15 15:25:06 +00002995What does "Can't open /dev/kmem" mean?
2996-------------------------------------
Wes Hardaker34ac96d1997-01-29 11:11:04 +00002997
2998 This device is normally restricted to just being accessible by root
2999 (or possibly by a special group such as 'kmem' or 'sys'). The agent
3000 must be able to read this device to obtain the necessary information
3001 about the running system.
3002 Check that the agent was started by root, and is running with UID 0
Wes Hardaker51d88c72000-11-30 18:31:56 +00003003 (or suitable GID if appropriate). The agent will normally continue
3004 to run without this level of access permission, but won't be able to
3005 report values for many of the variables (particularly those relating
3006 to network statistics).
Wes Hardaker468df0b1998-05-14 15:21:55 +00003007
Wes Hardaker34ac96d1997-01-29 11:11:04 +00003008
3009
Wes Hardaker468df0b1998-05-14 15:21:55 +00003010The system uptime (sysUpTime) returned is wrong!
3011-----------------------------------------------
3012
3013 Oh no it's not.
3014 The defined meaning of 'sysUpTime' is
3015 "the time ... since the *network management*
3016 portion of the system was re-initialized."
3017
3018 In other words, when the snmp agent was started, not when the
3019 system itself last booted. This latter information is available
Dave Shieldb601a362006-11-24 14:02:33 +00003020 in the Host Resources MIB as "hrSystemUpTime.0"
Wes Hardaker468df0b1998-05-14 15:21:55 +00003021 Note that even if the full Host Resources is not supported on
Wes Hardaker51d88c72000-11-30 18:31:56 +00003022 your system, it's worth configuring in the system portion using
Wes Hardaker468df0b1998-05-14 15:21:55 +00003023
Wes Hardaker09ce9c01998-06-19 15:41:00 +00003024 '--with-mib-modules=host/hr_system'
Wes Hardaker468df0b1998-05-14 15:21:55 +00003025
Dave Shield13c14522006-12-29 17:25:33 +00003026 and recompiling. This particular group is reasonably likely to work,
3027 even if some of the other more architecture-specific groups don't.
Wes Hardaker468df0b1998-05-14 15:21:55 +00003028
Wes Hardaker468df0b1998-05-14 15:21:55 +00003029
Wes Hardaker468df0b1998-05-14 15:21:55 +00003030
Dave Shielda8e43f52004-11-09 16:12:38 +00003031Can the agent run multi-threaded?
3032--------------------------------
3033
3034 Short answer - no.
3035 Longer answer - not easily.
3036
3037 Net-SNMP within a single thread of an threaded application is fine,
3038 as long as *all* snmp code is kept within the same thread. This lets
3039 you add SNMP support to an existing threaded application.
3040
3041 If you are concerned with the time taken for to process requests for
3042 a particular agent, object or subtree, and you want the agent to
3043 continue to respond to other requests in the meantime, there are
3044 two options.
3045
3046 The first method is using AgentX sub-agents. If you have several
3047 tables, each implemented by a separate subagent, then a single
3048 request for entries from each of the tables will be processed
3049 in parallel (and the agent will continue to respond to other
3050 requests while it waits for the subagents to return the necessary
3051 information). But a request for several objects from the same
3052 table will be passed off to the relevant subagent, where it will
3053 (normally) be processed serially.
3054
3055 The second method is to use delegated requests + IPC to another
3056 process. If takes a long time to retrieve a value for a given object,
3057 then the object handler could do whatever necessary to start or
3058 communicate with another (non-SNMP) process/thread to actually
3059 retrieve the value, and mark the request as delegated.
3060 The main agent (or subagent) can then receive and process other
3061 requests while waiting for the delegated request to finish.
3062 Dealing with resource contention is all up to you.
3063
3064 All of this only applies to the GET family of requests. A SET
3065 request will block until all pending GET requests have finished,
3066 and then will not accept new requests until the SET is complete.
3067
3068 Adding full multi-thread support directly to the agent would be
3069 nice. We just need someone with time/money to do/sponsor the work.
3070
3071
3072
Dave Shield5a33a462009-06-15 15:25:06 +00003073Can I use AgentX (or an embedded SNMP agent) in a threaded application?
3074-----------------------------------------------------------------------
3075
3076 With care.
3077
3078 As mentioned in the earlier "thread-safe" FAQ entry, the Net-SNMP
3079 agent (including the AgentX subagent) has not been designed for
3080 threaded operation. In particular, it makes use of various global
3081 variables without attempting to protect them against simultaneous
3082 use. This means that it is *NOT* safe to have SNMP or AgentX
3083 related processing in two separate threads. This also applies to
3084 handling GET (and SET) processing in one thread, and generating traps
3085 in another. This is still vulnerable to the usual threading problems.
3086
3087 However, as long as *all* of the SNMP-related activity is limited
3088 to the one thread, then there should be no reason why this cannot
3089 safely communicate with other threads within the same application,
3090 using private (thread-safe) mechanisms.
3091
3092 But in terms of the Net-SNMP-provided code, the agent (and AgentX
3093 subagent) should *not* be regarded as thread-safe.
3094
3095
3096
Dave Shieldbae701f2003-10-29 10:59:23 +00003097COMPILING
3098=========
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00003099
Dave Shield9e214a62009-07-19 15:09:52 +00003100How do I control the environment used to compile the software?
3101-------------------------------------------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00003102
Dave Shield9e214a62009-07-19 15:09:52 +00003103 The basic mechanism for compiling the Net-SNMP project software is to
3104 run "configure", followed by "make" (to compile it), "make test" (to
3105 check that it's working properly) and then "make install" (to install
3106 the files into the correct locations - which typicalyl needs to be done
3107 as root.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00003108
Dave Shield9e214a62009-07-19 15:09:52 +00003109 The primary role of "configure" is to determines various aspects about
3110 the system that the software is being compiled on. However there are
3111 also a number of options to configure which can be used to control
3112 various aspects of the compilation environment.
3113
3114 The most common options are "--with-mib-modules" and "--with-out-mib-modules"
3115 which control the set of MIB module code files that are included within
3116 the agent binary. Adding or removing these modules will affect what MIB
3117 information the agent can return.
3118 See the entry "How do I add a MIB to the agent?" for more details.
3119
3120
3121 The configure script can also specify the compiler to use for compiling
3122 the source code (e.g. "configure --with-cc=cc"), the flags passed to
3123 this compiler (e.g. "configure --with-cflags=-g"), or to the linker
3124 (e.g. "configure --with-ldflags=-Bstatic"), and various other aspects of
3125 the build environment.
3126 Run "configure --help" for a full list.
Dave Shield43dcec82002-03-11 15:42:08 +00003127
Dave Shieldb313ef72002-02-01 09:50:59 +00003128
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00003129
Dave Shield9e214a62009-07-19 15:09:52 +00003130How do I control the environment used to compile the software under Windows?
3131---------------------------------------------------------------------------
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00003132
Dave Shield9e214a62009-07-19 15:09:52 +00003133 If you are compiling the project within the MinGW or Cygwin environments,
3134 then these use the same "configure" mechanism as Unix-based systems. See
3135 the previous entry for more information.
3136
3137 If you are compiling the project from within Visual Studio, then this does
3138 not use the standard configure mechanism. Instead, there is a separate
3139 "Configure" script within the 'win32' directory. This can be used enable
3140 or disable various aspects of the build environment, such as support for
3141 encryption or IPv6.
3142 Run "Configure --help" for more information
3143
3144 Note that this script does not include an equivalent of "--with-mib-modules"
3145 for extending the MIB information supported by the agent. Instead, this
3146 needs to be done by tweaking the build environment manually. See the file
3147 README.win32 for more details of this, and various other aspects of building
3148 the project on Windows systems.
3149
3150
3151
3152Why does the compilation complain about missing libraries?
3153---------------------------------------------------------
3154
3155 This has been seen in a number of guises over the years - most commonly
3156 on Linux systems (although the problem may also occur elsewhere). The
3157 underlying problem is that typical installation may not always include
3158 the full set of library links required for building the Net-SNMP software.
Wes Hardakerf13d1ce1999-03-05 18:21:25 +00003159
Dave Shield82783282006-11-24 14:23:57 +00003160 This problem can usually be fixed by installing the missing packages
3161 (typically the development version of a package that is already there).
Michael Slifcak703910c1999-08-23 21:02:51 +00003162
Dave Shield82783282006-11-24 14:23:57 +00003163 Examples of this that we have come across include:
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00003164
Wes Hardaker1763c162008-04-02 19:35:10 +00003165 -lelf elfutils-devel (later renamed to elfutils-libelf-devel)
Dave Shield82783282006-11-24 14:23:57 +00003166 -lbz2 bzip2-devel
3167 -lselinux libselinux-devel
3168 -lcrypto openssl/openssl-devel
3169 -lbeecrypt libbeecrypt/beecrypt/beecrypt-devel.
Michael Slifcak703910c1999-08-23 21:02:51 +00003170
Dave Shield82783282006-11-24 14:23:57 +00003171 These are the names of the RedHat/Fedora RPMs. Other distributions
3172 or O/S's may use different names, but the basic idea should be the
3173 same.
Wes Hardaker51d88c72000-11-30 18:31:56 +00003174
Dave Shieldc50b3682007-01-30 09:10:22 +00003175 If the compilation is complaining about a missing .so file, then an
3176 alternative quick fix is to add the missing symbolic link, using
Dave Shield82783282006-11-24 14:23:57 +00003177 something like:
3178 ln -s libelf.so.1 /usr/lib/libelf.so
Dave Shieldbae701f2003-10-29 10:59:23 +00003179
Dave Shield82783282006-11-24 14:23:57 +00003180 giving the appropriate generic library name from the error message,
3181 and the correct number for whichever version of this library you
3182 have installed.
Dave Shieldbae701f2003-10-29 10:59:23 +00003183
Dave Shieldc50b3682007-01-30 09:10:22 +00003184 If the compilation is complaining about a .la file, then you should
3185 install the relevant development package, as listed above.
3186
Dave Shieldbae701f2003-10-29 10:59:23 +00003187
3188
Dave Shield90059672004-07-16 16:08:50 +00003189How can I reduce the memory footprint?
3190--------------------------------------
3191
3192 In order to reduce the memory footprint (for instance, to
3193 embed the snmpd into a device), the following configure options
3194 could be used.
3195
3196 '--disable-debugging'
3197 This turns off the compilation of all debugging statements.
3198
3199 '--enable-mini-agent' '--with-out-mib-modules=examples/ucdDemoPublic'
3200 This creates an agent with just the essential MIB modules included.
3201 NOTE: If you need additional MIB modules, then simply add them
3202 using the option '--with-mib-modules=...' but this will of course
3203 increase the memory footprint.
3204
3205 '--with-transports=UDP'
3206 This option specifies the transport domains to include.
3207 For a simple standalone agent, just UDP should be sufficient.
3208 (Although the 'disman' and 'agentx' modules may require the
3209 Callback, TCP and/or Unix transport domains as well).
3210
3211 '--without-kmem-usage'
3212 This can be used in order to omit the code that operates on the
3213 /dev/kmem interface. Clearly, this option cannot be used when
3214 one of the configured MIB modules depends on it.
3215
3216 '--with-mibdirs=' and '--with-mibs='
3217 These options tell the agent not to load any MIB modules.
3218 This doesn't affect the size of libraries or application
3219 binaries, but will reduce the memory footprint during runtime.
3220
3221 '--disable-mib-loading'
3222 This can be used in order to omit the code that loads and
3223 parses the MIB files altogether. This will reduce both the
3224 runtime memory footprint, and the binary sizes.
3225
3226 Once the agent (snmpd) has been linked, you might also try running
3227 'strip snmpd' to remove un-necessary debug/symbol information.
3228
3229
3230
Dave Shielda8e43f52004-11-09 16:12:38 +00003231How can I reduce the installation footprint or speed up compilation?
3232-------------------------------------------------------------------
3233
Dave Shield13c14522006-12-29 17:25:33 +00003234 The following configure options may also be useful:
Dave Shielda8e43f52004-11-09 16:12:38 +00003235
3236 --disable-agent Do not build the agent (snmpd).
3237 --disable-applications Do not build the apps (snmpget, ...).
3238 --disable-manuals Do not install the manuals.
3239 --disable-scripts Do not install the scripts (mib2c, ...).
3240 --disable-mibs Do not install the mib files.
Dave Shield82783282006-11-24 14:23:57 +00003241 --disable-mib-loading Do not include code that parses and
3242 manipulates the mib files.
Dave Shielda8e43f52004-11-09 16:12:38 +00003243
3244
3245
Dave Shield9e214a62009-07-19 15:09:52 +00003246How can I compile the project for use on an embedded system?
3247-----------------------------------------------------------
3248
3249 Although this is definitely a Frequently Asked Question on the project
3250 mailing lists, it hasn't really been a Frequently _Answered_ Question.
3251 The basic problem is that none of the core development team have much
3252 involvement or experience with embedded systems. And although we have
3253 repeatedly put out a plea for implementation reports and advice, this
3254 has not so far been particularly successful. So the first thing to say
3255 is that the following suggestions should be treated with a greater than
3256 usual level of suspicion.
3257
3258 The second thing to say is that compiling the Net-SNMP project for use
3259 on an embedded system typically means compiling the *agent* (rather than
3260 the trap receiver, or command-line tools). So that is what this entry
3261 will concentrate on.
3262
3263 There are three main aspects to consider:
3264 - how to compile the code,
3265 - *what* code to compile, and
3266 - how to install the resulting agent binary.
3267
3268 The Net-SNMP project uses the standard "configure" mechanism, so the
3269 usual cross-compilation options are available - in particular "--host"
3270 and "--target". It is also possible to specify the compiler and linker
3271 to use ("--with-cc" and "--with-ld"), and any special flags to pass
3272 to them ("--with-cflags" and "--with-ldflags"). There shouldn't be
3273 anything particularly special about compiling the Net-SNMP code, so
3274 see the documentation for your target environment for more information.
3275 (And please let us know if there *is* anything special that should be
3276 mentioned here!)
3277
3278 If the aim is simply to generate an SNMP agent to run on the target
3279 system, it's probably not necessary to compile the command-line tools
3280 or trap receiver. The configure option "--disable-applications" will
3281 omit these elements. See the previous entry for other potentially
3282 relevant useful options.
3283
3284 Unfortunately, the SNMP agent (and in particular, the code for individual
3285 MIB modules) is the most system-specific part of the Net-SNMP software.
3286 It may prove necessary to disable particular MIB modules if they do not
3287 compile successfully, or attempt to use the wrong system-specific APIs.
3288 This can be done using the configure option "--with-out-mib-modules".
3289 Alternatively, the option "--enable-mini-agent" will omit all but the
3290 core MIB module code. Additional modules can then be added individually
3291 using "--with-mib-modules".
3292
3293 Further information about how to deal with problems with individual MIB
3294 modules is reliant on suitable reports being forthcoming from the wider
3295 Net-SNMP community. The ball is in your court!
3296
3297 Finally, installing the agent binary is _not_ simply a matter of copying
3298 the "snmpd" file onto the target system. The agent typically relies on
3299 a number of additional libraries (and possibly the presence of assorted
3300 MIB files, unless this has been explicitly omitted). It is normally
3301 necessary to run "make install", before copying the installed framework
3302 to the target system.
3303
3304 If the install destination needs to be different to the eventual location
3305 on the target system, this can be handled using the configure options
3306 "--prefix" (for the target location) and "--with-install-prefix" (for the
3307 temporary install location). Alternatively, this can be handled as part
3308 of the install command:
3309 make install prefix={target location} INSTALL_PREFIX={temp location}
3310
3311 Alternatively, if the agent is compiled with static linking (and no MIB
3312 files), then it may be possible to simply copy the agent binary across to
3313 the target system. See the next entry for details.
3314
3315
3316
Dave Shielda8e43f52004-11-09 16:12:38 +00003317How can I compile the project to use static linking?
3318---------------------------------------------------
3319
3320 For totally static net-snmp executables, use
3321 configure --with-ldflags=-Bstatic
3322
3323 To compile your application with static libraries (eg for easier
3324 debugging), and to link to a non-installed build directory, try the
3325 following Makefile fragment:
3326
3327 NETSNMPDIR=/usr/local/build/snmp/full-clean-cvs-V5-1-patches
3328 NETSNMPCONFIG=$(NETSNMPDIR)/net-snmp-config
3329
3330 NETSNMPBASECFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags)
3331 NETSNMPINCLUDES := $(shell $(NETSNMPCONFIG) --build-includes $(NETSNMPDIR))
3332 # base flags after build/src include, in case it has /usr/local/include
3333 NETSNMPCFLAGS=$(NETSNMPINCLUDES) $(NETSNMPBASECFLAGS)
3334
3335 NETSNMPBASELIBS := $(shell $(NETSNMPCONFIG) --base-agent-libs)
3336 NETSNMPEXTLIBS := $(shell $(NETSNMPCONFIG) --external-agent-libs)
3337 NETSNMPLIBDIRS := $(shell $(NETSNMPCONFIG) --build-lib-dirs $(NETSNMPDIR))
3338 NETSNMPLIBDEPS := $(shell $(NETSNMPCONFIG) --build-lib-deps $(NETSNMPDIR))
3339 LIB_DEPS=$(NETSNMPLIBDEPS)
3340 LIBS=$(NETSNMPLIBDIRS) -Wl,-Bstatic $(NETSNMPBASELIBS) -Wl,-Bdynamic $(NETSNMPEXTLIBS)
3341
3342 STRICT_FLAGS = -Wall -Wstrict-prototypes
3343 CFLAGS=-I. $(NETSNMPCFLAGS) $(STRICT_FLAGS)
3344
3345 This replaces the standard Makefile section, which will used installed
3346 libraries:
3347
3348 NETSNMPCONFIG=net-snmp-config
3349
3350 # uncomment this if you have GNU make
3351 #NETSNMPCFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags)
3352 #NETSNMPLIBS := $(shell $(NETSNMPCONFIG) --agent-libs)
3353 NETSNMPCFLAGS=`$(NETSNMPCONFIG) --base-cflags`
3354 NETSNMPLIBS=`$(NETSNMPCONFIG) --agent-libs`
3355
3356 LIBS=$(NETSNMPLIBS)
3357
3358
3359
Dave Shield9e214a62009-07-19 15:09:52 +00003360Why does 'make test' skip various tests?
3361---------------------------------------
Dave Shieldbae701f2003-10-29 10:59:23 +00003362
Dave Shield9e214a62009-07-19 15:09:52 +00003363 Some of the tests are only relevant to particular operating systems,
3364 or rely on specific areas of functionality. The test framework will
3365 check whether the relevant elements are available before running the
3366 relevant tests, and will skip them if these modules have been omitted
3367 from the build environment (or do not apply to the current system).
Dave Shieldbae701f2003-10-29 10:59:23 +00003368
Dave Shield9e214a62009-07-19 15:09:52 +00003369 One example of this are the tests T053agentv1trap, T054agentv2ctrap,
3370 T055agentv1mintrap, T056agentv2cmintrap and T113agentxtrap, which
3371 rely upon functionality from the NET-SNMP-EXAMPLES-MIB implementation.
3372 This module is not included in the default agent configuration, so the
3373 test framework will skip these tests.
3374 To include them, run
3375 "configure --with-mib-modules=examples/example"
3376 and re-compile.
Wes Hardakerd0d19c12004-02-24 00:32:03 +00003377
3378
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00003379
3380Why does 'make test' complain about a pid file?
3381-----------------------------------------------
Wes Hardakerd0d19c12004-02-24 00:32:03 +00003382
3383 Typically it says something like:
3384
3385 cat: cannot open /tmp/snmp-test-1-8694/*pid*
3386
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00003387 It's trying to tell you the port is blocked - typically because
3388 another copy of the agent is still running, left over from from a
3389 previous testing run.
3390
3391 If you type 'ps -ef' you should notice an orphaned process like:
Wes Hardakerd0d19c12004-02-24 00:32:03 +00003392
3393 snmpd -d -r -U -P /tmp/snmp-test-5-27295/snmpd.pid...
3394
3395 Kill this process.
3396
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00003397 This could be happening for several reasons including:
Wes Hardakerd0d19c12004-02-24 00:32:03 +00003398
3399 1. You are trying to do concurrent runs of 'make test'.
3400
Dave Shieldb9dfd6d2004-02-26 14:32:39 +00003401 2. On a slow machine, the agent might be taking too long to
3402 start up. Try changing the value of the variable SNMP_SLEEP
3403 in testing/RUNTESTS from 1 to something higher - say 3 or 5.
Wes Hardakerd0d19c12004-02-24 00:32:03 +00003404
3405
Dave Shieldbae701f2003-10-29 10:59:23 +00003406
3407CODING
3408======
3409
Wes Hardaker51d88c72000-11-30 18:31:56 +00003410How do I write C code to integrate with the agent?
3411-------------------------------------------------
3412
Dave Shield1a591e02006-11-24 16:09:51 +00003413 There are three main methods for integrating external C code
Dave Shield13c14522006-12-29 17:25:33 +00003414 within the agent. The code can be compiled directly into the
3415 agent itself, it can be loaded dynamically while the agent is
3416 running, or it can be compiled into a separate application
3417 (a "subagent") which communicates with the main master agent.
3418 All three approaches have been touched on elsewhere within this FAQ.
Wes Hardaker51d88c72000-11-30 18:31:56 +00003419
Dave Shield1a591e02006-11-24 16:09:51 +00003420 As far as the module code is concerned, all three mechanisms
3421 use exactly the same module API. So a module developed for use
3422 directly within the agent, could also be included within a subagent,
3423 or loaded dynamically with no (or minimal) code changes needed.
Wes Hardaker51d88c72000-11-30 18:31:56 +00003424
Dave Shield1a591e02006-11-24 16:09:51 +00003425 Most of this section is concerned with more detailed aspects
3426 of developing such code - including the 'mib2c' tool, which can
3427 handle generating a basic code framework for implementing a
3428 given set of MIB objects.
Wes Hardaker51d88c72000-11-30 18:31:56 +00003429
3430
3431
Dave Shield90059672004-07-16 16:08:50 +00003432How does the agent fetch the value of a MIB variable from the system?
3433--------------------------------------------------------------------
Wes Hardaker51d88c72000-11-30 18:31:56 +00003434
Dave Shield1a591e02006-11-24 16:09:51 +00003435 That's typically the hardest bit of implementing a new MIB module,
3436 and is the one thing that 'mib2c' can't help with. It very much
3437 depends on the MIB variable concerned (and often the underlying
3438 operating system as well).
Dave Shield90059672004-07-16 16:08:50 +00003439
Dave Shield1a591e02006-11-24 16:09:51 +00003440 Relatively few MIB modules are completely self-contained, with all
3441 the information held internally within the agent, and all updates
3442 being done via SNMP requests. Such MIB modules can be implemented
3443 fairly easily.
Dave Shield90059672004-07-16 16:08:50 +00003444
Dave Shield1a591e02006-11-24 16:09:51 +00003445 More commonly, the agent needs to provide an SNMP-based interface to
3446 information held elsewhere, perhaps in the operating system kernel or
3447 some other application. Handling this is much more complex - since
3448 a lot depends on what mechanisms are provided for retrieving (and
Dave Shield79269022009-07-20 19:24:09 +00003449 possibly updating) this information. The mib2c tool can generate code
3450 for processing SNMP requests, based on some internal cache of management
3451 information, but it cannot help with populating this cache with the
3452 underlying data. That is up to the MIB implementer.
Wes Hardaker51d88c72000-11-30 18:31:56 +00003453
Dave Shield1a591e02006-11-24 16:09:51 +00003454 See the existing MIB modules in the Net-SNMP source tree for various
3455 examples of assorted approaches to this task.
Dave Shield90059672004-07-16 16:08:50 +00003456
Wes Hardaker51d88c72000-11-30 18:31:56 +00003457
3458
Dave Shieldbae701f2003-10-29 10:59:23 +00003459Mib2c complains about a missing "mib reference" - what does this mean?
3460---------------------------------------------------------------------
3461
3462 This basically means that it hasn't loaded the MIB file containing
3463 the definition of the MIB subtree you're trying to implement. This
3464 might be because it hasn't been installed, the name is wrong, or
3465 (most likely), because it isn't in the default list. See the MIBS
Dave Shield79269022009-07-20 19:24:09 +00003466 section for more details, or the next entry for suitable invocations
3467 of 'mib2c'.
Dave Shieldbae701f2003-10-29 10:59:23 +00003468
3469
3470
3471Mib2c complains about not having a "valid OID" - what does this mean?
3472---------------------------------------------------------------------
3473
3474 This probably means that you gave it the name of a MIB file (or
3475 module), rather than the name of an object defined in that file.
3476 Mib2c expects the name of a 'root' object, and will generate a
3477 template for the sub-tree starting from there.
3478
3479 If you've got a file 'MY-MIB.txt', defining the MIB module
3480 'MY-MIB' which contains a subtree based on the object 'myMib',
3481 then you should invoke mib2c as
3482 "mib2c .... myMib"
3483 rather than
3484 "mib2c .... MY-MIB.txt"
3485 or "mib2c .... MY-MIB"
3486
3487 Note that you'll probably also have to add your MIB to the list of
3488 MIBs that are loaded automatically, in order for mib2c to recognise
3489 the name of this object. So the command would typically be
3490 "MIBS=+MY-MIB mib2c .... myMib"
3491 or "MIBS=ALL mib2c .... myMib"
3492
3493
3494
Dave Shield02138782005-11-15 10:28:50 +00003495Why doesn't mib2c like the MIB file I'm giving it?
Dave Shieldbae701f2003-10-29 10:59:23 +00003496-------------------------------------------------
3497
Dave Shield79269022009-07-20 19:24:09 +00003498 This is most likely the same problem as the previous entry. Mib2c
3499 takes the name of a MIB _object_, not the name of a file (or MIB
3500 module). Try using the name of the MODULE-IDENTITY definition.
Dave Shield90059672004-07-16 16:08:50 +00003501
3502 Another possibility is that the MIB may contain syntax errors.
3503 Try running it through 'snmptranslate' or a dedicated SMI
3504 validation tool (such as 'smilint' or the on-line interface at
3505 http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/)
Dave Shieldbae701f2003-10-29 10:59:23 +00003506
3507
3508
3509Mib2c ignores my MIB and generates a pair of 'mib-2' code files. Why?
3510---------------------------------------------------------------------
3511
Dave Shield79269022009-07-20 19:24:09 +00003512 This is usually a sign of the same problem as the previous entries,
3513 giving mib2c the name of the file containing the MIB (or of the MIB
Dave Shield90059672004-07-16 16:08:50 +00003514 itself), rather than an object within it.
3515
Dave Shield79269022009-07-20 19:24:09 +00003516 Earlier versions of mib2c didn't detect this situation, and merrily
3517 constructed a template for a default starting point of the mib-2 node.
Dave Shieldbae701f2003-10-29 10:59:23 +00003518
Dave Shield79269022009-07-20 19:24:09 +00003519 More recent versions complain about not having a valid OID instead.
Dave Shieldbae701f2003-10-29 10:59:23 +00003520
3521
3522
Dave Shield02138782005-11-15 10:28:50 +00003523What's the difference between the various mib2c configuration files?
3524-------------------------------------------------------------------
Dave Shieldbae701f2003-10-29 10:59:23 +00003525
Dave Shield1a591e02006-11-24 16:09:51 +00003526 Most of the mib2c config files are concerned with implementing
3527 MIB tables, and generate various alternative code templates.
3528 These basically fall into four distinct categories.
Dave Shieldbae701f2003-10-29 10:59:23 +00003529
Dave Shield02138782005-11-15 10:28:50 +00003530 'mib2c.raw-table.conf' is the lightest of the templates, and
3531 just provides a fairly basic table framework. Most of the work
3532 of implementing the table - detecting which row is required for a
3533 given request, retrieving or updating the relevant column values,
3534 and interacting with the underlying subsystem - are all left to
3535 the MIB programmer.
Dave Shieldbae701f2003-10-29 10:59:23 +00003536
Dave Shield02138782005-11-15 10:28:50 +00003537 The second group of templates - 'table_data', 'container' and
3538 'tdata' - all share the same basic model (although the internal
3539 details are rather different). The MIB implementer should define a
3540 data structure to represent a row of the table, and the helper then
3541 takes care of holding the table internally, as a collection of such
3542 per-row data structures. This includes identifying which row is
3543 required for a given request. Retrieving or updating the appropriate
3544 column value is left to the MIB programmer, although the generated
3545 framework includes most of the necessary code.
3546 Allied to this is a fourth "internal data" mib2c configuration
3547 file ('create-dataset') which handles the individual columns as
3548 well. This is the closest to a Plug-and-Play configuration, and
3549 the MIB implementer only needs to be concerned with any special
3550 processing, such as linking the table with the underlying subsystem.
Dave Shieldbae701f2003-10-29 10:59:23 +00003551
Dave Shield02138782005-11-15 10:28:50 +00003552 The third style of mib2c config assumes that the table data is
3553 held externally to the helper - either within the MIB module code
3554 itself, or in the external subsystem. The generated code framework
3555 includes routines to "iterate" through the rows of the table, with
3556 the iterator helper simply deciding which row is required for a
3557 particular request. Once again, the MIB programmer must handle
3558 retrieving or updating the appropriate column value, although the
3559 generated framework includes most of the necessary code.
3560 There is a variant of this config ('iterate_access') which works
3561 in basically the same way. However this tries to separate out the
3562 standard processing, from the code that needs to be amended by the
3563 programmer for retrieving and updating the individual column values.
Dave Shieldbae701f2003-10-29 10:59:23 +00003564
Dave Shield02138782005-11-15 10:28:50 +00003565 This is also the idea behind the final table-oriented mib2c config
3566 template - 'mib2c.mfd.conf' (or "MIBs for Dummies"). This is a much
3567 more flexible framework, which can be used with either internally
3568 held data, or iterating through an external representation. The
3569 distinguishing feature of this framework is that it separates out
3570 standard and table-specific processing, at a much finer level of
3571 detail than the others.
Dave Shieldbae701f2003-10-29 10:59:23 +00003572
Dave Shield1a591e02006-11-24 16:09:51 +00003573
Dave Shield02138782005-11-15 10:28:50 +00003574 The other mib2c config templates are concerned with implementing
3575 scalar objects ('scalar', 'int_watch'), code to generating traps
3576 ('notify'), and various specialised requirements. There is also a
3577 template ('old-api') to generate code suitable for the previous v4
3578 UCD agent - though this is not particularly complete or reliable.
3579 It's probably better to use a pure v4 mib2c environment (or switch
3580 wholeheartedly to the v5 style).
Dave Shieldbae701f2003-10-29 10:59:23 +00003581
3582
3583
Dave Shield1a591e02006-11-24 16:09:51 +00003584Which mib2c configuration file should I use?
3585-------------------------------------------
Dave Shield02138782005-11-15 10:28:50 +00003586
3587 The answer to that heavily depends on the characteristics of the
3588 MIB objects being implemented. Of the handler-based table frameworks,
3589 'tdata' is more appropriate for tables that can be stored (or a copy
3590 cached) within the agent itself, while 'iterate' is more relevant to
3591 reporting data from outside the agent.
3592 The raw interface is only suitable in very specific circumstances,
3593 so it's probably sensible to start with one of the other frameworks
3594 first, and only look at this if none of the alternatives seem to work.
3595
3596 The decision between the handler-based configs and MfD is more a
3597 matter of the style of programming to use. Most of the frameworks
3598 define a single handler routine to process an incoming request, so
3599 all of the code is listed together, with the MIB programmer inserting
3600 table-specific processing into this single block of code.
3601 The MfD provides a series of individual object-specific routines,
3602 each concerned with one very specific task, and hides as much as
3603 possible from the programmer.
3604
3605 If you like to understand the broad thrust of what's happening,
3606 then one of the handler-based approaches would be the best choice.
3607 If you prefer to concentrate on the nitty-gritty of a given table,
3608 and are happy to trust that the rest of the processing will work
3609 correctly, then the MfD framework would be more appropriate.
3610
3611 For implementing a group of scalar objects, then the choice is
3612 simple - use 'mib2c.scalar.conf'. Similarly, for generating traps
Dave Shield79269022009-07-20 19:24:09 +00003613 or informs, use 'mib2c.notify.conf'. But note that this only assists
3614 with the code to actually generate the trap. It does not address the
3615 issue of _when_ to send the trap. See the FAQ entry "How can I get
3616 the agent to generate a trap?" for more information.
Dave Shield02138782005-11-15 10:28:50 +00003617
3618
3619
3620How can I have mib2c generate code for both scalars and tables?
Dave Shieldbae701f2003-10-29 10:59:23 +00003621--------------------------------------------------------------
3622
Dave Shield02138782005-11-15 10:28:50 +00003623 This uses a very powerful tool called a "text editor" :-)
3624
Dave Shield79269022009-07-20 19:24:09 +00003625 The mib2c tool uses separate configuration files to generate code
3626 for scalar objects, and for tables. This means that it's not possible
3627 to automatically generate a single code file that supports both scalars
3628 and tables.
Dave Shieldbae701f2003-10-29 10:59:23 +00003629
Dave Shield02138782005-11-15 10:28:50 +00003630 Instead, the two code files need to be generated separately, and
Dave Shield79269022009-07-20 19:24:09 +00003631 then combined manually. This will typically mean copying the handler
3632 routines for the scalar object(s) into the table file, and adding the
3633 code to register these handler(s) to the table initialisation routine.
Dave Shieldbae701f2003-10-29 10:59:23 +00003634
3635
3636
Dave Shield79269022009-07-20 19:24:09 +00003637Are there any examples, or documentation for developing MIB modules?
3638-------------------------------------------------------------------
Dave Shieldbae701f2003-10-29 10:59:23 +00003639
Dave Shield1a591e02006-11-24 16:09:51 +00003640 Many of the MIB modules shipped with the Net-SNMP agent still
3641 use the v4 "traditional" MIB module API, but an increasing number
3642 use one of the newer v5 helper-based handlers. All of these can
3643 be found under 'agent/mibgroup'
Dave Shieldbae701f2003-10-29 10:59:23 +00003644
Dave Shield1a591e02006-11-24 16:09:51 +00003645 The 'tdata' helper is used in the new DisMan Event, Expression
3646 and Schedule MIB modules (see 'disman/{event,expr,schedule}/*').
3647 The similar 'dataset' helper is used in the older DisMan Event
3648 MIB implementation (see 'disman/mteEvent*') and the Notification
3649 Log MIB (see 'notification-log-mib/*'), used by 'snmptrapd' to
3650 log incoming traps.
3651
Dave Shield79269022009-07-20 19:24:09 +00003652 The basic iterator handler is used in the TCP and UDP table
3653 implementations (mibII/tcpTable & mibII/udpTable), VACM context
3654 handling (mibII/vacm_context) and various tables relating to agent
3655 internals (agent/*). These show a number of different approaches
3656 to using the iterator helper, so it's worth comparing them.
Dave Shieldbae701f2003-10-29 10:59:23 +00003657
3658 The two examples/netSnmpHostsTable* modules provide a contrast
3659 between the iterator and iterator_access helpers.
3660
Dave Shield79269022009-07-20 19:24:09 +00003661 There are several examples based on the MfD framework (see
3662 '{if,ip,tcp,udp}-mib/'). Much of this code is not intended to
3663 be viewed directly, but individual files are clearly commented
3664 to distinguish between internal implementation and public code.
Dave Shield1a591e02006-11-24 16:09:51 +00003665
Dave Shieldbae701f2003-10-29 10:59:23 +00003666 The Net-SNMP agent does not currently include any MIB modules
3667 using the array-user container-based helper. The best examples
3668 of this are to be found in the net-policy project.
3669 See http://net-policy.sourceforge.net/
3670
3671
3672
Wes Hardaker6241ebf2001-04-06 19:12:28 +00003673Where should I put the files produced by 'mib2c'?
3674------------------------------------------------
3675
3676 If you're using the main source tree to compile your new module, then
3677 put these two files (mymib.[ch]) in the directory 'agent/mibgroup'.
3678 You should then re-run configure to add in your new module
Dave Shield79269022009-07-20 19:24:09 +00003679 configure --with-mib-modules=mymib
3680 and recompile.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00003681
3682 If you've got a number of new modules to add, it might be
3683 sensible to put them all into a single subdirectory of 'mibgroup'.
3684 Then create a header file, listing the individual components.
3685 This might look something like:
3686
3687 config_require(mymib/myObjects)
3688 config_require(mymib/myTable)
3689 config_require(mymib/myOtherTable)
3690
3691 If this was saved as the file 'mymib.h', then the same configure
Dave Shield79269022009-07-20 19:24:09 +00003692 line given above, would pull in all three modules. See the current
3693 contents of 'agent/mibgroup' for examples of this. Note that the
3694 MfD framework will generate a similar grouping automatically.
Wes Hardaker6241ebf2001-04-06 19:12:28 +00003695
3696
3697
Dave Shield79269022009-07-20 19:24:09 +00003698Why doesn't my new MIB module report anything?
3699---------------------------------------------
Dave Shield90059672004-07-16 16:08:50 +00003700
Dave Shield79269022009-07-20 19:24:09 +00003701 There are probably four main reasons why a new MIB module isn't working.
3702 Either it hasn't been included in the running agent, the code is present
3703 but hasn't been initialised, the module has been initialised but the
3704 handler isn't being called, or there's a problem with the module code itself.
Dave Shield90059672004-07-16 16:08:50 +00003705
Dave Shield79269022009-07-20 19:24:09 +00003706 To check whether the code files are being compiled, the easiest approach is
3707 simply to look at the directory where the code is located. When the agent is
3708 compiled, this should produce .o files (and probably .lo files) corresponding
3709 to the C code files for this module. Alternatively, run 'nm' (or 'strings')
3710 on the MIB module library (libnetsnmpmibs), and look for the names of the
3711 initialisation routines or handlers (or the text of any messages displayed by
3712 the module code).
3713
3714 One other thing to check is whether you have multiple copies of the software
3715 installed on the system. This is a particular problem when compiling from
3716 source (to include your new module), without first removing any vendor-supplied
3717 version of the agent (which won't include this new code).
Dave Shield90059672004-07-16 16:08:50 +00003718
3719
Dave Shield79269022009-07-20 19:24:09 +00003720 Assuming that you have confirmed that the module code is present in the agent,
3721 the next step is to check whether the initialisation routine is being called
3722 to register the MIB objects. The simplest way to do this is to include a
3723 suitable debugging statement within the initialisation routine, and start
3724 the agent with the corresponding '-Dtoken'. Alternatively, try walking the
3725 nsModuleName column object, and look for mention of the new MIB module.
Dave Shield90059672004-07-16 16:08:50 +00003726
Dave Shield90059672004-07-16 16:08:50 +00003727
Dave Shield79269022009-07-20 19:24:09 +00003728 Assuming the module has been registered, the next step is to check whether
3729 the handler is being called, when the agent receives a suitable SNMP request.
3730 Again, the simplest way to do this is to include debugging statements within
3731 the handler routine, and start the agent with the corresponding '-Dtoken'.
3732 Then issue an "snmpget" request for an instance within the new MIB module.
3733 (This command is preferable to the usual "snmpwalk" command, as it is more
3734 closely focused on the MIB module in question).
Dave Shield90059672004-07-16 16:08:50 +00003735
Dave Shield79269022009-07-20 19:24:09 +00003736 If this indicates that the handler routine isn't being called, then there are
3737 two main likely causes. Firstly, check the access control settings. If these
3738 are configured to block access to this portion of the OID tree, then the MIB
3739 handler will never be called. Secondly, several of the table helpers are
3740 designed to know which rows of the table are valid, and will call the main
3741 MIB handler with information about the relevant row. If the requested row is
3742 not valid (or the table is empty), then the handler will not be called.
Dave Shield90059672004-07-16 16:08:50 +00003743
Dave Shield90059672004-07-16 16:08:50 +00003744
Dave Shield79269022009-07-20 19:24:09 +00003745 Finally, if the handler _is_ being called, but is still not returning any
3746 information, then the cause probably lies with your MIB module code. In which
3747 case, it's really up to you to find the problem and fix it! Either activate
3748 any debugging code that you have included within the handler routine, or run
3749 the agent under a source code debugger, and step through the handler processing.
3750 In either case, it's much easier to debug these problems when processing an
3751 "snmpget" request, rather than "snmpgetnext" or "snmpwalk".
Dave Shield90059672004-07-16 16:08:50 +00003752
Dave Shield79269022009-07-20 19:24:09 +00003753 Remember that 'mib2c' simply generates template code for your MIB module.
3754 It's up to you to fill in the details, to report the actual information from
3755 whatever underlying subsystem is being monitored. Mib2c cannot help with
3756 the semantics of the MIB module - it's purely there to provide an initial
3757 code framework, based on the _syntax_ of the MIB module objects.
Dave Shield90059672004-07-16 16:08:50 +00003758
3759
3760
Dave Shield90059672004-07-16 16:08:50 +00003761Why does the iterator call my get_{first,next} routines so often?
3762-----------------------------------------------------------------------
3763
3764 The first thing to realise is that the 'get_first' and 'get_next'
Dave Shield79269022009-07-20 19:24:09 +00003765 hook routines are concerned with processing a single SNMP request, not
Dave Shield90059672004-07-16 16:08:50 +00003766 with walking the whole table. A full "snmpwalk" command will typically
3767 involve a series of individual 'GetNext' requests, and every one of
3768 these will trigger a separate 'get_first/get_next/get_next/....' cycle.
3769
3770 It's usually more efficient to use 'snmptable' which will walk
3771 each column in parallel (as well as displaying the results in a
3772 more natural manner).
3773
3774 Secondly, the iterator helper was originally designed to handle
3775 unsorted data, so will look at every row of the internal table for
3776 each request. If the data is actually held in the correct order,
3777 then it's worth setting the NETSNMP_ITERATOR_FLAG_SORTED flag:
3778 iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
3779 iinfo->flags |= NETSNMP_ITERATOR_FLAG_SORTED;
3780 This will help the situation somewhat.
3781
3782 But the iterator helper is inherently a relatively inefficient
3783 mechanism, and it may be worth looking at one of the other helpers,
3784 particularly if the data will be held within the agent itself.
3785
3786
3787
Wes Hardaker00be2092000-12-01 17:10:30 +00003788How can I get the agent to generate a trap (or inform)?
3789------------------------------------------------------
3790
Dave Shield13c14522006-12-29 17:25:33 +00003791 There are two aspects to having the agent generate a trap -
3792 knowing *how* to do this, and knowing *when* to do so.
Dave Shield1a591e02006-11-24 16:09:51 +00003793
Dave Shield13c14522006-12-29 17:25:33 +00003794 Actually generating a trap is reasonably simple - just call one
3795 of the trap API routines ('send_easy_trap()' or 'send_v2trap()')
3796 with the relevant information (generic and specific trap values,
3797 or a varbind list respectively).
Wes Hardaker00be2092000-12-01 17:10:30 +00003798
Dave Shieldbae701f2003-10-29 10:59:23 +00003799 The 'mib2c.notify.conf' configuration file can be used to
3800 construct a suitable template routine for generating a trap,
3801 including building the variable list from the MIB trap
3802 definition. These variables can then be given suitable values,
Dave Shield13c14522006-12-29 17:25:33 +00003803 before invoking the 'send_v2trap()' call to actually send the trap.
Dave Shield1a591e02006-11-24 16:09:51 +00003804 See the 'snmp_trap_api(3)' man page for further details.
Dave Shieldbae701f2003-10-29 10:59:23 +00003805
3806 Note that these APIs are only available within the agent (or
3807 subagents), and are not available to stand-alone applications.
3808 The code for 'snmptrap' shows an approach to use in such a case.
3809
Dave Shield1a591e02006-11-24 16:09:51 +00003810
3811 Determining *when* to generate the trap (either directly or
Dave Shieldbae701f2003-10-29 10:59:23 +00003812 via the mib2c-generated routine) is often harder. If the trap
3813 is generated in response to some action within the agent, (e.g.
3814 as the result of a SET), then this isn't too much of a problem.
Wes Hardaker00be2092000-12-01 17:10:30 +00003815
3816 But if the trap is intended to report on a change of status
3817 (e.g. a network interface going up or down, or a disk filling up),
Dave Shield79269022009-07-20 19:24:09 +00003818 then actually detecting this is non-trivial. Unless the underlying
3819 system can signal this situation to the agent, then it's typically
3820 necessary to poll the value(s) on a regular basis, save the results
3821 and compare them with the new values the next time round.
Wes Hardaker00be2092000-12-01 17:10:30 +00003822
Dave Shield1a591e02006-11-24 16:09:51 +00003823 The simplest way to handle this is via the DisMan Event MIB,
3824 which is designed for exactly this purpose. As long as you can
Dave Shield79269022009-07-20 19:24:09 +00003825 specify a MIB object to monitor, and the value or thresholds
Dave Shield1a591e02006-11-24 16:09:51 +00003826 that should trigger a notification, then this module can check
3827 these values regularly, and automatically send a suitable trap
3828 when appropriate. See the 'snmpd.conf(5)' man page (under
3829 ACTIVE MONITORING) for details.
3830
3831 Otherwise, you'd need to use the routines documented in
3832 'snmp_alarm(3)' to regularly invoke a monitoring routine. This
Dave Shield79269022009-07-20 19:24:09 +00003833 would check the necessary conditions (which need not be MIB
Dave Shield13c14522006-12-29 17:25:33 +00003834 objects), and call the 'send_xxx_trap()' routine (as generated
3835 by 'mib2c.notify.conf') when appropriate.
Dave Shield90059672004-07-16 16:08:50 +00003836
3837
3838
Dave Shield79269022009-07-20 19:24:09 +00003839How can I get an AgentX sub-agent to generate a trap (or inform)?
3840----------------------------------------------------------------
3841
3842 This is done in exactly the same manner as with the main SNMP agent.
3843 Calling one of the routines described in 'snmp_trap_api(3)' will cause
3844 the AgentX sub-agent to send a notification to the master agent, which
3845 will then pass this on to the configured trap destination(s).
3846
3847 One of the original design aims of the Net-SNMP AgentX support was that
3848 the agent (or subagent) framework should be transparent to a MIB module
3849 implementer. The interface between the agent framework and a MIB module
3850 should be independent of the protocol used to receive the original request.
3851 So the exact same MIB module code could be used within a traditional
3852 SNMP-only agent, or an AgentX subagent, with no changes needed.
3853
3854 This also holds for sending traps.
3855
3856
3857
Dave Shield90059672004-07-16 16:08:50 +00003858How can I get the agent to send an SNMPv1 (or SNMPv2c) trap?
3859-----------------------------------------------------------
3860
3861 It doesn't make any difference whether you use the v1-style
Dave Shield13c14522006-12-29 17:25:33 +00003862 API call 'send_easy_trap()' or the v2-style 'send_v2trap()'.
3863 What matters is the directive(s) in the snmpd.conf file.
Dave Shield90059672004-07-16 16:08:50 +00003864
3865 If this file contains 'trapsink', then the agent will send
3866 an SNMPv1 trap. If this file contains 'trap2sink', then the
3867 agent will send an SNMPv2c trap. And if this file contains
3868 both, then the agent will send *two* copies of this trap.
3869
Dave Shield1a591e02006-11-24 16:09:51 +00003870 See the entry
3871 Where are these traps sent to?
3872 in the AGENT section for details.
3873
Dave Shield90059672004-07-16 16:08:50 +00003874
3875
3876How can I get the agent to include varbinds with an SNMPv1 trap?
3877---------------------------------------------------------------
3878
3879 There are two ways to do this. You can either use the
Dave Shield13c14522006-12-29 17:25:33 +00003880 'send_v2trap()' call and give a varbind list, starting with
Dave Shield90059672004-07-16 16:08:50 +00003881 the v2-equivalent of the SNMPv1 trap, followed by the
3882 additional varbinds.
3883
Dave Shield13c14522006-12-29 17:25:33 +00003884 Alternatively, you can use the API call 'send_trap_vars()'
Dave Shield90059672004-07-16 16:08:50 +00003885 which takes the same generic/specific trap values as
Dave Shield13c14522006-12-29 17:25:33 +00003886 'send_easy_trap()', plus the list of additional varbinds.
Dave Shield90059672004-07-16 16:08:50 +00003887
3888 In either case, you also need to have 'trapsink' in the
3889 snmpd.conf file. The resulting trap will be identical,
3890 whichever approach is used.
3891
3892
3893
3894How can I get the agent to send an SNMPv1 enterprise-specific trap?
3895------------------------------------------------------------------
3896
3897 There are two ways to do this. You can either use the
Dave Shield13c14522006-12-29 17:25:33 +00003898 'send_v2trap()' call and give a varbind list, starting
3899 with the v2-equivalent of the SNMPv1 trap, followed by the
Dave Shield90059672004-07-16 16:08:50 +00003900 additional varbinds.
3901
3902 Alternatively, you can use the (undocumented) API call
Dave Shield13c14522006-12-29 17:25:33 +00003903 'send_enterprise_trap_vars()' which takes the same parameters
3904 as 'send_trap_vars()', plus the enterprise OID to use (in the
Dave Shield90059672004-07-16 16:08:50 +00003905 usual name/length form). See the code file 'agent_trap.c'
3906
3907 In either case, you also need to have 'trapsink' in the
3908 snmpd.conf file. The resulting trap will be identical,
3909 whichever approach is used.
3910
3911
3912
3913How can I get the agent to send an SNMPv3 trap (or inform)?
3914----------------------------------------------------------
3915
3916 It doesn't matter which API call you use to specify the
Dave Shield13c14522006-12-29 17:25:33 +00003917 trap - 'send_easy_trap()', 'send_v2trap()' or one of the other
Dave Shield90059672004-07-16 16:08:50 +00003918 calls mentioned above. Generating an SNMPv3 notification
3919 (rather than a community-based one) is controlled by the
3920 snmpd.conf file.
Dave Shieldbae701f2003-10-29 10:59:23 +00003921
Dave Shield90059672004-07-16 16:08:50 +00003922 To send an SNMPv3 trap, this file should contain a
3923 'snmpsess' directive, specifying the version, security
3924 level, user name and passphrases (if applicable), as
3925 well as the destination address. This is basically
3926 the same as the command line required for sending the
3927 trap manually, using 'snmptrap'.
3928
3929 Note that (unlike 'snmptrap') this directive does *not*
3930 read default settings from an 'snmp.conf' file, so these
3931 must be specified explicitly in the 'snmpsess' line.
3932
3933
3934
3935Why does calling 'send_v2trap' generate an SNMPv1 trap (or vice versa)?
3936----------------------------------------------------------------------
3937
3938 The two versions of the trap API calls are concerned with how
3939 the trap is represented when it is passed *in* to the API, not
3940 the version of the trap PDU that will actually be generated by
3941 the agent. That is determined by the configuration token used
3942 to set up the trap destination.
3943
3944 Remember that in general, all traps are sent to all destinations.
3945 This means that a trap specified using the SNMPv1 trap syntax
3946 needs to be converted to the SNMPv2 format before it can be sent
3947 to an SNMPv2 (or SNMPv3) destination. Similarly, a trap specified
3948 using the SNMPv2 syntax needs to be converted to the SNMPv1 format
3949 before it can be sent to an SNMPv1 sink.
3950
3951 Essentially, the API call to use depends on what you asking for,
3952 which is not necessarily what the recipients will actually get!
3953 See 'snmp_trap_api(3)' for a fuller explanation.
3954
Wes Hardaker00be2092000-12-01 17:10:30 +00003955
3956
Dave Shield4746cba2004-04-14 09:28:21 +00003957How can I register a MIB module in a different (SNMPv3) context?
3958---------------------------------------------------------------
3959
3960 Contexts are a mechanism within SNMPv3 (and AgentX) whereby
3961 an agent can support parallel versions of the same MIB objects,
3962 referring to different underlying data sets. By default, a MIB
3963 module registrations will use the default empty context of "".
Dave Shield79269022009-07-20 19:24:09 +00003964 But it's also possible to provide MIB information using a different
3965 (non-default) context.
Dave Shield4746cba2004-04-14 09:28:21 +00003966
Dave Shield79269022009-07-20 19:24:09 +00003967 There are three aspects involved in doing this. Firsly, it's necessary
3968 to register the MIB module in this non-default context. With the v4 API,
3969 this uses the call 'register_mib_context()' rather than the REGISTER_MIB
3970 macro. This is significantly more detailed, but most of the additional
3971 parameters can take fixed values, if all that's needed is to change the
3972 registration context.
Dave Shield4746cba2004-04-14 09:28:21 +00003973
3974 Instead of the macro call:
3975 REGISTER_MIB("my_token", my_variables, variable1, my_variables_oid);
3976 use the function call:
3977 register_mib_context( "my_token",
3978 my_variables, sizeof(variable1),
3979 sizeof(my_variables)/sizeof(variable1),
3980 my_variables_oid,
3981 sizeof(my_variables_oid)/sizeof(oid),
3982 DEFAULT_MIB_PRIORITY, 0, 0, NULL,
3983 "my_context", -1, 0);
3984
3985 Things are much easier with the v5 helper-based API. Having
3986 created the registration structure, this just requires setting the
3987 'contextName' field before actually registering the MIB module:
3988 netsnmp_handler_registration *reg;
3989 reg = netsnmp_create_handler_registration(.....);
3990 reg->contextName = strdup("my_context");
3991 netsnmp_register_handler(reg);
3992
Dave Shield79269022009-07-20 19:24:09 +00003993
3994 Secondly, it is necessary to configure the access control settings to allow
3995 access to information in the new context. This is handled automatically
3996 when using the simple "rouser" or "rwuser" directives. But if access control
3997 is configured using the fuller com2sec/group/view/access mechanism, then the
3998 "access" line must specify the appropriate context(s), either explicitly:
Dave Shield4746cba2004-04-14 09:28:21 +00003999
4000 access {group} "my_context" any noauth exact ......
4001
Dave Shield79269022009-07-20 19:24:09 +00004002 or using a single entry to cover all possible contexts:
Dave Shield4746cba2004-04-14 09:28:21 +00004003
4004 access {group} "" any noauth prefix ......
4005
Dave Shield79269022009-07-20 19:24:09 +00004006
4007 Finally, the SNMP request used to retrieve (or update) the information
4008 must also specify the required context. With SNMPv3 requests, the context
4009 is part of the protocol, so this can be done using a command-line option:
4010
4011 snmpwalk -v 3 -n my_context .....
4012
4013 With community-based requests (SNMPv1 and SNMPv2c), things aren't so simple.
4014 Although the "rocommunity" and "rwcommunity" settings also configure access
4015 for all possible contexts, there's no way to specify a non-default context
4016 as part of the request.
4017
4018 The only way to handle non-default contexts with community-based SNMP requests
4019 is to set up a mapping from the community string to the desired context. This
4020 uses the "com2sec" directive, with an additional "-Cn" parameter. Note that
4021 this also means that the access control must be configured using the full
4022 com2sec/group/view/access mechanism. The short-form access control directives
4023 do not handle the mapping of community strings to non-default contexts.
Dave Shield4746cba2004-04-14 09:28:21 +00004024
4025
4026
Dave Shieldbae701f2003-10-29 10:59:23 +00004027MISC
4028======
Wes Hardaker51d88c72000-11-30 18:31:56 +00004029
Wes Hardaker51d88c72000-11-30 18:31:56 +00004030What ASN.1 parser is used?
4031-------------------------
4032
4033 The parser used by both the agent and client programs is coded by hand.
4034 This parser has recently been re-vamped to allow control of which of
4035 the available MIBs should be included, and to handle duplicate object
4036 subidentifiers.
4037 The source code can be found in the snmplib directory (in 'parse.c'),
Dave Shield13c14522006-12-29 17:25:33 +00004038 and the parser is usually bundled into the library 'libnetsnmp.a'
Wes Hardaker51d88c72000-11-30 18:31:56 +00004039
4040 Note that the parser attempts to be fairly forgiving of some common
Dave Shieldbae701f2003-10-29 10:59:23 +00004041 errors and incompatibilities in MIB files. The Net-SNMP tools accepting
4042 a MIB file without complaint does *not* imply that the MIB is strictly
Wes Hardaker51d88c72000-11-30 18:31:56 +00004043 correct.
Dave Shield5da154e2002-03-12 16:35:01 +00004044 Certain MIBs may need some amendments to allow them to be read
4045 correctly by the parser. Contact the coders' list for advice.
Wes Hardaker51d88c72000-11-30 18:31:56 +00004046
4047
4048
Dave Shieldbae701f2003-10-29 10:59:23 +00004049What is the Official Slogan of the net-snmp-coders list?
Wes Hardaker51d88c72000-11-30 18:31:56 +00004050-------------------------------------------------------
4051
4052 "The current implementation is non-obvious and may need to be improved."
4053 (with thanks to Rohit Dube)
4054
4055 And an alternate, added 26-Apr-2000:
4056
4057 "In theory, it shouldn't be that hard, but it just needs to be done."
4058
4059
Michael Slifcak703910c1999-08-23 21:02:51 +00004060