net-snmp-5.4.1.2 ./configure --with-python-modules --with-perl-modules --with-mib-modules="agentx" make make install cd local; make install; cd .. cd mibs; make install; cd .. The "configure" command configure the agent to use the AgentX protocol. This is a IETF defined protocol that allows a master/client relationship between agents and subagents. The last two command should not theoretically have to be to used ... but without them .. things do not seem to work. Now, we have to setup the snmpd configuration file, before "snmpd" can work properly. 4. Copy the example configuration file: $ cp $/EXAMPLE.conf /usr/local/share/snmp/snmpd.conf 5. Now we need to modify /usr/local/share/snmp/snmpd.conf as follows: 1. Replace COMMUNITY with "democommunity". This is your community string. 2. Comment out 2nd "com2sec" line. We do not allow network access for now. 3. On a new line at the end of the file add "master agentx". This tells the agents to behave as the master in the master/client AgentX protocol. 6. We now need to fix some library links (this is truely awful ... is this a Redhat or a net-snmp "problem"/"feature" ?)(Note: On some machines this is not required e.g RedHat 7.1 ... use your judgement :-)) sudo ln -s /usr/local/lib/libnetsnmp.so.15 /lib/libnetsnmp.so.15 sudo ln -s /usr/local/lib/libnetsnmpagent.so.15 /lib/libnetsnmpagent.so.15 sudo ln -s /usr/local/lib/libnetsnmpmibs.so.15 /lib/libnetsnmpmibs.so.15 sudo ln -s /usr/local/lib/libnetsnmphelpers.so.15 /lib/libnetsnmphelpers.so.15 7. To check "snmpd" do: become root ps awwux | grep snmp if you see an earlier snmpd deamon ... kill it cd $/net-snmp-5.0.pre2/agent sudo snmpd -f -L This should start the "snmpd" agent but keep it attached to the current terminal (which is useful since we want to kill it very soon). 8. On another window: snmpget -v 1 -c democommunity localhost system.sysUpTime.0 snmpwalk -v 1 -c democommunity localhost system If snmpd was installed correctly, this gives up the timeticks the snmpd agent has been up (NOT how long your system was up !!). If you get an error .. retrace your steps from the beginning. You can now use "^C" to kill the snmpd deamon in the first window. 参考: http://www.myfaq.com.cn/2005September/2005-09-13/208338.html 1. 网管站(NMS)对网络设备发送各种查询报文,并接收来自被管设备的响应及陷阱(trap)报文,将结果显示出来。 2. 代理(agent)是驻留在被管设备上的一个进程,负责接受、处理来自网管站的请求报文,然后从设备上其他协议模块中取得管理变量的数值,形成响应报文,反送给NMS。在一些紧急情况下,如接口状态发生改变,呼叫成功等时候,主动通知NMS(发送陷阱TRAP报文)。 3. SNMP就是用来规定NMS和Agent之间是如何传递管理信息的应用层协议。 4. SMI(Struct of Management Imformation),通过定义一个宏OBJECT-TYPE,规定了管理对象的表示方法,从这个意义上说,它是ASN.1的一个子集。另外它还定义了几个SNMP常用的基本类型和值。 5. MIB (Management Imformation Base), 是所监控网络设备的标准变量定义的集合。SNMP用层次结构命名方案来识别管理对象,就象一棵树,树的节点表示管理对象,它可以用从根开始的一条路径来无二义的识别。 6. snmpd.conf用来配置代理和管理端通信时的参数, Snmp.conf是与mib库设置相关的配置文件, Snmptraps.conf用来设置代理陷阱, 7. http://net.zdnet.com.cn/network_security_zone/2007/0916/509585.shtml http://support.iap.ac.cn/portal/viewarticle.php?id=315 http://net-snmp.sourceforge.net/FAQ.html |