org.snmp4j.agent.mo.jmx.example
Class JMXTestAgent

java.lang.Object
  extended by org.snmp4j.agent.BaseAgent
      extended by org.snmp4j.agent.mo.jmx.example.JMXTestAgent
All Implemented Interfaces:
java.lang.Runnable

public class JMXTestAgent
extends org.snmp4j.agent.BaseAgent

The JMXTestAgent is a sample SNMP agent implementation of all features (MIB implementations) provided by the SNMP4J-AgentJMX framework. For demonstration purposes, the agent implements the JVM-MANAGEMENT-MIB as far as this can be done without violating the SNMP standard. There are flaws in that MIB module that violate the SNMP standard which have been implemented in a standard conforming way.

Version:
1.0
Author:
Frank Fock

Field Summary
protected  java.lang.String address
           
 
Fields inherited from class org.snmp4j.agent.BaseAgent
agent, agentState, bootCounterFile, configFileURI, defaultContext, defaultPersistenceProvider, defaultProxyForwarder, dispatcher, mpv3, notificationOriginator, server, session, snmp4jConfigMIB, snmp4jLogMIB, snmpCommunityMIB, snmpFrameworkMIB, snmpNotificationMIB, snmpProxyMIB, snmpTargetMIB, snmpv2MIB, STATE_CREATED, STATE_INIT_FINISHED, STATE_INIT_STARTED, STATE_RUNNING, STATE_STOPPED, sysDescr, sysOID, sysServices, transportMappings, usm, usmMIB, vacmMIB
 
Constructor Summary
JMXTestAgent(java.io.File bootCounterFile, java.io.File configFile)
          Creates the test agent with a file to read and store the boot counter and a file to read and store its configuration.
 
Method Summary
protected  void addCommunities(org.snmp4j.agent.mo.snmp.SnmpCommunityMIB communityMIB)
           
protected  void addNotificationTargets(org.snmp4j.agent.mo.snmp.SnmpTargetMIB targetMIB, org.snmp4j.agent.mo.snmp.SnmpNotificationMIB notificationMIB)
           
protected  void addUsmUser(org.snmp4j.security.USM usm)
           
protected  void addViews(org.snmp4j.agent.mo.snmp.VacmMIB vacm)
           
protected  void initTransportMappings()
           
static void main(java.lang.String[] args)
           
protected  void registerManagedObjects()
           
protected  void registerSnmpMIBs()
           
protected  void unregisterManagedObjects()
           
 
Methods inherited from class org.snmp4j.agent.BaseAgent
addShutdownHook, finishInit, getAgent, getAgentState, getBootCounterFile, getConfigFile, getContext, getDefaultContext, getDefaultProxyForwarder, getEngineBoots, getMPv3, getNotificationOriginator, getServer, getSession, getSnmp4jConfigMIB, getSnmp4jLogMIB, getSnmpCommunityMIB, getSnmpFrameworkMIB, getSnmpNotificationMIB, getSnmpProxyMIB, getSnmpTargetMIB, getSnmpv2MIB, getSysDescr, getSysOID, getSysServices, getUsm, getUsmMIB, getVacmMIB, init, initConfigMIB, initMessageDispatcher, initSnmpSession, loadConfig, run, saveConfig, sendColdStartNotification, setAgent, setBootCounterFile, setConfigFile, setDefaultContext, setDefaultProxyForwarder, setEngineBoots, setSysDescr, setSysOID, setSysServices, setupDefaultProxyForwarder, stop, unregisterSnmpMIBs, updateEngineBoots, updateSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

address

protected java.lang.String address
Constructor Detail

JMXTestAgent

public JMXTestAgent(java.io.File bootCounterFile,
                    java.io.File configFile)
             throws java.io.IOException
Creates the test agent with a file to read and store the boot counter and a file to read and store its configuration.

Parameters:
bootCounterFile - a file containing the boot counter in serialized form (as expected by BaseAgent).
configFile - a configuration file with serialized management information.
Throws:
java.io.IOException - if the boot counter or config file cannot be read properly.
Method Detail

registerManagedObjects

protected void registerManagedObjects()
Specified by:
registerManagedObjects in class org.snmp4j.agent.BaseAgent

addNotificationTargets

protected void addNotificationTargets(org.snmp4j.agent.mo.snmp.SnmpTargetMIB targetMIB,
                                      org.snmp4j.agent.mo.snmp.SnmpNotificationMIB notificationMIB)
Specified by:
addNotificationTargets in class org.snmp4j.agent.BaseAgent

addViews

protected void addViews(org.snmp4j.agent.mo.snmp.VacmMIB vacm)
Specified by:
addViews in class org.snmp4j.agent.BaseAgent

addUsmUser

protected void addUsmUser(org.snmp4j.security.USM usm)
Specified by:
addUsmUser in class org.snmp4j.agent.BaseAgent

initTransportMappings

protected void initTransportMappings()
                              throws java.io.IOException
Overrides:
initTransportMappings in class org.snmp4j.agent.BaseAgent
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)

unregisterManagedObjects

protected void unregisterManagedObjects()
Specified by:
unregisterManagedObjects in class org.snmp4j.agent.BaseAgent

addCommunities

protected void addCommunities(org.snmp4j.agent.mo.snmp.SnmpCommunityMIB communityMIB)
Specified by:
addCommunities in class org.snmp4j.agent.BaseAgent

registerSnmpMIBs

protected void registerSnmpMIBs()
Overrides:
registerSnmpMIBs in class org.snmp4j.agent.BaseAgent

Copyright 2006-2007 Frank Fock (SNMP4J.org)