The following sections will guide you on how to setup and test the various features of the adapter on a step by step like tutorial by showing you how to access your JMX Beans and expose them through SNMP. The popular net-snmp will be used to show interoperability with the JBoss SNMP Adaptor.
SNMPv1 specified five core protocol data units (PDUs). Two other PDUs, GetBulkRequest and InformRequest were added in SNMPv2 and carried over to SNMPv3.
The seven SNMP protocol data units (PDUs) are as follows:
- Response Returns variable bindings and acknowledgement from agent to manager for below GetRequest, SetRequest, GetNextRequest, GetBulkRequest and InformRequest. Error reporting is provided by error-status and error-index fields. Although it was used as a response to both gets and sets, this PDU was called GetResponse in SNMPv1.
- GetRequest A manager-to-agent request to retrieve the value of a variable or list of variables.
- SetRequest A manager-to-agent request to change the value of a variable or list of variables.
The 3 above PDUs are covered by Accessing JMX Beans Attributes (SNMP GET and SET)
- GetNextRequest A manager-to-agent request to discover available variables and their values. Returns a Response with variable binding for the lexicographically next variable in the MIB. The entire MIB of an agent can be walked by iterative application of GetNextRequest starting at OID 0. Rows of a table can be read by specifying column OIDs in the variable bindings of the request.
- GetBulkRequest Optimized version of GetNextRequest. A manager-to-agent request for multiple iterations of GetNextRequest. Returns a Response with multiple variable bindings walked from the variable binding or bindings in the request. PDU specific non-repeaters and max-repetitions fields are used to control response behavior.
The 2 above PDUs are covered by Accessing JMX wildcards or Beans Attributes as Tables (SNMP getnext, SNMP getbulk)
- Trap Asynchronous notification from agent to manager. Includes current sysUpTime value, an OID identifying the type of trap and optional variable bindings.
- InformRequest Acknowledged asynchronous notification from manager to manager. This PDU uses the same format as the SNMPv2 version of Trap. Manager-to-manager notifications were already possible in SNMPv1 (using a Trap), but as SNMP commonly runs over UDP where delivery is not assured and dropped packets are not reported, delivery of a Trap was not guaranteed. InformRequest fixes this by sending back an acknowledgement on receipt. Receiver replies with Response parroting all information in the InformRequest.
The 2 above PDUs are covered by Sending JMX Notifications as SNMP Traps (or INFORMs)
Included in the SNMP Adaptor is a way for a user to generate an SNMP MIB file based on already defined attributes.xml and notifications.xml, See The MIB Generator for more information.
To test the SNMP Adaptor, we will use v3 of the protocol as it is the current standard version of SNMP since 2004. Install Net-SNMP from http://www.net-snmp.org/. The JBoss SNMP Adaptor provides a default set of users configured by default in its users configuration file
This is the user that will be used throughout the walkthrough :
The same user has to be configured on net-snmp so that net-snmp and JBoss SNMP Adaptor can communicate in a secure manner. Run the following command for a console
Note: In linux, you will need to run it with root privileges through sudo
Issuing the above command should display the following outputTo be able to receive SNMP Traps or INFORM from a given user, snmptrapd configuration has to be modified :
And add the following
It is possible to make snmptrap display the name of the OID defined in the MIB of JBoss. More information can also be found in The MIB Generator
Check the directory where the MIBs will be loaded from with the following command :
Edit the snmp.conf
and add the following
Copy the MIB from JBoss Application Server to your user dir where the MIB will be loaded from