本文记录的是在进行Net-SNMP配置及测试时经常用到的命令,具体的使用方法可参考命令的帮助文档。

####1. net-snmp-create-v3-user#### 正如命令的字面意思,该命令用来创建 Net-SNMP v3用户。

####2. net-snmp-config####

1
2
3
4
5
6
7
The net-snmp-config shell script is designed to retrieve the  
configuration information about the libraries and binaries dealing
with the Simple Network Management Protocol (SNMP), built from the
net-snmp source package. The information is particularily useful
for applications that need to link against the SNMP libraries and
hence must know about any other libraries that must be linked in
as well.

net-snmp-config命令用来获取处理SNMP协议的库和二进制文件的配置信息,其从Net-SNMP的源文件包编译而得。该信息对那些依赖于SNMP库的应用尤其有用.

####3. snmptranslate####

snmptranslate -On -Td -IR: print full details of the given OID & print OIDs numerically

snmptranslate -Tp -IR: print tree format symbol table

####4. snmpget#### There are three main elements to such a request - where to retrieve this information from, the administrive information associated with the request, and what information is actually required.

1
snmpget -v 2c -c demopublic test.net-snmp.org SNMPv2-MIB::sysUpTime.0

获取指定主机上的snmp信息。

####5. snmpwalk#### retrieving lots of data at once! The command takes a single OID, and will display a list of all the results which lie within the subtree rooted on this OID:

1
snmpwalk -v 2c -c demopublic test.net-snmp.org system

####6. snmptable#### The snmptable command retrieves the contents of an SNMP table, and displays it in the usual manner - one row at a time:

1
snmptable -v 2c -c demopublic -Os test.net-snmp.org sysORTable

and snmptable can use directive -Cw apply a maximum width to the output, splitting the table into several chunks if necessary:

1
snmptable -v 2c -c demopublic -Os -Cw 70 test.net-snmp.org sysORTable

By default, the snmptable command ignores these index values, but it will display them if invoked with the -Ci option:

1
snmptable -v 2c -c demopublic -Os -Cw 70 -Ci test.net-snmp.org sysORTable

####7. snmpconf#### 以交互方式生成snmp的配置文件

####8. snmpd -H#### 获取snmpd.confsnmp.conf以及agentx.conf文件中的可用配置指示符。

####9. snmpd -Dmib_init -H#### check which MIB modules are loaded by getting the agent to report them as they are initialised:

1
snmpd -Dmib_init -H

From this information, it should then be fairly obvious which modules to disable. You can disable the MIB at runtime use:

1
snmpd -I -unwanted

####10. check where is snmpd.conf?####

1
snmpd -f -Le -Dread_config 2>&1 | grep "config path"
The first line of output will display the list of locations where the agent is looking for configuration information.

And you should check for any existing configuration files use the following commond:

1
snmpd -Dread_config -H 2>&1 | grep "Reading" | sort -u

参考: Net-SNMP Wiki