Search code examples
snmpsnmp4j

how to use SNMP


I have some linux servers which will work as SNMP agents. I need to use Java and SNMP4J to monitor these servers (agents), and also the SNMP manager must be able to check upon these servers.

  1. How to implement SNMP in the SNMP agent to respond to the queries from SNMP manager?
  2. What is the usage of MIB file? If I hardcode the values in the MIB file, does it mean that I don't need to parse the MIB file?

String product = "1.2.3.1.2.3.6421"

String productmgr = "1.2.3.1.2.3.6421.4"


Solution

  • In order to implement SNMP agent on client side, after installing snmp , just execute snmp commands to communicate with the manager.

    The Management Information Base (MIB) is a virtual information storage area for network management information, which consists of collections of managed objects. Within the MIB there are collections of related objects, defined in MIB modules. MIB modules are written in the SNMP MIB module language, as defined in STD 58, RFC 2578, RFC 2579, and RFC 2580.

    Of course you can hardcode some OIDs in SNMP MIB. But in most of the cases it will not be stable. Even if you hardcode the values in the MIB file, then again you need to reparse the same.