org.jboss.jmx.adaptor.snmp.agent
Class SnmpAgentService

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.system.ListenerServiceMBeanSupport
              extended by org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService
All Implemented Interfaces:
EventListener, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.management.NotificationListener, SnmpAgentServiceMBean, org.jboss.system.ListenerServiceMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class SnmpAgentService
extends org.jboss.system.ListenerServiceMBeanSupport
implements SnmpAgentServiceMBean

SnmpAgentService is an MBean class implementing an SNMP agent. It allows to send V1 or V2 traps to one or more SNMP managers defined by their IP address, listening port number and expected SNMP version. It support mapping SNMP get/set requests JMX mbean attribute get/sets.

Version:
$Revision: 44599 $
Author:
Spyros Pollatos, Dimitris Andreadis, Krishnaraj S

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.system.ListenerServiceMBeanSupport
org.jboss.system.ListenerServiceMBeanSupport.SubscriptionInfo
 
Field Summary
static String DEFAULT_READ_COMMUNITY
          Default communities
static String DEFAULT_WRITE_COMMUNITY
           
static int SNMPV1
          Supported versions
static int SNMPV2
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.jmx.adaptor.snmp.agent.SnmpAgentServiceMBean
OBJECT_NAME
 
Fields inherited from interface org.jboss.system.ListenerServiceMBean
SL_FILTER_ELEMENT, SL_FILTER_FACTORY_ATTRIBUTE, SL_MBEAN_ELEMENT, SL_MBEAN_HANDBACK_ATTRIBUTE, SL_MBEAN_NAME_ATTRIBUTE, SL_NOTIFICATION_ELEMENT, SL_NOTIFICATION_TYPE_ATTRIBUTE, SL_ROOT_ELEMENT
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
SnmpAgentService()
          Default CTOR
 
Method Summary
 String getBindAddress()
          Gets the agent bind address
 boolean getDynamicSubscriptions()
          Gets the dynamic subscriptions status
 int getHeartBeatPeriod()
          Gets the heartbeat switch
 long getInstantiationTime()
          Returns the difference, measured in milliseconds, between the instantiation time and midnight, January 1, 1970 UTC.
 String getManagersResName()
          Gets the name of the file containing SNMP manager specifications
 String getNotificationMapResName()
          Gets the name of the file containing the notification/trap mappings
 int getNumberOfThreads()
          Gets the number of threads in the agent requests processing thread pool
 int getPort()
          Gets the agent listening port number
 String getRequestHandlerClassName()
          Gets the RequestHandler implementation class
 String getRequestHandlerResName()
          Gets the resource file name containing get/set mappings
 int getSnmpVersion()
          Gets the snmp protocol version
 javax.management.ObjectName getTimerName()
          Gets the utilised timer MBean name
 long getTrapCount()
          Returns the current trap counter reading
 String getTrapFactoryClassName()
          Gets the utilised trap factory name
 long getUptime()
          Returns the up-time
 void handleNotification2(javax.management.Notification n, Object handback)
          All notifications are intercepted here and are routed for emission.
 void reconfigureRequestHandler()
          Reconfigures the RequestHandler, reponsible for handling get requests etc.
 void setBindAddress(String bindAddress)
          Sets the agent bind address
 void setDynamicSubscriptions(boolean dynamicSubscriptions)
          Enables/disables dynamic subscriptions
 void setHeartBeatPeriod(int heartBeatPeriod)
          Sets the heartbeat period (in seconds) switch
 void setManagersResName(String managersResName)
          Sets the name of the file containing SNMP manager specifications
 void setNotificationMapResName(String notificationMapResName)
          Sets the name of the file containing the notification/trap mappings
 void setNumberOfThreads(int numberOfThreads)
          Sets the number of threads in the agent request processing thread pool
 void setPort(int port)
          Sets the agent listening port number
 void setReadCommunity(String readCommunity)
          Sets the read community (no getter)
 void setRequestHandlerClassName(String requestHandlerClassName)
          Sets the RequestHandler implementation class
 void setRequestHandlerResName(String requestHandlerResName)
          Sets the resource file name containing get/set mappings
 void setSnmpVersion(int snmpVersion)
          Sets the snmp protocol version
 void setTimerName(javax.management.ObjectName timerName)
          Sets the utilised timer MBean name
 void setTrapFactoryClassName(String name)
          Sets the utilised trap factory name
 void setWriteCommunity(String writeCommunity)
          Sets the write community (no getter)
protected  void startService()
          Perform service start-up
protected  void stopService()
          Perform service shutdown
 
Methods inherited from class org.jboss.system.ListenerServiceMBeanSupport
handleNotification, setSubscriptionList, subscribe, subscribe, subscribe, unsubscribe
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ListenerServiceMBean
setSubscriptionList
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

SNMPV1

public static final int SNMPV1
Supported versions

See Also:
Constant Field Values

SNMPV2

public static final int SNMPV2
See Also:
Constant Field Values

DEFAULT_READ_COMMUNITY

public static final String DEFAULT_READ_COMMUNITY
Default communities

See Also:
Constant Field Values

DEFAULT_WRITE_COMMUNITY

public static final String DEFAULT_WRITE_COMMUNITY
See Also:
Constant Field Values
Constructor Detail

SnmpAgentService

public SnmpAgentService()
Default CTOR

Method Detail

getHeartBeatPeriod

public int getHeartBeatPeriod()
Gets the heartbeat switch

Specified by:
getHeartBeatPeriod in interface SnmpAgentServiceMBean

setHeartBeatPeriod

public void setHeartBeatPeriod(int heartBeatPeriod)
Sets the heartbeat period (in seconds) switch

Specified by:
setHeartBeatPeriod in interface SnmpAgentServiceMBean

getInstantiationTime

public long getInstantiationTime()
Returns the difference, measured in milliseconds, between the instantiation time and midnight, January 1, 1970 UTC.

Specified by:
getInstantiationTime in interface SnmpAgentServiceMBean

getUptime

public long getUptime()
Returns the up-time

Specified by:
getUptime in interface SnmpAgentServiceMBean

getTrapCount

public long getTrapCount()
Returns the current trap counter reading

Specified by:
getTrapCount in interface SnmpAgentServiceMBean

setManagersResName

public void setManagersResName(String managersResName)
Sets the name of the file containing SNMP manager specifications

Specified by:
setManagersResName in interface SnmpAgentServiceMBean

getManagersResName

public String getManagersResName()
Gets the name of the file containing SNMP manager specifications

Specified by:
getManagersResName in interface SnmpAgentServiceMBean

setNotificationMapResName

public void setNotificationMapResName(String notificationMapResName)
Sets the name of the file containing the notification/trap mappings

Specified by:
setNotificationMapResName in interface SnmpAgentServiceMBean

getNotificationMapResName

public String getNotificationMapResName()
Gets the name of the file containing the notification/trap mappings

Specified by:
getNotificationMapResName in interface SnmpAgentServiceMBean

setTrapFactoryClassName

public void setTrapFactoryClassName(String name)
Sets the utilised trap factory name

Specified by:
setTrapFactoryClassName in interface SnmpAgentServiceMBean

getTrapFactoryClassName

public String getTrapFactoryClassName()
Gets the utilised trap factory name

Specified by:
getTrapFactoryClassName in interface SnmpAgentServiceMBean

setTimerName

public void setTimerName(javax.management.ObjectName timerName)
Sets the utilised timer MBean name

Specified by:
setTimerName in interface SnmpAgentServiceMBean

getTimerName

public javax.management.ObjectName getTimerName()
Gets the utilised timer MBean name

Specified by:
getTimerName in interface SnmpAgentServiceMBean

setBindAddress

public void setBindAddress(String bindAddress)
                    throws UnknownHostException
Sets the agent bind address

Specified by:
setBindAddress in interface SnmpAgentServiceMBean
Throws:
UnknownHostException

getBindAddress

public String getBindAddress()
Gets the agent bind address

Specified by:
getBindAddress in interface SnmpAgentServiceMBean

setNumberOfThreads

public void setNumberOfThreads(int numberOfThreads)
Sets the number of threads in the agent request processing thread pool

Specified by:
setNumberOfThreads in interface SnmpAgentServiceMBean

getNumberOfThreads

public int getNumberOfThreads()
Gets the number of threads in the agent requests processing thread pool

Specified by:
getNumberOfThreads in interface SnmpAgentServiceMBean

setPort

public void setPort(int port)
Sets the agent listening port number

Specified by:
setPort in interface SnmpAgentServiceMBean

getPort

public int getPort()
Gets the agent listening port number

Specified by:
getPort in interface SnmpAgentServiceMBean

setSnmpVersion

public void setSnmpVersion(int snmpVersion)
Sets the snmp protocol version

Specified by:
setSnmpVersion in interface SnmpAgentServiceMBean

getSnmpVersion

public int getSnmpVersion()
Gets the snmp protocol version

Specified by:
getSnmpVersion in interface SnmpAgentServiceMBean

setReadCommunity

public void setReadCommunity(String readCommunity)
Sets the read community (no getter)

Specified by:
setReadCommunity in interface SnmpAgentServiceMBean

setWriteCommunity

public void setWriteCommunity(String writeCommunity)
Sets the write community (no getter)

Specified by:
setWriteCommunity in interface SnmpAgentServiceMBean

setRequestHandlerClassName

public void setRequestHandlerClassName(String requestHandlerClassName)
Sets the RequestHandler implementation class

Specified by:
setRequestHandlerClassName in interface SnmpAgentServiceMBean

getRequestHandlerClassName

public String getRequestHandlerClassName()
Gets the RequestHandler implementation class

Specified by:
getRequestHandlerClassName in interface SnmpAgentServiceMBean

setRequestHandlerResName

public void setRequestHandlerResName(String requestHandlerResName)
Sets the resource file name containing get/set mappings

Specified by:
setRequestHandlerResName in interface SnmpAgentServiceMBean

getRequestHandlerResName

public String getRequestHandlerResName()
Gets the resource file name containing get/set mappings

Specified by:
getRequestHandlerResName in interface SnmpAgentServiceMBean

setDynamicSubscriptions

public void setDynamicSubscriptions(boolean dynamicSubscriptions)
Enables/disables dynamic subscriptions

Specified by:
setDynamicSubscriptions in interface SnmpAgentServiceMBean

getDynamicSubscriptions

public boolean getDynamicSubscriptions()
Gets the dynamic subscriptions status

Specified by:
getDynamicSubscriptions in interface SnmpAgentServiceMBean

reconfigureRequestHandler

public void reconfigureRequestHandler()
                               throws Exception
Reconfigures the RequestHandler, reponsible for handling get requests etc.

Specified by:
reconfigureRequestHandler in interface SnmpAgentServiceMBean
Throws:
Exception

startService

protected void startService()
                     throws Exception
Perform service start-up

Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Perform service shutdown

Overrides:
stopService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

handleNotification2

public void handleNotification2(javax.management.Notification n,
                                Object handback)
All notifications are intercepted here and are routed for emission.

Overrides:
handleNotification2 in class org.jboss.system.ListenerServiceMBeanSupport


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.