开发者

how to run snmpRequest.java in snmp4j?

开发者 https://www.devze.com 2023-02-06 07:06 出处:网络
I am actually using Snmp4j libraries.. B开发者_如何学Gout I am not getting how to runorg/snmp4j/tools/console/SnmpRequest.java

I am actually using Snmp4j libraries.. B开发者_如何学Gout I am not getting how to run org/snmp4j/tools/console/SnmpRequest.java

I wanted to know how to run snmpRequest.java in snmp4j?


SnmpRequest.java has a main() method. Run it as you would any Java application.

Unless you are looking for the usage, in which case I have not looked.


You need to add the log4j jar file as well... Download the Log4J from http://archive.apache.org/dist/logging/log4j/1.2.14/ (take the zip file if you're on windows), then extract the log4j-1.2.14.jar file into the same dir as the snmp4j-2.0.3.jar file.

To run it, CD to the directory with both of the jars in it and type this:

java -cp snmp4j-2.0.3.jar;log4j-1.2.14.jar org.snmp4j.tools.console.SnmpRequest

followed by whatever parameters you want...


Assuming that you have the two jars in libs directory that's present in current directory, try the following syntax:

java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -h

java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -c public -v 2c -d OFF 10.1.1.1 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0

java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -d OFF -p GETNEXT -c public -v 2c 10.1.1.1 1.3.6.1.2.1.1.1-5

java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -d OFF -p GETBULK -c public -v 2c -Ow 10.1.1.1 1.0.8802.1.1.2.1.4

java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -d OFF -p GETBULK -c public -v 2c -Ot 10.1.1.1 1.0.8802.1.1.2.1.4

It works for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号