Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 1 | Frequently Asked Questions (FAQ) for the UCD/Net-SNMP package |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2 | ============================================================= |
Wes Hardaker | 7dcf086 | 1997-04-22 06:42:01 +0000 | [diff] [blame] | 3 | FAQ Author: Dave Shield |
Wes Hardaker | 18d116b | 2011-09-27 21:11:52 -0700 | [diff] [blame] | 4 | Net-SNMP Version: 5.7.1 |
Wes Hardaker | 4e175ac | 2009-09-23 23:36:01 +0000 | [diff] [blame] | 5 | Net-SNMP/UCD-SNMP Project Leader: Wes Hardaker |
Dave Shield | 43dcec8 | 2002-03-11 15:42:08 +0000 | [diff] [blame] | 6 | Email: net-snmp-coders@lists.sourceforge.net |
Wes Hardaker | 8acf73f | 1997-02-04 08:41:39 +0000 | [diff] [blame] | 7 | |
| 8 | TABLE 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 17 | What's the difference between UCD-SNMP and Net-SNMP? |
Wes Hardaker | 8acf73f | 1997-02-04 08:41:39 +0000 | [diff] [blame] | 18 | What operating systems does it run on? |
| 19 | What happens if mine isn't listed? |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 20 | Does it run on Windows? |
Wes Hardaker | 8acf73f | 1997-02-04 08:41:39 +0000 | [diff] [blame] | 21 | How do I find out about new releases? |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 22 | How can I find out what other people are doing? |
Wes Hardaker | 8acf73f | 1997-02-04 08:41:39 +0000 | [diff] [blame] | 23 | How do I submit a patch or bug report? |
Wes Hardaker | 00cdead | 2002-10-07 17:57:37 +0000 | [diff] [blame] | 24 | Can I reuse the code in my commercial application? |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 25 | What's the difference between SNMPv1, SNMPv2 and SNMPv3? |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 26 | What's the difference between SNMPv2 and SNMPv2c? |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 27 | Which versions of SNMP are supported in this package? |
Dave Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 28 | Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)? |
Dave Shield | 5b58b2f | 2009-07-21 09:15:07 +0000 | [diff] [blame] | 29 | How can I monitor my system with SNMP? |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 30 | Where can I find more information about network management? |
Dave Shield | 5b58b2f | 2009-07-21 09:15:07 +0000 | [diff] [blame] | 31 | What ports does SNMP use? |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 32 | Is Net-SNMP thread safe? |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 33 | APPLICATIONS |
Wes Hardaker | 8acf73f | 1997-02-04 08:41:39 +0000 | [diff] [blame] | 34 | How do I add a MIB? |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 35 | How do I add a MIB to the tools? |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 36 | Why can't I see anything from the agent? |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 37 | Why doesn't the agent respond? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 38 | I can see the system group, but nothing else. Why? |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 39 | Why can't I see values in the <ENTERPRISE> tree? |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 40 | The agent worked for a while, then stopped responding. Why? |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 41 | Requesting an object fails with "Unknown Object Identifier" Why? |
| 42 | Why do I get "noSuchName" when asking for "sysUpTime" (or similar)? |
Wes Hardaker | 3eb7caf | 1998-05-20 14:34:31 +0000 | [diff] [blame] | 43 | Why do I sometimes get "End of MIB" when walking a tree, and sometimes not? |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 44 | How do I use SNMPv3? |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 45 | Why can't I set any variables in the MIB? |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 46 | Variables seem to disappear when I try to set them. Why? |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 47 | Why can't I change sysLocation (or sysContact)? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 48 | I get an error when trying to set a negative value - why? |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 49 | I get an error when trying to query a string-indexed table value - why? |
| 50 | How should I specify string-indexed table values? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 51 | How do I send traps and notifications? |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 52 | How do I receive traps and notifications? |
| 53 | How do I receive SNMPv1 traps? |
| 54 | Why don't I receive incoming traps? |
Dave Shield | 679c10d | 2002-06-10 08:28:43 +0000 | [diff] [blame] | 55 | My traphandler script doesn't work when run like this - why not? |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 56 | How can the agent receive traps and notifications? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 57 | How big can an SNMP request (or reply) be? |
Wes Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 58 | How can I monitor my systems (disk, memory, etc)? |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 59 | Applications complain about entries in your example 'snmp.conf' file. Why? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 60 | OK, what should I put in snmp.conf? |
Dave Shield | 24569f7 | 2009-05-28 11:31:51 +0000 | [diff] [blame] | 61 | How do I specify IPv6 addresses in tools command line arguments? |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 62 | PERL |
Dave Shield | 5b58b2f | 2009-07-21 09:15:07 +0000 | [diff] [blame] | 63 | What is the purpose of the Perl SNMP module? |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 64 | Where can I get the Perl SNMP package? |
Dave Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 65 | How do I install the Perl SNMP modules? |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 66 | But compiling this fails! Why? |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 67 | Compiling the Perl module works OK, but 'make test' fails. Why? |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 68 | 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 Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 72 | I've got a problem with the Net-SNMP module. Can you help? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 73 | MIBS |
| 74 | Where can I find a MIB compiler? |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 75 | Why aren't my MIB files being read in? |
| 76 | Where should I put my MIB files? |
Dave Shield | 92e0151 | 2002-03-13 12:03:22 +0000 | [diff] [blame] | 77 | What does "Cannot find module (XXX-MIB)" mean? |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 78 | I'm getting answers, but they're all numbers. Why? |
| 79 | What does "unlinked OID" mean? |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 80 | The parser doesn't handle comments properly. Why not? |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 81 | How can I get more information about problems with MIB files? |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 82 | What's this about "too many imported symbols"? |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 83 | Do I actually need the MIB files? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 84 | AGENT |
| 85 | What MIBs are supported? |
| 86 | What protocols are supported? |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 87 | How do I configure the agent? |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 88 | How do I remove a MIB from the agent? |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 89 | I've installed a new MIB file. Why can't I query it? |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 90 | How do I add a MIB to the agent? |
| 91 | What's the difference between 'exec', 'sh', 'extend' and 'pass'? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 92 | What's the difference between AgentX, SMUX and proxied SNMP? |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 93 | What is the purpose of 'dlmod'? |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 94 | Which should I use? |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 95 | Can I use AgentX when running under Windows? |
Dave Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 96 | How can I run AgentX with a different socket address? |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 97 | How can I turn off SMUX support? |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 98 | How can I combine two copies of the 'mib2' tree from separate subagents? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 99 | What traps are sent by the agent? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 100 | Where are these traps sent to? |
Dave Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 101 | How can I send a particular trap to selected destinations? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 102 | When I run the agent it runs and then quits without staying around. Why? |
Dave Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 103 | After a while the agent stops responding, and starts eating CPU time. Why? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 104 | How can I stop other people getting at my agent? |
| 105 | How can I listen on just one particular interface? |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 106 | The agent is complaining about 'snmpd.conf'. Where is this? |
| 107 | Why does the agent complain about 'no access control information'? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 108 | How do I configure access control? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 109 | How do I configure SNMPv3 users? |
| 110 | The 'createUser' line disappears when I start the agent. Why? |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 111 | What's the difference between /var/net-snmp and /usr/local/share/snmp? |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 112 | My new agent is ignoring the old snmpd.conf file. Why? |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 113 | Where should the snmpd.conf file go? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 114 | Why am I getting "Connection refused"? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 115 | 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 Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 118 | How do I get percentage CPU utilization using ssCpuRawIdle? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 119 | 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 Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 122 | Does the agent support the RMON-MIB? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 123 | What does "klread: bad address" mean? |
| 124 | What does "nlist err: wombat not found" (or similar) mean? |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 125 | What does "Can't open /dev/kmem" mean? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 126 | The system uptime (sysUpTime) returned is wrong! |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 127 | Can the agent run multi-threaded? |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 128 | Can I use AgentX (or an embedded SNMP agent) in a threaded application? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 129 | COMPILING |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 130 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 133 | How can I reduce the memory footprint? |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 134 | How can I reduce the installation footprint or speed up compilation? |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 135 | How can I compile the project for use on an embedded system? |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 136 | How can I compile the project to use static linking? |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 137 | Why does 'make test' skip various tests? |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 138 | Why does 'make test' complain about a pid file? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 139 | CODING |
| 140 | How do I write C code to integrate with the agent? |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 141 | How does the agent fetch the value of a MIB variable from the system? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 142 | 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 Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 144 | Why doesn't mib2c like the MIB file I'm giving it? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 145 | Mib2c ignores my MIB and generates a pair of 'mib-2' code files. Why? |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 146 | What's the difference between the various mib2c configuration files? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 147 | Which mib2c configuration file should I use? |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 148 | How can I have mib2c generate code for both scalars and tables? |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 149 | Are there any examples, or documentation for developing MIB modules? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 150 | Where should I put the files produced by 'mib2c'? |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 151 | Why doesn't my new MIB module report anything? |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 152 | Why does the iterator call my get_{first,next} routines so often? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 153 | How can I get the agent to generate a trap (or inform)? |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 154 | How can I get an AgentX sub-agent to generate a trap (or inform)? |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 155 | 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 Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 160 | How can I register a MIB module in a different (SNMPv3) context? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 161 | MISC |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 162 | What ASN.1 parser is used? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 163 | What is the Official Slogan of the net-snmp-coders list? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 164 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 165 | |
| 166 | GENERAL |
| 167 | ======= |
| 168 | |
| 169 | What is it? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 170 | ---------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 171 | |
| 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 Hardaker | d4b0c91 | 1999-02-08 23:08:57 +0000 | [diff] [blame] | 180 | * a graphical Perl/Tk/SNMP based mib browser |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 181 | |
| 182 | This package is originally based on the Carnegie Mellon University |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 183 | SNMP implementation (version 2.1.2.1), but has developed significantly |
| 184 | since then. |
| 185 | |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 186 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 187 | |
| 188 | Where can I get it? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 189 | ------------------ |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 190 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 191 | Download: |
Wes Hardaker | 9743e9f | 2001-10-11 21:01:50 +0000 | [diff] [blame] | 192 | - http://www.net-snmp.org/download/ |
Wes Hardaker | b01738d | 2001-12-24 23:41:43 +0000 | [diff] [blame] | 193 | - ftp://ftp.net-snmp.org/pub/sourceforge/net-snmp/ |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 194 | Web page: |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 195 | - http://www.net-snmp.org/ |
| 196 | Sourceforge Project page: |
Wes Hardaker | 9743e9f | 2001-10-11 21:01:50 +0000 | [diff] [blame] | 197 | - http://www.net-snmp.org/project/ |
Wes Hardaker | d243395 | 2002-10-08 22:55:48 +0000 | [diff] [blame] | 198 | Mirrors (note that sourceforge download servers are mirrored themselves): |
Dave Shield | 43dcec8 | 2002-03-11 15:42:08 +0000 | [diff] [blame] | 199 | - US: ftp://ftp.freesnmp.com/mirrors/net-snmp/ |
Wes Hardaker | f8a3281 | 2003-11-24 17:38:18 +0000 | [diff] [blame] | 200 | - Greece: ftp://ftp.ntua.gr/pub/net/snmp/net-snmp/ |
Wes Hardaker | dc8282f | 1998-06-08 17:50:12 +0000 | [diff] [blame] | 201 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 202 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 203 | What documentation is available? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 204 | ------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 205 | |
| 206 | This FAQ (!) |
Wes Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 207 | README and individual READMEs for various platforms |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 208 | README.thread (discusses threading issues) |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 209 | INSTALL |
| 210 | PORTING |
| 211 | EXAMPLE.conf |
| 212 | man pages for the individual tools, files and the API |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 213 | A guide for extending the agent |
Dave Shield | 754ec23 | 2002-05-29 09:42:26 +0000 | [diff] [blame] | 214 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 217 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 218 | Most of this documentation (plus archives of the mailing lists) |
| 219 | is also available on our web page: |
| 220 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 221 | http://www.net-snmp.org/ |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 222 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 223 | 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 Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 228 | |
| 229 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 230 | Are there binaries available? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 231 | ---------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 232 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 233 | There are binaries for some versions/systems available under |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 234 | 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 Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 242 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 243 | |
| 244 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 245 | What's the difference between UCD-SNMP and Net-SNMP? |
| 246 | --------------------------------------------------- |
Wes Hardaker | f54dd3a | 1999-01-20 20:20:08 +0000 | [diff] [blame] | 247 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 248 | 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 Hardaker | 07ba34d | 2000-04-25 20:08:39 +0000 | [diff] [blame] | 252 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 253 | The move to SourceForge was intended to provide a more flexible |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 254 | 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 Hardaker | f54dd3a | 1999-01-20 20:20:08 +0000 | [diff] [blame] | 257 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 258 | 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 Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 262 | code line is now effectively closed down, as are the older 5.x branches. |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 263 | |
| 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 Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 268 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 270 | restructuring of the header file organisation - not least a change |
| 271 | from <ucd-snmp/xxx.h> to <net-snmp/yyy.h>. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 272 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 273 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 276 | |
Wes Hardaker | d4b0c91 | 1999-02-08 23:08:57 +0000 | [diff] [blame] | 277 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 278 | What operating systems does it run on? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 279 | ------------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 280 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 281 | Both the applications and the agent have been reported as running |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 282 | (at least in part) on the following operating systems: |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 283 | |
Thomas Anders | 71b9400 | 2005-12-27 21:45:30 +0000 | [diff] [blame] | 284 | * Linux (kernels 2.6 to 1.3) |
Thomas Anders | f042d99 | 2005-10-07 20:38:13 +0000 | [diff] [blame] | 285 | * Solaris/SPARC (11 to 2.3), Solaris/Intel (10, 9) -- see |
Thomas Anders | c3c9ddd | 2005-07-26 10:22:31 +0000 | [diff] [blame] | 286 | README.solaris |
Thomas Anders | 9d099b5 | 2008-08-22 23:47:42 +0000 | [diff] [blame] | 287 | * HP-UX (11.31 to 9.01) -- see README.hpux11 |
| 288 | * Mac OS X (10.5 to 10.1) -- see README.osX |
Thomas Anders | f042d99 | 2005-10-07 20:38:13 +0000 | [diff] [blame] | 289 | * NetBSD (2.0 to 1.0) |
Thomas Anders | 9d099b5 | 2008-08-22 23:47:42 +0000 | [diff] [blame] | 290 | * FreeBSD (7.0 to 2.2) |
Thomas Anders | e895b9d | 2006-09-27 16:51:37 +0000 | [diff] [blame] | 291 | * OpenBSD (4.0 to 2.6) |
Thomas Anders | 71b9400 | 2005-12-27 21:45:30 +0000 | [diff] [blame] | 292 | * BSDi (4.0.1 to 2.1) |
Thomas Anders | 9d099b5 | 2008-08-22 23:47:42 +0000 | [diff] [blame] | 293 | * AIX (6.1, 5.3, 5.2, 5.1, 4.3.3, 4.1.5, 3.2.5) -- see README.aix |
Thomas Anders | f042d99 | 2005-10-07 20:38:13 +0000 | [diff] [blame] | 294 | * IRIX (6.5 to 5.1) |
Thomas Anders | 9d099b5 | 2008-08-22 23:47:42 +0000 | [diff] [blame] | 295 | * OSF (4.0, 3.2 and Tru64 Unix 5.1B) -- see README.tru64 |
Thomas Anders | 71b9400 | 2005-12-27 21:45:30 +0000 | [diff] [blame] | 296 | * SunOS 4 (4.1.4 to 4.1.2) |
| 297 | * Ultrix (4.5 to 4.2) |
Dave Shield | 43dcec8 | 2002-03-11 15:42:08 +0000 | [diff] [blame] | 298 | * Dynix/PTX 4.4 |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 299 | * QNX 6.2.1A |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 300 | |
Dave Shield | 597ee89 | 2003-01-03 13:05:14 +0000 | [diff] [blame] | 301 | 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 304 | See the next question but one for the status of Windows support. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 305 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 306 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 309 | See the next question for more details. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 310 | |
| 311 | Also note that the presence of a particular configuration in this |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 312 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 316 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 317 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 318 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 319 | What happens if mine isn't listed? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 320 | --------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 321 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 322 | 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 Slifcak | e72b6a9 | 2000-03-07 18:13:41 +0000 | [diff] [blame] | 328 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 329 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 334 | minimal agent compiles and runs successfully, try adding each of |
| 335 | the missing mibgroups individually using the configure option |
| 336 | '--with-mib-module'. |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 337 | |
| 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 341 | 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 Hardaker | 09ce9c0 | 1998-06-19 15:41:00 +0000 | [diff] [blame] | 346 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 347 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 348 | |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 349 | Does it run on Windows? |
| 350 | ---------------------- |
| 351 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 352 | The suite should compile and run on Win32 platforms, including |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 353 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 357 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 358 | Pre-compiled binaries are available from the project web site. |
Alex Burger | 7e46e52 | 2006-12-17 16:51:40 +0000 | [diff] [blame] | 359 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 360 | 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 Burger | 7e46e52 | 2006-12-17 16:51:40 +0000 | [diff] [blame] | 362 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 363 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 366 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 367 | Further details of Windows support (currently Visual C++, MinGW |
Alex Burger | 7e46e52 | 2006-12-17 16:51:40 +0000 | [diff] [blame] | 368 | and Cygnus cygwin32) is available in the file README.win32. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 369 | |
| 370 | |
| 371 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 372 | How do I find out about new releases? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 373 | ------------------------------------ |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 374 | |
| 375 | There is a mailing list for these announcements |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 376 | |
| 377 | net-snmp-announce@lists.sourceforge.net |
| 378 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 379 | To be added to (or removed from) this list, visit |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 380 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 384 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 385 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 393 | |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 394 | Patches to fix known problems are also made available via the web site: |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 395 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 396 | http://www.net-snmp.org/patches/ |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 397 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 398 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 399 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 400 | How can I find out what other people are doing? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 401 | ---------------------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 402 | |
| 403 | There is a general purpose discussion list |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 404 | |
| 405 | net-snmp-users@lists.sourceforge.net |
| 406 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 407 | To be added to (or removed from) this list, visit |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 408 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 411 | with a subject line of 'subscribe' (or 'unsubscribe' as appropriate). |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 412 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 413 | To find out what the developers are doing, and to help them |
| 414 | out, please read the PORTING file enclosed with the package. |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 415 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 416 | 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 Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 422 | |
| 423 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 424 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 425 | How do I submit a patch or bug report? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 426 | ------------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 427 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 428 | The best way to submit a bug report is via the bug database through |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 429 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 434 | |
Wes Hardaker | 15ddba0 | 2001-12-05 16:28:59 +0000 | [diff] [blame] | 435 | Questions about using the package should be directed at the |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 436 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 440 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 441 | - 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 449 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 450 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 454 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 455 | 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 Hardaker | f2df8a2 | 2011-06-28 08:29:08 -0700 | [diff] [blame] | 462 | 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 Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 464 | |
Wes Hardaker | af8b235 | 2011-06-28 13:11:19 -0700 | [diff] [blame] | 465 | (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 Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 468 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 471 | |
| 472 | |
Wes Hardaker | 00cdead | 2002-10-07 17:57:37 +0000 | [diff] [blame] | 473 | Can I reuse the code in my commercial application? |
| 474 | ------------------------------------------------- |
| 475 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 476 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 481 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 482 | |
| 483 | What's the difference between SNMPv1, SNMPv2 and SNMPv3? |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 484 | ------------------------------------------------------- |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 485 | What's the difference between SNMPv2 and SNMPv2c? |
| 486 | ------------------------------------------------ |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 487 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 488 | A full description is probably beyond the scope of this FAQ. |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 489 | Very briefly, the original protocol and admin framework was |
| 490 | described in RFCs 1155-1157, and is now known as SNMPv1. |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 491 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 492 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 495 | achieve any sort of agreement - particularly over the details of |
| 496 | the administrative framework to use. |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 497 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 498 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 508 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 509 | Strictly speaking, it's this revised protocol (originally defined |
| 510 | in RFC 1905, and most recently in RFC 3416) that is "SNMPv2". |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 511 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 512 | The only framework based on this protocol that saw a significant |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 513 | level of use was "Community-based SNMPv2" or "SNMPv2c" (defined |
| 514 | in RFC 1901). This retained the same administrative framework |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 515 | as SNMPv1 (with all of the accompanying limitations), but using |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 516 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 535 | |
| 536 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 537 | 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 Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 542 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 543 | |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 544 | |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 545 | Which versions of SNMP are supported in this package? |
| 546 | ---------------------------------------------------- |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 547 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 548 | This package currently supports the original SNMPv1 (RFC 1157), |
| 549 | Community-based SNMPv2 (RFCs 1901-1908), and SNMPv3 (RFCs 3411-3418). |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 550 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 554 | Support for SNMPv2 classic (a.k.a. "SNMPv2 historic" - RFCs 1441-1452) |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 555 | was dropped with the 4.0 release of the UCD-snmp package. |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 556 | |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 557 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 558 | |
Dave Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 559 | Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)? |
| 560 | ------------------------------------------------------------ |
| 561 | |
| 562 | Yes. |
| 563 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 564 | 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 Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 571 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 572 | 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 Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 575 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 576 | Note that SMIv1 is effectively obsolete, and all new MIBs |
| 577 | should be written using SMIv2. |
| 578 | |
Dave Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 579 | |
| 580 | |
Dave Shield | 5b58b2f | 2009-07-21 09:15:07 +0000 | [diff] [blame] | 581 | How 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 605 | Where can I find more information about network management? |
| 606 | ---------------------------------------------------------- |
Wes Hardaker | 3e1ced6 | 1997-02-10 08:22:03 +0000 | [diff] [blame] | 607 | |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 608 | There are a number of sites with network management information on |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 609 | the World Wide Web. Some of the most useful are |
Wes Hardaker | 3e1ced6 | 1997-02-10 08:22:03 +0000 | [diff] [blame] | 610 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 611 | http://www.simpleweb.org/ |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 612 | http://www.snmplink.org/ |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 613 | http://www.mibdepot.com/ |
Wes Hardaker | 3e1ced6 | 1997-02-10 08:22:03 +0000 | [diff] [blame] | 614 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 615 | 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 Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 619 | This is available from |
Wes Hardaker | 3e1ced6 | 1997-02-10 08:22:03 +0000 | [diff] [blame] | 620 | |
| 621 | ftp://rtfm.mit.edu/pub/usenet/comp.protocols.snmp/ |
| 622 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 623 | or via any of the Web sites above. |
| 624 | |
Wes Hardaker | 3e1ced6 | 1997-02-10 08:22:03 +0000 | [diff] [blame] | 625 | |
| 626 | |
Dave Shield | 5b58b2f | 2009-07-21 09:15:07 +0000 | [diff] [blame] | 627 | What 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 643 | Is Net-SNMP thread safe? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 644 | ----------------------- |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 645 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 646 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 650 | |
| 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 661 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 662 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 665 | generating traps, and parsing MIBs) is handled within a single thread. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 666 | |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 667 | 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 Hardaker | 37527b2 | 2004-12-22 18:37:49 +0000 | [diff] [blame] | 673 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 677 | |
| 678 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 679 | APPLICATIONS |
| 680 | ============ |
| 681 | |
| 682 | How 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 | |
| 691 | How do I add a MIB to the tools? |
| 692 | ------------------------------- |
| 693 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 694 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 703 | There are two steps required to add a new MIB file to the tools. |
Dave Shield | 009ee12 | 2009-05-27 15:26:02 +0000 | [diff] [blame] | 704 | Firstly, copy the MIB file into the appropriate location: |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 705 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 706 | cp MY-MIB.txt /usr/local/share/snmp/mibs |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 707 | (which makes it available to everyone on the system) |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 708 | or |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 709 | mkdir $HOME/.snmp |
| 710 | mkdir $HOME/.snmp/mibs |
| 711 | cp MY-MIB.txt $HOME/.snmp/mibs |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 712 | (which makes it available to you only) |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 713 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 714 | Note that the location of the shared MIB directory may be different |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 715 | from that given here - see the FAQ entry "Where should I put my MIB |
| 716 | files?" for more information. |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 717 | |
| 718 | |
| 719 | Secondly, tell the tools to load this MIB: |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 720 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 721 | snmpwalk -m +MY-MIB ..... |
| 722 | (load it for this command only) |
| 723 | or |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 724 | export MIBS=+MY-MIB |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 725 | (load it for this session only) |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 726 | or |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 727 | echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 728 | (load it every time) |
| 729 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 730 | Note that the value for this variable is the name of the MIB |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 731 | 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 Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 736 | 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 Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 739 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 740 | Note that you need *both* steps. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 741 | |
| 742 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 743 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 755 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 756 | Why can't I see anything from the agent? |
| 757 | --------------------------------------- |
| 758 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 759 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 764 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 765 | 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 Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 767 | should also see an error message, to help identify what's wrong. |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 768 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 769 | 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 Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 773 | |
| 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 809 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 810 | |
| 811 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 812 | Why doesn't the agent respond? |
| 813 | ----------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 814 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 815 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 818 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 819 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 824 | -f -Le -d |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 825 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 828 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 829 | |
| 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 839 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 840 | 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 Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 842 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 845 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 846 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 857 | See the entry |
| 858 | The agent worked for a while, then stopped responding. Why? |
| 859 | later in this section. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 860 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 861 | |
| 862 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 863 | I can see the system group, but nothing else. Why? |
| 864 | -------------------------------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 865 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 866 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 870 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 871 | The easiest way to test this is to try a GETNEXT request on one of |
| 872 | the other standard groups |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 873 | e.g. |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 874 | snmpgetnext ..... interfaces |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 875 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 876 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 879 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 880 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 881 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 882 | Why can't I see values in the <ENTERPRISE> tree? |
Dave Shield | 24569f7 | 2009-05-28 11:31:51 +0000 | [diff] [blame] | 883 | ----------------------------------------------- |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 884 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 885 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 888 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 889 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 893 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 894 | |
| 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 926 | When the agent reaches the end of this tree, it will return the first |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 927 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 930 | |
| 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 943 | The agent worked for a while, then stopped responding. Why? |
| 944 | ----------------------------------------------------------- |
| 945 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 946 | There are three basic possibilities: |
| 947 | - the agent has crashed |
| 948 | - it is hanging |
| 949 | - it is temporarily overloaded |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 950 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 951 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 957 | undisturbed for a while, and then probe it using a single 'snmpget' |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 958 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 964 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 965 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 969 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 970 | |
| 971 | |
| 972 | Requesting an object fails with "Unknown Object Identifier" Why? |
| 973 | ---------------------------------------------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 974 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 975 | If a general snmpwalk shows a particular entry, but asking for it more |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 976 | specifically gives a "sub-identifier not found:" or "Unknown Object |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 977 | Identifier" error, then that's a problem with the tool, rather than |
| 978 | the agent. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 979 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 980 | Firstly, make sure that you're asking for the object by the right name. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 981 | Object descriptors are case-sensitive, so asking for 'sysuptime' will |
| 982 | not be recognised, but 'sysUpTime' will. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 983 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 984 | Alternatively, the object may be defined in a MIB that hasn't been |
| 985 | loaded. Try loading in all the MIB files: |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 986 | |
John Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 987 | snmpget -m ALL -v1 -c public localhost sysUpTime.0 |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 988 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 989 | or specify the name of the appropriate MIB explicitly: |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 990 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 991 | snmpget -v1 -c public myhost SNMPv2-MIB::sysUpTime.0 |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 992 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 993 | Note that this uses the name of the *module*, not the name of the file. |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 994 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 997 | |
| 998 | |
| 999 | |
| 1000 | Why do I get "noSuchName" when asking for "sysUpTime" (or similar)? |
| 1001 | ------------------------------------------------------------------ |
| 1002 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1003 | Assuming that you do have access to this object, the most likely cause |
| 1004 | is forgetting the instance subidentifier. |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1005 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1006 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1009 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1010 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1013 | objects ("scalars"), this instance subidentifier will always be '0', |
| 1014 | and it *must* be included when making a GET request. |
| 1015 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1016 | Compare the following: |
| 1017 | |
John Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 1018 | $ snmpget -v1 -c public localhost sysUpTime |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1019 | Error in packet |
| 1020 | Reason: (noSuchName) There is no such variable name in this MIB. |
| 1021 | This name doesn't exist: system.sysUpTime |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1022 | |
John Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 1023 | $ snmpget -v1 -c public localhost sysUpTime.0 |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1024 | 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 Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 1028 | $ snmpget -v 2c -c public localhost sysUpTime |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1029 | system.sysUpTime = No Such Instance currently exists |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1030 | |
| 1031 | |
| 1032 | |
| 1033 | Why do I sometimes get "End of MIB" when walking a tree, and sometimes not? |
| 1034 | -------------------------------------------------------------------------- |
| 1035 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1036 | This depends on which MIB modules are supported by the agent you are |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1037 | querying and exactly what you're asking for. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1038 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1039 | Note that a tree is walked by repeatedly asking for "the next entry" until |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 1040 | all the values under that tree have been retrieved. However, the agent has |
John Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 1041 | no idea that this is what's happening - all it sees is a request for "the |
| 1042 | next entry after X". |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1043 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1044 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1047 | this last result lies outside the area of interest, and simply discard it. |
| 1048 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 1049 | If the object X happens to be the last entry supported by the agent, it |
John Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 1050 | doesn't have another object to provide, so returns an "end of MIB" |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 1051 | indication. The Net-SNMP tools report this with the message above. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1052 | |
| 1053 | But in either case, the actual information provided will be the same. |
| 1054 | |
| 1055 | |
| 1056 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1057 | How do I use SNMPv3? |
| 1058 | ------------------- |
| 1059 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1060 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1063 | |
Dave Shield | 52ae017 | 2007-01-29 11:12:29 +0000 | [diff] [blame] | 1064 | snmpget -v 3 -l noAuthNoPriv -u dave localhost sysUpTime.0 |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1065 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1066 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1072 | |
| 1073 | snmpget -v 3 -l authNoPriv -u dave -A "Open the Door" |
| 1074 | localhost sysUpTime.0 |
| 1075 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1076 | A fully secure (i.e. encrypted) request (authPriv) would also specify |
| 1077 | the privacy pass phrase: |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1078 | |
| 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 Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1084 | agent's snmpd.conf file). |
| 1085 | The equivalent settings for the third example would be: |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1086 | |
| 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1101 | Why can't I set any variables in the MIB? |
| 1102 | ---------------------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1103 | |
| 1104 | There are three possible reasons for this: |
| 1105 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1106 | Many MIB objects are defined as "read-only" and inherently cannot be |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1107 | changed via SET requests. Attempts to do so will typically be rejected |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1108 | by the 'snmpset' command without ever being sent to the agent. |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1109 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1110 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1114 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1115 | Even if SET support has been implemented, the agent may not be configured |
| 1116 | to allow write access to this object. |
| 1117 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1118 | Ready-installed distributions (such as those shipped with Linux) tend |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1119 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1124 | |
| 1125 | Note that neither the community string "public" nor "private" can be |
Dave Shield | 43dcec8 | 2002-03-11 15:42:08 +0000 | [diff] [blame] | 1126 | used to set variables in a typical default configuration. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1127 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1128 | |
| 1129 | |
| 1130 | Variables 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1134 | particularly obvious, particularly when using SNMPv1. A typical |
| 1135 | example of this effect would be |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1136 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1137 | $ snmpget -v1 -c public localhost sysLocation.0 |
| 1138 | sysLocation.0 = somewhere nearby |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1139 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1140 | $ snmpset -v1 -c public localhost sysLocation.0 s "right here" |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1141 | Error in packet. |
| 1142 | Reason: (noSuchName) There is no such variable name in this MIB. |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1143 | This name doesn't exist: sysLocation.0 |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1144 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1145 | Trying the same request using SNMPv2 or above is somewhat more informative: |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1146 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1147 | $ snmpset -v 2c -c public localhost sysLocation.0 s "right here" |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1148 | Error in packet. |
| 1149 | Reason: notWritable |
| 1150 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1151 | The SNMPv1 error 'noSuchName' actually means: |
| 1152 | |
| 1153 | "You can't do that to this variable" |
| 1154 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1155 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1162 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1163 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 1167 | |
| 1168 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 1169 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1170 | Why can't I change sysLocation (or sysContact)? |
| 1171 | ---------------------------------------------- |
Dave Shield | 4912e8d | 2002-07-26 14:24:26 +0000 | [diff] [blame] | 1172 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1173 | There is one final possibility to consider for why a SET request might |
| 1174 | be rejected. |
Dave Shield | 4912e8d | 2002-07-26 14:24:26 +0000 | [diff] [blame] | 1175 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1176 | 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 Shield | 4912e8d | 2002-07-26 14:24:26 +0000 | [diff] [blame] | 1191 | |
| 1192 | |
| 1193 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1194 | I 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1200 | This normally generates an error (since digits typically aren't valid |
| 1201 | command line options). |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1202 | |
| 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 Naylon | d9f152d | 2002-08-19 14:46:02 +0000 | [diff] [blame] | 1207 | snmpset -v 2c -c public localhost -- versionRestartAgent.0 i -1 |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1208 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1209 | (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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1211 | |
| 1212 | |
| 1213 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1214 | I get an error when trying to query a string-indexed table value - why? |
| 1215 | ---------------------------------------------------------------------- |
Dave Shield | a25a9a7 | 2002-07-30 08:39:05 +0000 | [diff] [blame] | 1216 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1217 | The Net-SNMP library will normally try to interpret string-based |
| 1218 | index values, and display them in a meaningful manner: |
Dave Shield | a25a9a7 | 2002-07-30 08:39:05 +0000 | [diff] [blame] | 1219 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1220 | $ 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 Shield | a25a9a7 | 2002-07-30 08:39:05 +0000 | [diff] [blame] | 1235 | |
| 1236 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1237 | 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 | |
| 1253 | How 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1285 | How do I send traps and notifications? |
| 1286 | --------------------------------------- |
| 1287 | |
| 1288 | Traps and notifications can be sent using the command 'snmptrap'. |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1289 | The following examples generate the generic trap 'warmStart(1)' and a |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1290 | (dummy) enterprise specific trap '99' respectively: |
| 1291 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1292 | snmptrap -v 1 -c public localhost "" "" 1 0 "" |
Wes Hardaker | 9743e9f | 2001-10-11 21:01:50 +0000 | [diff] [blame] | 1293 | snmptrap -v 1 -c public localhost "" "" 6 99 "" |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1294 | |
| 1295 | The empty parameters "" will use suitable defaults for the relevant |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1296 | values (enterprise OID, address of sender and current sysUptime). |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1297 | |
| 1298 | An SNMPv2 or SNMPv3 notification (either trap or inform) takes |
| 1299 | the OID of the trap to send: |
| 1300 | |
Wes Hardaker | 9743e9f | 2001-10-11 21:01:50 +0000 | [diff] [blame] | 1301 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1303 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1304 | (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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1307 | |
| 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 Hardaker | 9743e9f | 2001-10-11 21:01:50 +0000 | [diff] [blame] | 1311 | snmptrap -v 2c -c public localhost "" ucdStart sysContact.0 s "Dave" |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1312 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1313 | Generating traps from within the agent, or other applications, is |
| 1314 | covered in the AGENT and CODING sections. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1315 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 1316 | You should also read the snmptrap tutorial at |
Wes Hardaker | f5e9ead | 2011-02-22 23:55:43 +0000 | [diff] [blame] | 1317 | http://www.net-snmp.org/wiki/index.php/TUT:snmptrap |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 1318 | which will help you understand everything you need to know about traps. |
| 1319 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1320 | |
| 1321 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1322 | How do I receive traps and notifications? |
| 1323 | ---------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1324 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1325 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1330 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1331 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1335 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1336 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1339 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1340 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1344 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1345 | where 'page_me' and 'log_it' are the commands to be run. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1346 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1347 | Forwarding notifications to another receiver would be done using |
| 1348 | similar 'snmptrapd.conf' directives: |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1349 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1350 | forward .1.3.6.1.4.1.8072.4.0.3 10.0.0.1 |
| 1351 | forward default 10.0.0.2 |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1352 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1353 | There's a tutorial with more details on the web site at |
Wes Hardaker | f5e9ead | 2011-02-22 23:55:43 +0000 | [diff] [blame] | 1354 | http://www.net-snmp.org/wiki/index.php/TUT:snmptrap |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1355 | |
| 1356 | |
| 1357 | |
| 1358 | How 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 | |
| 1371 | Why don't I receive incoming traps? |
| 1372 | ---------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1373 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1374 | 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 Anders | 71b9400 | 2005-12-27 21:45:30 +0000 | [diff] [blame] | 1379 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1380 | |
| 1381 | |
Dave Shield | 679c10d | 2002-06-10 08:28:43 +0000 | [diff] [blame] | 1382 | My 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1386 | command line, but fails or generates an error when triggered by |
| 1387 | an incoming notification, then there are two likely causes. |
Dave Shield | 679c10d | 2002-06-10 08:28:43 +0000 | [diff] [blame] | 1388 | |
| 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1404 | In this case, it's almost certain that you'll also |
Dave Shield | 679c10d | 2002-06-10 08:28:43 +0000 | [diff] [blame] | 1405 | need to give the full path to the traphandle script (as shown) |
| 1406 | |
| 1407 | |
| 1408 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1409 | How 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1426 | How big can an SNMP request (or reply) be? |
| 1427 | ----------------------------------------- |
| 1428 | |
| 1429 | The protocol definition specifies a "minimum maximum" packet size |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1430 | (484 bytes for UDP), which all systems must support, but does not |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1431 | attempt to define an upper bound for this maximum size. This is left |
| 1432 | to each individual implementation. |
| 1433 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1434 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 1438 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1439 | |
| 1440 | |
Wes Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 1441 | How can I monitor my systems (disk, memory, etc)? |
| 1442 | ------------------------------------------------ |
| 1443 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 1444 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 1446 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1451 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 1453 | 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 Shield | fadfa63 | 2001-10-17 14:52:30 +0000 | [diff] [blame] | 1455 | 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 Hardaker | 56bf959 | 2002-05-11 00:09:02 +0000 | [diff] [blame] | 1459 | http://www.net-snmp.org/tutorial-5/mrtg/index.html |
Wes Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 1460 | |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 1461 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 1465 | |
| 1466 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1467 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1468 | Applications complain about entries in your example 'snmp.conf' file. Why? |
| 1469 | -------------------------------------------------------------------------- |
| 1470 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1471 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1475 | The file 'snmp.conf' is intended for general configuration options, |
| 1476 | applicable to all applications (via the SNMP library). |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1477 | Rename (or merge) the 'snmp.conf' file to 'snmpd.conf', and this |
| 1478 | should fix the problem. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1479 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1480 | See the AGENT section or the 'snmpd.conf(5)' man page for more information |
| 1481 | about what should go in this file. |
| 1482 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1483 | |
| 1484 | |
| 1485 | OK, 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1490 | are the SNMPv3 settings mentioned above, defaults for which MIBs to |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1491 | load and where from (see the second entry in this section), |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1492 | and the default SNMP version, port and (if appropriate) community |
| 1493 | string to use. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1494 | |
Dave Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1495 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 1497 | /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 Shield | 49ac378 | 2009-05-28 10:41:30 +0000 | [diff] [blame] | 1499 | to a particular user, and should probably go in a personal snmp.conf |
| 1500 | file (typically $HOME/.snmp/snmp.conf). |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1501 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1502 | See 'snmpget -H' and/or the snmp.conf(5) man page for more details. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1503 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 1504 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1506 | |
| 1507 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1508 | |
Dave Shield | 24569f7 | 2009-05-28 11:31:51 +0000 | [diff] [blame] | 1509 | How 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1529 | PERL |
| 1530 | ==== |
| 1531 | |
Dave Shield | 5b58b2f | 2009-07-21 09:15:07 +0000 | [diff] [blame] | 1532 | What 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 Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1557 | Where can I get the Perl SNMP package? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1558 | ------------------------------------- |
| 1559 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1560 | Joe Marzot's excellent Perl 'SNMP' module, is included in the Net-SNMP |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1561 | source releases. It can be found located in the perl/SNMP subdirectory |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1562 | of the source tree. This is accompanied by a number of Perl modules |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1563 | grouped together under the NetSNMP namespace. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1564 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1565 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1569 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1570 | These Perl modules need to be used in conjunction with a compatible |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1571 | version of the Net-SNMP library. Consult the README file in the SNMP |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1572 | Perl distribution to find out which version of the library it needs. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1573 | |
| 1574 | |
| 1575 | |
Dave Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 1576 | How do I install the Perl SNMP modules? |
| 1577 | -------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1578 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1579 | Assuming you have a reasonably new (and properly configured) Perl system, |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1580 | this should be simply: |
| 1581 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1582 | cd perl |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1583 | 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1589 | |
| 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 Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1597 | There may also be appropriate pre-compiled versions of the Perl modules |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1598 | available from the Net-SNMP project website, or your O/S vendor. |
Dave Shield | 21ee703 | 2002-06-10 09:07:59 +0000 | [diff] [blame] | 1599 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1600 | |
| 1601 | |
| 1602 | But compiling this fails! Why? |
| 1603 | ----------------------------- |
| 1604 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1605 | The Perl module tends to delve quite deeply into the internals of the |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 1606 | main Net-SNMP library, and so is quite sensitive to changes within the |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1607 | 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1609 | working with a Net-SNMP source distribution, the appropriate versions of |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1610 | the Perl modules are shipped as part of the source code, but you *must* |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1611 | have run "make install" on the main Net-SNMP distribution *first*. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1612 | |
| 1613 | If you're working with a ready-installed version of the library, make |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1614 | sure you obtain a compatible version of the Perl module. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1615 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1616 | Note that the Perl modules will be compiled using the compiler |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 1617 | (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 Shield | 428fc47 | 2003-01-10 14:04:36 +0000 | [diff] [blame] | 1621 | environment for both. This issue is discussed in greater detail in |
| 1622 | the README.solaris file. |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 1623 | |
| 1624 | Also note that the v5 Net-SNMP suite *must* be configured to provide |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1625 | shared libraries in order for the Perl modules to work correctly. This |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 1626 | is not necessary with the v4 UCD-SNMP libraries. |
| 1627 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1628 | |
| 1629 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1630 | Compiling the Perl module works OK, but 'make test' fails. Why? |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1631 | -------------------------------------------------------------- |
| 1632 | |
| 1633 | That's difficult to answer in general. |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1634 | Some of the Perl tests are rather picky, so this may simply be |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1635 | some minor inconsistency between your precise setup, and the |
| 1636 | expectations of the test environment. |
| 1637 | |
Thomas Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1638 | Check that you are working with the Perl distribution that matches |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1639 | 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1648 | Why can't mib2c (or tkmib) locate SNMP.pm? |
| 1649 | ----------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1650 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1651 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1657 | |
| 1658 | |
| 1659 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1660 | Why can't mib2c (or tkmib) load SNMP.so? |
| 1661 | --------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1662 | |
| 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 Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 1665 | previous questions. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1666 | |
| 1667 | |
| 1668 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 1669 | Why can't tkmib locate Tk.pm? |
| 1670 | ---------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1671 | |
| 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 Shield | 9c98128 | 2009-05-28 11:56:37 +0000 | [diff] [blame] | 1680 | Why does your RPM complain about missing Perl modules? |
| 1681 | ----------------------------------------------------- |
Dave Shield | ddd57ec | 2004-07-28 09:17:33 +0000 | [diff] [blame] | 1682 | |
| 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 Anders | b3905ba | 2006-11-24 13:13:36 +0000 | [diff] [blame] | 1686 | specific to Perl modules - the same issue can potentially arise with |
Dave Shield | ddd57ec | 2004-07-28 09:17:33 +0000 | [diff] [blame] | 1687 | 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 Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 1711 | I'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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1724 | MIBS |
| 1725 | ==== |
| 1726 | |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1727 | Where 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 Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1733 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1735 | and hence included in all the applications. The tool 'snmptranslate' is |
| 1736 | probably the most appropriate for this purpose. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1737 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1738 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1746 | See the CODING section for more information. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1747 | |
| 1748 | |
| 1749 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1750 | Why aren't my MIB files being read in? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1751 | ------------------------------------- |
Dave Shield | 169203e | 2000-02-10 15:14:51 +0000 | [diff] [blame] | 1752 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1753 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1756 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1757 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1761 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1762 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1765 | |
| 1766 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1767 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1771 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1772 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1775 | |
| 1776 | |
| 1777 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1778 | Where should I put my MIB files? |
| 1779 | ------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1780 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1781 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1784 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1785 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1790 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1791 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1802 | |
| 1803 | |
| 1804 | |
| 1805 | What does "Cannot find module (XXX-MIB)" mean? |
| 1806 | --------------------------------------------- |
| 1807 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1808 | 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 Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1811 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1817 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1818 | If there are a large number of such errors, then it's more likely |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1819 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1825 | |
| 1826 | |
| 1827 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1828 | I'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 | |
| 1848 | What does "unlinked OID" mean? |
| 1849 | ----------------------------- |
Dave Shield | 92e0151 | 2002-03-13 12:03:22 +0000 | [diff] [blame] | 1850 | |
| 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1865 | The parser doesn't handle comments properly. Why not? |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1866 | ---------------------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1867 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1868 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1875 | |
| 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1879 | 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 Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1883 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1885 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1886 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1887 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1898 | |
| 1899 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1900 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1901 | How can I get more information about problems with MIB files? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1902 | ------------------------------------------------------------ |
| 1903 | |
| 1904 | The command 'snmptranslate' is used to translate between numeric |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1905 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1908 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1915 | -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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1918 | See the 'snmptranslate(1)' and 'snmpcmd(1)' man pages for more details, |
| 1919 | or the tutorial at |
Wes Hardaker | 56bf959 | 2002-05-11 00:09:02 +0000 | [diff] [blame] | 1920 | http://www.net-snmp.org/tutorial-5/commands/snmptranslate.html |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1921 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1922 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 1925 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1926 | |
| 1927 | What's this about "too many imported symbols"? |
| 1928 | --------------------------------------------- |
| 1929 | |
| 1930 | Any MIB file starts with an (optional) list of identifiers that |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1931 | it "imports" from other files. The parser handles this using |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1932 | 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 Shield | 43dcec8 | 2002-03-11 15:42:08 +0000 | [diff] [blame] | 1936 | Firstly, if the MIB file refers to an unusually large number |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 1937 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1943 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 1945 | |
| 1946 | |
| 1947 | |
| 1948 | Do 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1972 | |
Dave Shield | 45090bc | 2009-05-28 12:41:35 +0000 | [diff] [blame] | 1973 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 1982 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 1983 | AGENT |
| 1984 | ===== |
| 1985 | |
| 1986 | What MIBs are supported? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 1987 | ----------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 1988 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 1989 | The following MIBs are supported (at least in part and on some systems): |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 1990 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1991 | - MIB-2 General network statistics |
| 1992 | (RFC 1213 and subsequent revisions) |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 1993 | - Host Resources (RFC 1514 and 2790) |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1994 | - SNMPv3 framework (RFCs 2571-5, 3411-3418) |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 1995 | (including USM, VACM, Target |
| 1996 | and Notification MIBs) |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1997 | - DisMan Event and Schedule MIBs |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 1998 | - MTA-MIB (sendmail) |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 1999 | - private UCD/Net-SNMP agent extensions |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2000 | (monitor specified processes and disks, |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2001 | memory, CPU, load average, + extending |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2002 | the agent using shell commands) |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 2003 | |
Thomas Anders | 71b9400 | 2005-12-27 21:45:30 +0000 | [diff] [blame] | 2004 | See README.agent-mibs for details. |
| 2005 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2006 | Not all MIB modules are included by default on all systems. Some of |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2007 | these may need to be explicitly requested when the software is first |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2008 | configured and built, while others may not be available on all |
| 2009 | architectures. |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2010 | |
| 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2014 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2015 | |
| 2016 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2017 | What protocols are supported? |
| 2018 | ---------------------------- |
| 2019 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2020 | The agent supports all three current versions of SNMP (v1, v2c and v3), |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2021 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2024 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2025 | |
| 2026 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2027 | How do I configure the agent? |
| 2028 | ---------------------------- |
| 2029 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2030 | That's a somewhat ambiguous question, as there are two very different |
| 2031 | stages where it is possible to "configure" the agent. |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2032 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2033 | 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 Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2041 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2042 | 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 Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2048 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2049 | |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 2050 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2051 | How do I remove a MIB from the agent? |
| 2052 | ------------------------------------ |
| 2053 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2054 | 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2058 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2059 | 1) re-run 'configure' to exclude the given MIB module(s) from the |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2060 | build configuration, then recompile and reinstall: |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2061 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2062 | ./configure --with-out-mib-modules=path/to/unwanted .... |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2063 | make |
| 2064 | make install |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2065 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2066 | 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2071 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2072 | snmpd -I -unwanted |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2073 | |
| 2074 | Note that this relies on knowing which modules are used to |
| 2075 | implement the relevant MIB objects. If you're not sure, |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2076 | 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2081 | |
| 2082 | snmpd -Dmib_init -H |
| 2083 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2084 | From this information, it should then be fairly obvious which |
| 2085 | modules to disable. |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2086 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2087 | 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2098 | |
| 2099 | |
| 2100 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2101 | I've installed a new MIB file. Why can't I query it? |
| 2102 | ---------------------------------------------------- |
| 2103 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2104 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2109 | |
| 2110 | |
| 2111 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2112 | How do I add a MIB to the agent? |
| 2113 | ------------------------------- |
| 2114 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2115 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2118 | |
| 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 Shield | fb201f7 | 2010-04-06 11:03:05 +0000 | [diff] [blame] | 2131 | implemented in perl. |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2132 | 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 | |
| 2140 | What's the difference between 'exec', 'sh', 'extend' and 'pass'? |
| 2141 | --------------------------------------------------------------- |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2142 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2143 | '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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2146 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2147 | 'sh' is similar, but invokes a shell to run the command line given. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2148 | This means that quoted arguments will be recognised as such, and also |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2149 | allows redirection, and other similar shell interpretation. The results |
| 2150 | are returned in exactly the same way. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2151 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2152 | '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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2155 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2156 | None of these mechanisms require the command to have any knowledge of |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2157 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2160 | |
Dave Shield | 8e02ec0 | 2009-08-06 07:57:24 +0000 | [diff] [blame] | 2161 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2170 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2171 | 'pass' is a more general mechanism for implementing arbitrary MIB |
| 2172 | objects. The specified command will be invoked for any request within |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2173 | the named MIB subtree, and passed details of the requested OID. It |
| 2174 | should return the information relevant to the requested OID. |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2175 | |
| 2176 | 'pass-persist' is similar, but the command will continue running |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2177 | 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 Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2180 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2181 | All of these mechanisms are described in the 'snmpd.conf(5)' man page, |
| 2182 | in the section entitled "Extending Agent Functionality". |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2183 | |
| 2184 | |
| 2185 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2186 | What's the difference between AgentX, SMUX and proxied SNMP? |
| 2187 | ----------------------------------------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 2188 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2189 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 2195 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2196 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2199 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 2203 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2204 | SMUX uses a similar packet format, but the subagent "registers" with |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2205 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2207 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2213 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2217 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2220 | See the file 'README.agentx' for details. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2221 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2222 | AgentX support is included by default, but needs to be explicitly |
| 2223 | activated in the master agent. Do this by adding the line |
Wes Hardaker | 9743e9f | 2001-10-11 21:01:50 +0000 | [diff] [blame] | 2224 | |
| 2225 | master agentx |
| 2226 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2227 | to the snmpd.conf file before starting the agent. |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2228 | |
| 2229 | |
| 2230 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2231 | What is the purpose of 'dlmod'? |
| 2232 | ------------------------------ |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2233 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2234 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2237 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2241 | 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 Hardaker | 56bf959 | 2002-05-11 00:09:02 +0000 | [diff] [blame] | 2247 | See http://www.net-snmp.org/tutorial-5/toolkit/dlmod/ for more information. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2248 | |
Wes Hardaker | 0540f28 | 1999-03-06 01:08:21 +0000 | [diff] [blame] | 2249 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 2250 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2251 | Which extension mechanism should I use? |
| 2252 | -------------------------------------- |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2253 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2254 | That's not easy to answer in general. |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2255 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2256 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2258 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2262 | But if the target subagent only supports SMUX or basic SNMP, then that |
| 2263 | would dictate the extension protocol to use. |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2264 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2265 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2272 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2273 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2278 | Alternatively, you could implement the missing public management API |
| 2279 | for that subsystem, and develop a module within the main agent instead. |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2280 | |
| 2281 | |
| 2282 | |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 2283 | Can 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 Hardaker | 3587407 | 2004-09-29 21:23:48 +0000 | [diff] [blame] | 2292 | directive "agentxSocket localhost:705" to the snmpd.conf file. |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 2293 | |
| 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 Hardaker | 3587407 | 2004-09-29 21:23:48 +0000 | [diff] [blame] | 2297 | more obvious settings "-x 705" or "agentxSocket 705" would allow |
Dave Shield | 74164ed | 2003-01-10 13:31:00 +0000 | [diff] [blame] | 2298 | 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 Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2304 | How 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2309 | a different socket, you need to configure both parties accordingly. |
Dave Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2310 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2311 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2315 | "snmpd -x tcp:localhost:705 ...." |
Dave Shield | b9563bd | 2003-02-05 11:25:27 +0000 | [diff] [blame] | 2316 | would start the agent listening on the TCP port 705 for connections |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2317 | from the local system. |
| 2318 | The same effect can also be obtained by adding the line |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2319 | agentxsocket localhost:705 |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2320 | to the file 'snmpd.conf'. |
Dave Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2321 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2322 | The same option can be used with the Net-SNMP agent when running in |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2323 | This also holds when the Net-SNMP agent is running in |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2324 | "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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2328 | "snmpd -X -x tcp:localhost:705 ...." |
Dave Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2329 | |
| 2330 | A subagent running embedded within some other application will |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2331 | typically not understand the same command-line options, so would |
| 2332 | need to set the same configuration programmatically: |
| 2333 | |
Dave Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2334 | netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2335 | NETSNMP_DS_AGENT_X_SOCKET, "tcp:localhost:705"); |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2336 | |
| 2337 | With the example subagent code from the Net-SNMP tutorial, this line |
| 2338 | would be added immediately before the 'init_agent' call. |
Dave Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2339 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2340 | The same approach can also be used to listen on a different named |
| 2341 | socket, using: |
| 2342 | agentxsocket /tmp/agentx |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2343 | agentxperms 770 770 myuser mygroup |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2344 | 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 Shield | 28c29aa | 2003-02-04 14:25:43 +0000 | [diff] [blame] | 2350 | |
| 2351 | |
| 2352 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2353 | How can I turn off SMUX support? |
| 2354 | ------------------------------- |
| 2355 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2356 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2361 | The safest approach is to run |
| 2362 | configure --with-out-mib-modules=smux |
| 2363 | and recompile the agent. |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2364 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2365 | 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2368 | |
| 2369 | smuxsocket 1.0.0.0 |
| 2370 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2371 | The agent may complain at startup, but it won't accept any incoming |
| 2372 | SMUX requests. |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2373 | |
| 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2381 | How can I combine two copies of the 'mib2' tree from separate subagents? |
| 2382 | ----------------------------------------------------------------------- |
| 2383 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2384 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2393 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2394 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2404 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2405 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2409 | |
| 2410 | |
| 2411 | |
Wes Hardaker | ee04799 | 1997-03-18 15:52:34 +0000 | [diff] [blame] | 2412 | What traps are sent by the agent? |
| 2413 | -------------------------------- |
| 2414 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2415 | 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 Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 2422 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2423 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2426 | |
| 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2430 | directive (again documented under ACTIVE MONITORING). |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2431 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2432 | |
| 2433 | |
| 2434 | Where are these traps sent to? |
| 2435 | ----------------------------- |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2436 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2437 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2443 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2444 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2447 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2448 | Note also that you typically only want *one* of the settings: |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2449 | |
| 2450 | trapsink localhost |
| 2451 | trap2sink localhost |
| 2452 | informsink localhost |
| 2453 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2454 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2458 | |
Wes Hardaker | ee04799 | 1997-03-18 15:52:34 +0000 | [diff] [blame] | 2459 | |
| 2460 | |
Dave Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 2461 | How can I send a particular trap to selected destinations? |
| 2462 | ---------------------------------------------------------- |
| 2463 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2464 | 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 Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 2467 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2468 | 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2472 | Documentation on how to use this mechanism will appear once the |
Dave Shield | e784287 | 2002-05-29 09:17:05 +0000 | [diff] [blame] | 2473 | functionality is working properly. |
| 2474 | |
Dave Shield | 634ffdc | 2002-03-28 23:23:25 +0000 | [diff] [blame] | 2475 | |
| 2476 | |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 2477 | When I run the agent it runs and then quits without staying around. Why? |
| 2478 | ----------------------------------------------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2479 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2480 | Firstly, are you certain that this is what is happening? |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 2481 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2482 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2486 | to show all processes should reveal that the agent is still running. |
| 2487 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2488 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2492 | |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 2493 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2495 | starting the agent up. Check the agent log file for any error messages, |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2496 | or run it with '-f -Le' and see what it reports. |
Wes Hardaker | b922f28 | 1997-10-20 18:45:58 +0000 | [diff] [blame] | 2497 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2498 | One possible cause might be an existing agent (or some other process) |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2499 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2514 | |
| 2515 | |
Dave Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 2516 | After a while the agent stops responding, and starts eating CPU time. Why? |
| 2517 | -------------------------------------------------------------------------- |
| 2518 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2519 | 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 Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 2522 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2523 | See that entry for details. |
Dave Shield | 6f04d7b | 2003-01-09 16:55:35 +0000 | [diff] [blame] | 2524 | |
| 2525 | |
| 2526 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2527 | How can I stop other people getting at my agent? |
| 2528 | ----------------------------------------------- |
| 2529 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2530 | Firstly, are you concerned with read access or write access? |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2531 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2532 | As far as changing things on the agent is concerned, there is relatively |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2533 | little that can actually be altered (see the entry "Why can't I set |
| 2534 | any variables in the MIB?" above). |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2535 | |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2536 | 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 Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2542 | (see the next few questions for details) |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2543 | |
| 2544 | Other options include: |
| 2545 | - Blocking access to port 161 from outside your organisation |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2546 | (using filters on network routers) |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2547 | - Using kernel-level network filtering on the system itself |
| 2548 | (such as IPTables) |
Dave Shield | ceab78b | 1999-08-09 08:02:15 +0000 | [diff] [blame] | 2549 | - Configuring TCP wrapper support ("--with-libwrap") |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2550 | This uses the TCP 'libwrap' library (available separately) |
| 2551 | to allow/deny access via /etc/hosts.{allow,deny} |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2552 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2553 | For strict security you should use only SNMPv3, which is the secure |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2554 | 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 Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2557 | 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 Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2560 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2561 | |
| 2562 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2563 | How can I listen on just one particular interface? |
| 2564 | ------------------------------------------------- |
| 2565 | |
| 2566 | Normally, the agent will bind to the specified port on all interfaces |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2567 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2572 | snmpd 127.0.0.1:161 |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2573 | |
| 2574 | would listen (on the standard port) on the loopback interface only, and: |
| 2575 | |
| 2576 | snmpd 10.0.0.1:6161 |
| 2577 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2578 | would listen on port 6161, on the (internal network) interface with |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2579 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2582 | snmpd 127.0.0.1:161 127.0.0.1:6161 |
| 2583 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2584 | The AgentX port option ('-x') works in much the same way. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2585 | |
| 2586 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2587 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2588 | The 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 | |
| 2605 | Why 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2632 | How do I configure access control? |
| 2633 | --------------------------------- |
| 2634 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2635 | The simplest way is to use the configure directives: |
| 2636 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2637 | rocommunity public (for SNMPv1/2c) |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2638 | rwcommunity private |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2639 | or |
| 2640 | rouser user1 (for SNMPv3) |
| 2641 | rwuser user2 |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2642 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2643 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2647 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2648 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2653 | The same holds true for rouser and rwuser. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2654 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 2655 | The two community directives can be restricted to only allow requests |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2656 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2658 | |
Wes Hardaker | fae82bb | 1998-10-10 06:20:25 +0000 | [diff] [blame] | 2659 | |
| 2660 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2661 | How do I configure SNMPv3 users? |
| 2662 | ------------------------------- |
| 2663 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2664 | There are three ways to configure SNMPv3 users: |
| 2665 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2666 | 1) Stop the agent, and add the line |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2667 | |
| 2668 | createUser {myUser} MD5 {myPassword} DES |
| 2669 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2670 | to the file /var/net-snmp/snmpd.conf (where {myUser} and |
| 2671 | {myPassword} are the appropriate values for username and password, |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2672 | _without_ the braces!). Then re-start the snmpd agent. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2673 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2674 | 2) Stop the agent, run the command |
| 2675 | |
| 2676 | net-snmp-config --create-snmpv3-user |
| 2677 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2678 | and follow the prompts given. This will create an entry |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 2679 | in the /var/net-snmp/snmpd.conf file similar to the above. |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2680 | Then re-start the snmpd agent. |
| 2681 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2682 | 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2686 | |
| 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2692 | automatically create the corresponding SNMPv3 user. You will need |
| 2693 | the above 'createUser' line (or an equivalent 'usmUser') as well. |
Dave Shield | cc0375b | 2004-07-22 15:49:30 +0000 | [diff] [blame] | 2694 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2695 | |
| 2696 | |
| 2697 | The 'createUser' line disappears when I start the agent. Why? |
| 2698 | ------------------------------------------------------------- |
| 2699 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2700 | This is deliberate. |
| 2701 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2702 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2706 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2710 | |
| 2711 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2712 | |
Dave Shield | ab90a5e | 2006-11-24 11:21:53 +0000 | [diff] [blame] | 2713 | What's the difference between /var/net-snmp and /usr/local/share/snmp? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2714 | --------------------------------------------------------------------- |
| 2715 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2716 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2720 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2721 | All other user-provided configuration should go in the traditional |
| 2722 | location (typically /usr/local/share/snmp/snmpd.conf or /etc/snmp). |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2723 | |
| 2724 | |
| 2725 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2726 | My new agent is ignoring the old snmpd.conf file. Why? |
| 2727 | ----------------------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2728 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2729 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2731 | experienced when replacing a ready-installed version (e.g. from a vendor |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2732 | distribution), with the current release installed from the source. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2733 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2734 | 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 | |
| 2739 | Where should the snmpd.conf file go? |
| 2740 | ----------------------------------- |
| 2741 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2742 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2744 | Ready-installed versions often look for the file as /etc/snmpd.conf, |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2745 | or /etc/snmp/snmpd.conf. |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2746 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2747 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2753 | |
| 2754 | |
| 2755 | |
| 2756 | Why 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2762 | to control access to the service. Some distributions may come with |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2763 | this enabled automatically - otherwise you need to explicitly activate |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2764 | this by running |
| 2765 | configure --with-libwrap |
| 2766 | and recompiling the agent. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2767 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2768 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2772 | |
| 2773 | snmpd: ALL |
| 2774 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2775 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2779 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 2780 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2794 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2797 | Requests always seem to timeout, and don't give me anything back. Why? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2798 | |
| 2799 | |
| 2800 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2801 | Why can't I see values in the UCDavis 'proc' or 'disk' trees? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2802 | ------------------------------------------------------------------ |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 2803 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2804 | 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 Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2809 | |
Wes Hardaker | 74c2e71 | 2000-12-01 22:36:54 +0000 | [diff] [blame] | 2810 | Optionally, run snmpconf -g monitoring to help you set up this |
| 2811 | section of the snmpd.conf file. |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2812 | |
| 2813 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2814 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2815 | Why can't I see values in the UCDavis 'memory' or 'vmstat' trees? |
| 2816 | ---------------------------------------------------------------- |
Wes Hardaker | 6166b74 | 1999-02-03 06:00:13 +0000 | [diff] [blame] | 2817 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2818 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2827 | If you want to help port it to other systems, let us know. |
Wes Hardaker | 6166b74 | 1999-02-03 06:00:13 +0000 | [diff] [blame] | 2828 | |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2829 | Note that these subtrees only report the current usage when |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2830 | explicitly queried. They do *not* automatically generate traps |
| 2831 | when the usage strays outside the configured bounds. |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 2832 | See the earlier FAQ entry |
| 2833 | What traps are sent by the agent? |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2834 | or the snmpd.conf section on active monitoring, for more information. |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2835 | |
Wes Hardaker | ff4e352 | 1997-12-01 20:33:49 +0000 | [diff] [blame] | 2836 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2837 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2838 | What do the CPU statistics mean - is this the load average? |
| 2839 | ---------------------------------------------------------- |
| 2840 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2841 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2846 | |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2847 | 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 Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2854 | the "right" way to handle things in the SNMP model. The original |
Dave Shield | 80489f9 | 2006-11-24 13:41:23 +0000 | [diff] [blame] | 2855 | percentage objects have been deprecated, and may possibly be removed |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 2856 | in a future release of the agent. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2857 | |
| 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 Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 2862 | |
Wes Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 2863 | How do I get percentage CPU utilization using ssCpuRawIdle? |
| 2864 | ----------------------------------------------------------- |
| 2865 | |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 2866 | 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 Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 2873 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2874 | |
| 2875 | What about multi-processor systems? |
| 2876 | ---------------------------------- |
| 2877 | |
Dave Shield | b601a36 | 2006-11-24 14:02:33 +0000 | [diff] [blame] | 2878 | 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2882 | system will differ from one O/S to another, and will need |
Dave Shield | b601a36 | 2006-11-24 14:02:33 +0000 | [diff] [blame] | 2883 | to be investigated for each system individually. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2884 | |
Dave Shield | b601a36 | 2006-11-24 14:02:33 +0000 | [diff] [blame] | 2885 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2889 | |
Dave Shield | b601a36 | 2006-11-24 14:02:33 +0000 | [diff] [blame] | 2890 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2896 | |
| 2897 | |
| 2898 | |
| 2899 | The 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2903 | 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 Shield | b601a36 | 2006-11-24 14:02:33 +0000 | [diff] [blame] | 2907 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2911 | guessed from the name. |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2912 | |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2913 | See the snmpd.conf(5) man page for details. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2914 | |
| 2915 | |
| 2916 | |
| 2917 | The 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2924 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2925 | There's no easy way around this problem - the agent can only |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2926 | report such information as is available. If the kernel doesn't |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2927 | keep track of these figures, the agent can't report them. |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 2928 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2929 | Sorry! |
| 2930 | |
| 2931 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2932 | |
| 2933 | Does 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 Shield | 3a71bc8 | 2007-02-05 09:48:00 +0000 | [diff] [blame] | 2949 | event groups, has since been superseded by the work of the DisMan |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 2950 | 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 Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2962 | What does "klread: bad address" mean? |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 2963 | ------------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2964 | |
| 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 2973 | list 'net-snmp-coders@lists.sourceforge.net' |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2974 | Remember to tell us what architecture you have! |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2975 | |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 2976 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2977 | |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 2978 | What 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 Hardaker | ee04799 | 1997-03-18 15:52:34 +0000 | [diff] [blame] | 2985 | can produce a whole slew of such messages, but still provide |
Wes Hardaker | 82ad1f9 | 1997-02-04 08:35:02 +0000 | [diff] [blame] | 2986 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 2990 | messages will disappear. (It won't fix the underlying problem, |
| 2991 | but at least you won't be nagged about it). |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2992 | |
| 2993 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 2994 | |
Dave Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 2995 | What does "Can't open /dev/kmem" mean? |
| 2996 | ------------------------------------- |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 2997 | |
| 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3003 | (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 Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3007 | |
Wes Hardaker | 34ac96d | 1997-01-29 11:11:04 +0000 | [diff] [blame] | 3008 | |
| 3009 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3010 | The 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 Shield | b601a36 | 2006-11-24 14:02:33 +0000 | [diff] [blame] | 3020 | in the Host Resources MIB as "hrSystemUpTime.0" |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3021 | Note that even if the full Host Resources is not supported on |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3022 | your system, it's worth configuring in the system portion using |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3023 | |
Wes Hardaker | 09ce9c0 | 1998-06-19 15:41:00 +0000 | [diff] [blame] | 3024 | '--with-mib-modules=host/hr_system' |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3025 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3026 | and recompiling. This particular group is reasonably likely to work, |
| 3027 | even if some of the other more architecture-specific groups don't. |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3028 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3029 | |
Wes Hardaker | 468df0b | 1998-05-14 15:21:55 +0000 | [diff] [blame] | 3030 | |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 3031 | Can 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 Shield | 5a33a46 | 2009-06-15 15:25:06 +0000 | [diff] [blame] | 3073 | Can 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3097 | COMPILING |
| 3098 | ========= |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 3099 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3100 | How do I control the environment used to compile the software? |
| 3101 | ------------------------------------------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 3102 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3103 | 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 3108 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3109 | 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 Shield | 43dcec8 | 2002-03-11 15:42:08 +0000 | [diff] [blame] | 3127 | |
Dave Shield | b313ef7 | 2002-02-01 09:50:59 +0000 | [diff] [blame] | 3128 | |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 3129 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3130 | How do I control the environment used to compile the software under Windows? |
| 3131 | --------------------------------------------------------------------------- |
Wes Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 3132 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3133 | 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 | |
| 3152 | Why 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 Hardaker | f13d1ce | 1999-03-05 18:21:25 +0000 | [diff] [blame] | 3159 | |
Dave Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3160 | This problem can usually be fixed by installing the missing packages |
| 3161 | (typically the development version of a package that is already there). |
Michael Slifcak | 703910c | 1999-08-23 21:02:51 +0000 | [diff] [blame] | 3162 | |
Dave Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3163 | Examples of this that we have come across include: |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 3164 | |
Wes Hardaker | 1763c16 | 2008-04-02 19:35:10 +0000 | [diff] [blame] | 3165 | -lelf elfutils-devel (later renamed to elfutils-libelf-devel) |
Dave Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3166 | -lbz2 bzip2-devel |
| 3167 | -lselinux libselinux-devel |
| 3168 | -lcrypto openssl/openssl-devel |
| 3169 | -lbeecrypt libbeecrypt/beecrypt/beecrypt-devel. |
Michael Slifcak | 703910c | 1999-08-23 21:02:51 +0000 | [diff] [blame] | 3170 | |
Dave Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3171 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3174 | |
Dave Shield | c50b368 | 2007-01-30 09:10:22 +0000 | [diff] [blame] | 3175 | 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 Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3177 | something like: |
| 3178 | ln -s libelf.so.1 /usr/lib/libelf.so |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3179 | |
Dave Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3180 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3183 | |
Dave Shield | c50b368 | 2007-01-30 09:10:22 +0000 | [diff] [blame] | 3184 | If the compilation is complaining about a .la file, then you should |
| 3185 | install the relevant development package, as listed above. |
| 3186 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3187 | |
| 3188 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3189 | How 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 3231 | How can I reduce the installation footprint or speed up compilation? |
| 3232 | ------------------------------------------------------------------- |
| 3233 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3234 | The following configure options may also be useful: |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 3235 | |
| 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 Shield | 8278328 | 2006-11-24 14:23:57 +0000 | [diff] [blame] | 3241 | --disable-mib-loading Do not include code that parses and |
| 3242 | manipulates the mib files. |
Dave Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 3243 | |
| 3244 | |
| 3245 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3246 | How 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 Shield | a8e43f5 | 2004-11-09 16:12:38 +0000 | [diff] [blame] | 3317 | How 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 Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3360 | Why does 'make test' skip various tests? |
| 3361 | --------------------------------------- |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3362 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3363 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3368 | |
Dave Shield | 9e214a6 | 2009-07-19 15:09:52 +0000 | [diff] [blame] | 3369 | 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 Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 3377 | |
| 3378 | |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 3379 | |
| 3380 | Why does 'make test' complain about a pid file? |
| 3381 | ----------------------------------------------- |
Wes Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 3382 | |
| 3383 | Typically it says something like: |
| 3384 | |
| 3385 | cat: cannot open /tmp/snmp-test-1-8694/*pid* |
| 3386 | |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 3387 | 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 Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 3392 | |
| 3393 | snmpd -d -r -U -P /tmp/snmp-test-5-27295/snmpd.pid... |
| 3394 | |
| 3395 | Kill this process. |
| 3396 | |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 3397 | This could be happening for several reasons including: |
Wes Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 3398 | |
| 3399 | 1. You are trying to do concurrent runs of 'make test'. |
| 3400 | |
Dave Shield | b9dfd6d | 2004-02-26 14:32:39 +0000 | [diff] [blame] | 3401 | 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 Hardaker | d0d19c1 | 2004-02-24 00:32:03 +0000 | [diff] [blame] | 3404 | |
| 3405 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3406 | |
| 3407 | CODING |
| 3408 | ====== |
| 3409 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3410 | How do I write C code to integrate with the agent? |
| 3411 | ------------------------------------------------- |
| 3412 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3413 | There are three main methods for integrating external C code |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3414 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3419 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3420 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3424 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3425 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3429 | |
| 3430 | |
| 3431 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3432 | How does the agent fetch the value of a MIB variable from the system? |
| 3433 | -------------------------------------------------------------------- |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3434 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3435 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3439 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3440 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3444 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3445 | 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3449 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3453 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3454 | See the existing MIB modules in the Net-SNMP source tree for various |
| 3455 | examples of assorted approaches to this task. |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3456 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 3457 | |
| 3458 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3459 | Mib2c 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3466 | section for more details, or the next entry for suitable invocations |
| 3467 | of 'mib2c'. |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3468 | |
| 3469 | |
| 3470 | |
| 3471 | Mib2c 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 Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3495 | Why doesn't mib2c like the MIB file I'm giving it? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3496 | ------------------------------------------------- |
| 3497 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3498 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3501 | |
| 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3506 | |
| 3507 | |
| 3508 | |
| 3509 | Mib2c ignores my MIB and generates a pair of 'mib-2' code files. Why? |
| 3510 | --------------------------------------------------------------------- |
| 3511 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3512 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3514 | itself), rather than an object within it. |
| 3515 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3516 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3518 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3519 | More recent versions complain about not having a valid OID instead. |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3520 | |
| 3521 | |
| 3522 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3523 | What's the difference between the various mib2c configuration files? |
| 3524 | ------------------------------------------------------------------- |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3525 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3526 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3529 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3530 | '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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3536 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3537 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3551 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3552 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3564 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3565 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3572 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3573 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3574 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3581 | |
| 3582 | |
| 3583 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3584 | Which mib2c configuration file should I use? |
| 3585 | ------------------------------------------- |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3586 | |
| 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3613 | 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 Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3617 | |
| 3618 | |
| 3619 | |
| 3620 | How can I have mib2c generate code for both scalars and tables? |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3621 | -------------------------------------------------------------- |
| 3622 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3623 | This uses a very powerful tool called a "text editor" :-) |
| 3624 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3625 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3629 | |
Dave Shield | 0213878 | 2005-11-15 10:28:50 +0000 | [diff] [blame] | 3630 | Instead, the two code files need to be generated separately, and |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3631 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3634 | |
| 3635 | |
| 3636 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3637 | Are there any examples, or documentation for developing MIB modules? |
| 3638 | ------------------------------------------------------------------- |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3639 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3640 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3644 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3645 | 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3652 | 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 Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3657 | |
| 3658 | The two examples/netSnmpHostsTable* modules provide a contrast |
| 3659 | between the iterator and iterator_access helpers. |
| 3660 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3661 | 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 Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3665 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3666 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 3673 | Where 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3679 | configure --with-mib-modules=mymib |
| 3680 | and recompile. |
Wes Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 3681 | |
| 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3692 | 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 Hardaker | 6241ebf | 2001-04-06 19:12:28 +0000 | [diff] [blame] | 3695 | |
| 3696 | |
| 3697 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3698 | Why doesn't my new MIB module report anything? |
| 3699 | --------------------------------------------- |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3700 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3701 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3705 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3706 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3718 | |
| 3719 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3720 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3726 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3727 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3728 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3735 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3736 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3743 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3744 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3745 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3752 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3753 | 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3758 | |
| 3759 | |
| 3760 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3761 | Why 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3765 | hook routines are concerned with processing a single SNMP request, not |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3766 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 3788 | How can I get the agent to generate a trap (or inform)? |
| 3789 | ------------------------------------------------------ |
| 3790 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3791 | There are two aspects to having the agent generate a trap - |
| 3792 | knowing *how* to do this, and knowing *when* to do so. |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3793 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3794 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 3798 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3799 | 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3803 | before invoking the 'send_v2trap()' call to actually send the trap. |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3804 | See the 'snmp_trap_api(3)' man page for further details. |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3805 | |
| 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 Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3810 | |
| 3811 | Determining *when* to generate the trap (either directly or |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3812 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 3815 | |
| 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3818 | 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 3822 | |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3823 | 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3825 | specify a MIB object to monitor, and the value or thresholds |
Dave Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3826 | 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3833 | would check the necessary conditions (which need not be MIB |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3834 | objects), and call the 'send_xxx_trap()' routine (as generated |
| 3835 | by 'mib2c.notify.conf') when appropriate. |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3836 | |
| 3837 | |
| 3838 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3839 | How 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 Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3858 | How 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3862 | API call 'send_easy_trap()' or the v2-style 'send_v2trap()'. |
| 3863 | What matters is the directive(s) in the snmpd.conf file. |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3864 | |
| 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 Shield | 1a591e0 | 2006-11-24 16:09:51 +0000 | [diff] [blame] | 3870 | See the entry |
| 3871 | Where are these traps sent to? |
| 3872 | in the AGENT section for details. |
| 3873 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3874 | |
| 3875 | |
| 3876 | How 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3880 | 'send_v2trap()' call and give a varbind list, starting with |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3881 | the v2-equivalent of the SNMPv1 trap, followed by the |
| 3882 | additional varbinds. |
| 3883 | |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3884 | Alternatively, you can use the API call 'send_trap_vars()' |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3885 | which takes the same generic/specific trap values as |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3886 | 'send_easy_trap()', plus the list of additional varbinds. |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3887 | |
| 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 | |
| 3894 | How 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3898 | 'send_v2trap()' call and give a varbind list, starting |
| 3899 | with the v2-equivalent of the SNMPv1 trap, followed by the |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3900 | additional varbinds. |
| 3901 | |
| 3902 | Alternatively, you can use the (undocumented) API call |
Dave Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3903 | 'send_enterprise_trap_vars()' which takes the same parameters |
| 3904 | as 'send_trap_vars()', plus the enterprise OID to use (in the |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3905 | 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 | |
| 3913 | How 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 3917 | trap - 'send_easy_trap()', 'send_v2trap()' or one of the other |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3918 | calls mentioned above. Generating an SNMPv3 notification |
| 3919 | (rather than a community-based one) is controlled by the |
| 3920 | snmpd.conf file. |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 3921 | |
Dave Shield | 9005967 | 2004-07-16 16:08:50 +0000 | [diff] [blame] | 3922 | 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 | |
| 3935 | Why 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 Hardaker | 00be209 | 2000-12-01 17:10:30 +0000 | [diff] [blame] | 3955 | |
| 3956 | |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 3957 | How 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3964 | But it's also possible to provide MIB information using a different |
| 3965 | (non-default) context. |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 3966 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3967 | 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 Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 3973 | |
| 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 Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 3993 | |
| 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 Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 3999 | |
| 4000 | access {group} "my_context" any noauth exact ...... |
| 4001 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 4002 | or using a single entry to cover all possible contexts: |
Dave Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 4003 | |
| 4004 | access {group} "" any noauth prefix ...... |
| 4005 | |
Dave Shield | 7926902 | 2009-07-20 19:24:09 +0000 | [diff] [blame] | 4006 | |
| 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 Shield | 4746cba | 2004-04-14 09:28:21 +0000 | [diff] [blame] | 4024 | |
| 4025 | |
| 4026 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 4027 | MISC |
| 4028 | ====== |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 4029 | |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 4030 | What 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 Shield | 13c1452 | 2006-12-29 17:25:33 +0000 | [diff] [blame] | 4038 | and the parser is usually bundled into the library 'libnetsnmp.a' |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 4039 | |
| 4040 | Note that the parser attempts to be fairly forgiving of some common |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 4041 | 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 Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 4043 | correct. |
Dave Shield | 5da154e | 2002-03-12 16:35:01 +0000 | [diff] [blame] | 4044 | Certain MIBs may need some amendments to allow them to be read |
| 4045 | correctly by the parser. Contact the coders' list for advice. |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 4046 | |
| 4047 | |
| 4048 | |
Dave Shield | bae701f | 2003-10-29 10:59:23 +0000 | [diff] [blame] | 4049 | What is the Official Slogan of the net-snmp-coders list? |
Wes Hardaker | 51d88c7 | 2000-11-30 18:31:56 +0000 | [diff] [blame] | 4050 | ------------------------------------------------------- |
| 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 Slifcak | 703910c | 1999-08-23 21:02:51 +0000 | [diff] [blame] | 4060 | |