• How to add SNMP support to my Java application?
  • How to work with SNMP without learning SNMP ins and outs?
  • Where to find simple Java SNMP demo to copy/paste some code?
  • How to write MIB and how to validate it?
  • How to convert MIB into Java code?

Do you have questions like these? Try to use FriendlySNMP library. Check site, it may answer many of your SNMP questions. The FriendlySNMP library will make your SNMP agent development easy.

The working code example below shows how to create, initialize and start SNMP agent in a Java application. First you need to create a Properties object with three entries to define SNMP addresses and credentials. Alternatively you may load properties from an external configuration file.

Properties prop = new Properties();
prop.put("snmp.address.get-set", "");
prop.put("snmp.address.send-notification", "");
prop.put("", "public");
There are many other properties for the SNMP agent fine tuning. Default values are sufficient in most cases.

Create and start agent with only three lines of the following code:

FriendlyAgent agentSNMP = new FriendlyAgent("My Application", "v1.0", prop);

The SNMP agent in your application is ready to work. The FriendlySNMP agent is packed with features including start and shutdown notifications, heartbeat notifications, deadlock detection, uncaught runtime exceptions detection, access to JVM management MIB, SNMP agent configuration properties, Log4j properties, Java system variables and many-many more.

The agent supports v1 / v2c / v3 protocols.

Download demo application as a JAR or as an Eclipse project with all source code. This demo application shows how to use FriendlySNMP API with multiple simple different MIBs in the Java code.

The FriendlySNMP API uses SNMP4J open source library for SNMP API. Many thanks to Frank Fock the author of the SNMP4J for his exceptional product and excellent support.

The FriendlySNMP API uses SLF4J open source library for logging. This reliable product is written by Ceki Gulcu, the Log4j author.

The FriendlySNMP API requires Java-6 or later. The Java-6 features use is very limited, the code could be ported to Java-5 very easily.