9.1.1 Overview
9.1.2 Registering SNMP Adaptor
9.1.3 Features Supported by the JMX SNMP Agent
The com.adventnet.adaptors.snmp.SnmpAdaptor class from AdventNet acts as a protocol adaptor for SNMP to make the Multi-Protocol agent accessible from the management applications (for e.g., AdventNet MIB Browser) outside the Agent's JVM.
This class itself acts as an MBean for exposing the SNMP Agent configuration parameters which can be viewed and changed through some other protocol adaptors (say RMI/HTTP/IIOP).
This class extends the com.adventnet.adaptors.common.AbstractAdaptor which provides the implementation of com.adventnet.adaptors.common. ServiceInfo interface and acts as the SNMP Agent. This class also implements the javax.management.MBeanRegistration interface. Thus the method preRegister(..) in this MBeanRegistration interface allows this adaptor to perform any operations it needs before being registered with the MBeanServer.
The SNMP Agent gets actually started only inside the preRegister(..) method at the specified port mentioned in the key "port" of the ObjectName (the name with which this Adaptor gets registered with the MBeanServer) . If the key "port" is absent, then the service(Snmp agent) gets started at the default port 8001.
9.1.2 Registering SNMP Adaptor
To create a Multi-Protocol agent with SNMP Adaptor support, the adaptor must be registered with the MBean server of the Multi-Protocol agent. This can be done either from the JMX Compiler or using API calls.
As the SNMP Adaptor is itself registered as an MBean, its configuration parameters ( e.g. Port number, Authentication ) can also be viewed and changed through other protocol adaptors.
Using JMX Compiler UI
Select Project -> Settings option, the Settings dialog appears.
Select Adaptors -> SNMP -> General option from the Settings tree in the dialog.
Configure the following options in the General panel that appears on the right side:
Enable SNMP Adaptor option.
Enter the Port Number (port at which SNMP Adaptor must be started).]
On code generation, code is generated to register the SNMP adaptor with the MBean server.
Using API
To register SNMP Adaptor using API, add the following code to the respective methods as shown below in the agent main file.
|
////import com.adventnet.adaptors.snmp.SnmpAdaptor;////
/* Variables representing the different configurations for different adaptors.*/ private SnmpAdaptor snmpadaptor = null; private int snmpPort = 8001;
//Registering the Snmp Adaptor in registerAdventNetAdaptors() method snmpadaptor = new SnmpAdaptor(snmpPort); |
This SnmpAdaptor just acts as a wrapper class for the AdventNet SnmpAgent api thus ensuring to provide the same stability that has come from the AdventNet model of Agent Toolkit (which supports only SNMP management).
|
|
Note: Snmp access is supported only for ModelMBeans which has SNMP (OID) specification in its corresponding xml file. The SNMP instrumentation in AdventNet model also has the xxxRequestHandler.java associated with each group or table in the MIB. Whereas in this JMX version of SNMP, since the instrumentation(mbean) is protocol independant, the xxxRequestHandler gets substituted by the xxx.xml file and the instrumentation (mbean) will be a JMX ModelMBean. The JMX Compiler tool in the Agent Toolkit generates the ModelMBean with corresponding xml file for the groups/tables of the given MIB |
9.1.3 Features supported by the JMX SNMP Agent
Various features supported by JMX SNMP Agent through Agent Toolkit's SnmpAdaptor are dealt with in detail in the following topics.
To know more on the features supported by Standalone SNMP Agents please have a look at Building SNMP Agents section.