<?xml version="1.0" encoding="UTF-8"?>
<!--
  $Id: jboss-service.xml 44599 2006-05-06 22:48:01Z dimitris $
  
  The snmp-adaptor is a module used to intercept JMX notifications emitted
  by MBeans, convert them to traps and send them to SNMP managers. It can also
  accept get/set request and map those to MBean attribute get/sets. In this
  respect the snmp-adaptor acts as a SNMP agent.
  
  It can be used to integrate JBoss with higher order system/network
  management platforms (e.g. HP OpenView), thus making the MBeans visible
  to those systems. The MBean developer can instrument the MBeans by
  producing notifications for any significant event (e.g. server coldstart).
  The adaptor can then be configured to intercept and map those notifications
  to SNMP traps.
  
  SnmpAgentService is the main MBean that implements the SNMP agent.
  It is configured by means of 3 different configuration files, plus
  an inline notification subscription specification:
  
  - attributes.xml, maps SNMP oids to MBean attribute get/set
  - managers.xml, configures where to send traps
  - notifications.xml, specifies the exact mapping of each notification type
    to a corresponding SNMP trap
    
  For more information, see
  http://www.jboss.org/wiki/Wiki.jsp?page=JBossSNMPAdapter
  
  ********
  * NOTE *
  ********
  The MonitoredObjectsResName attribute that referred to an external
  mbeans.xml file has been removed! This is done now through the
  inline SubscriptionList attribute, provided by the ListenerServiceMBean
  interface. The snmp adaptor will not only subscribe for notifications
  upon starting, by will also monitor for new MBeans created within the
  JMX agent and subscribe to them dynamically as they come and go,
  as long as the the mbean subscription information matches their names.
  
  Have a look at the provided example configuration files for more info.
  
  SnmpAgentService produces by default a "coldstart" notification when started.
  
  In addition, by setting the HeartBeatPeriod attribute to a value greater
  than zero, the adaptor configures a Timer MBean to produce heartbeat
  notifications at regular intervals (measured in seconds).
  
  The adaptor itself uses JoeSNMP by OpenNMS for its SNMP engine. The
  trap generation mechanism can be changed or extended with custom classes
  able to extract information from notifications subsclasses unknown
  to the NotificationWrapperSupport class provided with the adaptor.
  
  For more information on using or extending this mechanism, please
  consult the jboss documentation or the source code.
  
  MIB2SystemGroupService is simple MBean that defines the MIB-2 system
  group an agent is supposed to implement under the oid
  iso.org.dod.internet.mgmt.mib-2.system (.1.3.6.1.2.1.1)
  See rfc-1213.
  
  TrapdService is a simple MBean that acts as an SNMP Manager. It
  listens to a configurable port for incoming traps and logs them
  as DEBUG messages using the system logger. You can modify the log4j
  configuration to redirect the log output to a file. SnmpAgentService
  and TrapdService and not dependent from each other.

  Enjoy!
-->
<service>

  <!-- A simple trap receiver that acts as an SNMP Manager -->
  <mbean code="org.jboss.jmx.adaptor.snmp.trapd.TrapdService"
         name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger">
           
    <attribute name="Port">1162</attribute>
  </mbean>
  
  <!-- The SNMP adaptor MBean -->
  <mbean code="org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService"
         name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor">
    
    <attribute name="RequestHandlerClassName">org.jboss.jmx.adaptor.snmp.agent.RequestHandlerImpl</attribute>       
    <attribute name="RequestHandlerResName">/attributes.xml</attribute>
    <attribute name="TrapFactoryClassName">org.jboss.jmx.adaptor.snmp.agent.TrapFactorySupport</attribute>
    <attribute name="NotificationMapResName">/notifications.xml</attribute>
    <attribute name="ManagersResName">/managers.xml</attribute>
    <attribute name="HeartBeatPeriod">0</attribute>
    <attribute name="Port">1161</attribute>
    <attribute name="DynamicSubscriptions">false</attribute>
    <attribute name="WriteCommunity">private</attribute>
    
    <attribute name="SubscriptionList">
      <subscription-list>
        <!-- Monitor events from SNMP adaptor itself -->
        <mbean name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor">
          <notification type="jboss.snmp.agent.coldstart"/>
        </mbean>
        <!-- Monitor timer for heartbeat events -->
        <mbean name="jboss.jmx:name=SnmpAgent,service=timer,type=heartbeat">
          <notification type="jboss.snmp.agent.heartbeat"/>
        </mbean>
        
        <!-- Valid JMX ObjectName patterns may be used as well, for example
        <mbean name="*:service=invoker,*"/>
        will subscribe to all matching mbeans for all notification types -->
        
        <!-- notification types can be used for simple prefix matching, e.g.
        <notification type="JMX.mbean"/>
        matches both JMX.mbean.registered and JMX.mbean.unregistered -->  
        
      </subscription-list>
    </attribute>
        
    <depends optional-attribute-name="TimerName">
      <mbean code="javax.management.timer.Timer"
             name="jboss.jmx:name=SnmpAgent,service=timer,type=heartbeat"/>    
    </depends>
  </mbean>
  
  <!-- Defines the system information as specified in rfc-1213 
       iso.org.dod.internet.mgmt.mib-2.system.* -->
  <mbean code="org.jboss.jmx.adaptor.snmp.system.MIB2SystemGroupService"
  	     name="jboss.jmx:name=SnmpAgent,service=MIB2SystemGroup">
    
    <attribute name="SysLocation">In The Matrix</attribute>
    <attribute name="SysDescr">Central Computer</attribute>
    <attribute name="SysContact">Agent Smith</attribute>
    <!-- attribute name="SysName"></attribute> set internally to serverConfig@hostAddress-->
    <depends optional-attribute-name="SnmpAgent">
  	   jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor
    </depends>
  </mbean>
    
  <!-- Used for internal testing - ignore
  <mbean code="org.jboss.jmx.adaptor.snmp.test.NotificationProducerService"
         name="jboss.jmx:name=SnmpAgent,service=notification,type=producer"/>
  -->
</service>