JBoss Community Archive (Read Only)

Mobicents

SNMP Adaptor Walkthrough

Description

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.

SNMP set up and user configuration

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 :

  <user>
    <securityName>TEST</securityName>
    <authenticationProtocol>MD5</authenticationProtocol>
    <authenticationPassphrase>maplesyrup</authenticationPassphrase>
    <privacyProtocol>DES</privacyProtocol>
    <privacyPassphrase>maplesyrup</privacyPassphrase>
  </user>

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

net-snmp-config --create-snmpv3-user -a maplesyrup TEST

Note: In linux, you will need to run it with root privileges through sudo

Issuing the above command should display the following output

adding the following line to /var/lib/snmp/snmpd.conf:
   createUser TEST MD5 "maplesyrup" DES
adding the following line to /usr/share/snmp/snmpd.conf:
   rwuser TEST
To be able to receive SNMP Traps or INFORM from a given user, snmptrapd configuration has to be modified :

sudo gedit /etc/snmp/snmptrapd.conf

And add the following

#User to receive TRAP
createUser -e 0x80001370017F000101 TEST MD5 maplesyrup DES maplesyrup
#User to receive INFORM
createUser myuser MD5 password DES password
#Those make snmptrapd log the TRAPs and INFORM to the console
authUser log,execute,net TEST
authUser log,execute,net myuser

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 :

net-snmp-config --default-mibdirs

Edit the snmp.conf

sudo gedit /etc/snmp/snmp.conf

and add the following

#include all MIB
mibs +ALL

Copy the MIB from JBoss Application Server to your user dir where the MIB will be loaded from

cp $JBOSS_HOME/server/default/deploy/snmp-adaptor.sar/attributes.mib /home/<user>/.snmp/mibs/
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 11:41:58 UTC, last content change 2011-08-11 08:13:56 UTC.