高分求救:用过snmp4j的大虾进!
我现在用agenpro把一个mib文件转换成了java代码,但是不知道这个类怎么使用。也就是如何放在agent里。望指点迷津啊!!!
java代码
import org.snmp4j.smi.*;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.agent.*;
import org.snmp4j.agent.mo.*;
import org.snmp4j.agent.mo.snmp.*;
import org.snmp4j.agent.mo.snmp.smi.*;
import org.snmp4j.agent.request.*;
import org.snmp4j.log.LogFactory;
import org.snmp4j.log.LogAdapter;
import org.snmp4j.agent.mo.snmp.tc.*;
//--AgentGen BEGIN=_IMPORT
//--AgentGen END
public class HelloMib
//--AgentGen BEGIN=_EXTENDS
//--AgentGen END
implements MOGroup
//--AgentGen BEGIN=_IMPLEMENTS
//--AgentGen END
{
private static final LogAdapter LOGGER =
LogFactory.getLogger(HelloMib.class);
//--AgentGen BEGIN=_STATIC
//--AgentGen END
// Factory
private MOFactory moFactory =
DefaultMOFactory.getInstance();
// Constants
/**
* OID of this MIB module for usage which can be
* used for its identification.
*/
public static final OID oidHelloMib =
new OID(new int[] { });
public static final OID oidSysDescr =
new OID(new int[] { 1,3,6,1,2,1,1,1,0 });
public static final OID oidSysTest =
new OID(new int[] { 1,3,6,1,2,1,1,2,0 });
// Enumerations
// TextualConventions
// Scalars
private MOScalar sysDescr;
private MOScalar sysTest;
// Tables
//--AgentGen BEGIN=_MEMBERS
//--AgentGen END
/**
* Constructs a HelloMib instance without actually creating its
* <code>ManagedObject</code> instances. This has to be done in a
* sub-class constructor or after construction by calling
* {@link #createMO(MOFactory moFactory)}.
*/
protected HelloMib() {
//--AgentGen BEGIN=_DEFAULTCONSTRUCTOR
//--AgentGen END
}
/**
* Constructs a HelloMib instance and actually creates its
* <code>ManagedObject</code> instances using the supplied
* <code>MOFactory</code> (by calling
* {@link #createMO(MOFactory moFactory)}).
* @param moFactory
* the <code>MOFactory</code> to be used to create the
* managed objects for this module.
*/