Поделиться через


Howto: Monitor EJBs with BeanSpy in SCOM 2012 on WebSphere 6.1 (version 2)

It would appear that yesterday's post may not work for everyone, and here is a second version that will bypass this problem.

The problem relates to the fact that I elected to have the newly created EJB class extend the base Microsoft.JEE.Application class from the Microsoft.JEE.Library management pack.  It so happens that the library class has a key property of the ObjectName with a length of 512 (characters).  It turns out that sometimes an object name can be more than that.  In this case, the discovery data is gathered on the Agent and sent to the Management Server which fails.  If you check your event viewer, you'll see something like:

 

 

The fix is pretty simple: instead of extending the existing class, just create a class that extends System.Component and create an appropriate relationship

 

  <ClassTypes>

 <ClassType ID="Microsoft.JEE.WebSphere.6.1.EJB.Application" Abstract="false" Accessibility="Public" Hosted="true" Base="System!System.ApplicationComponent">
 <Property ID="ApplicationName" Type="string" CaseSensitive="true" MaxLength="256" MinLength="0" />
 <Property ID="j2eeType" Type="string" CaseSensitive="true" MaxLength="32" MinLength="0" />
 <Property ID="ObjectName" Type="string" Key="true" CaseSensitive="true" MaxLength="1024" MinLength="0" />
 </ClassType>

 </ClassTypes>

 <RelationshipTypes>
 
 <RelationshipType ID="Microsoft.JEE.WebSphere.6.1.EJB.MonitoredApplicationServerHostsEjbRelationship"
 Accessibility="Public" Abstract="false" Base="System!System.Hosting">
 <Source ID="Source" MinCardinality="0" MaxCardinality="2147483647" Type="WebSphere61!Microsoft.JEE.WebSphere.6.1.Monitored.Profile" />
 <Target ID="Target" MinCardinality="0" MaxCardinality="2147483647" Type="Microsoft.JEE.WebSphere.6.1.EJB.Application"/>
 </RelationshipType>
 
 </RelationshipTypes>
 

 

 

Now, you need to update the discovery class mappings (b/c the class properties should now be part of the class above).

  <Discovery ID="Microsoft.JEE.WebSphere.6.1.EJB.Application.Discovery" 
 Target="WebSphere61!Microsoft.JEE.WebSphere.6.1.Monitored.Profile" Remotable="true" Enabled="true">
 <Category>Discovery</Category>
 <DiscoveryTypes>
 <DiscoveryClass TypeID="Microsoft.JEE.WebSphere.6.1.EJB.Application" />
 <DiscoveryRelationship TypeID="Microsoft.JEE.WebSphere.6.1.EJB.MonitoredApplicationServerHostsEjbRelationship" />
 </DiscoveryTypes>
 <DataSource ID="DS" TypeID="JEE!Microsoft.JEE.Discovery.MBeans.DataSource">
 <ApplicationServerGuid>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Instance"]/Id$</ApplicationServerGuid>
 <ComputerName>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Instance"]/HostName$</ComputerName>
 <Protocol>$Target/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Monitored.Instance"]/Protocol$</Protocol>
 <Port>$Target/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Monitored.Instance"]/Port$</Port>
 <BaseURL />
 <JMXQuery>WebSphere:j2eeType=EJBModule,*</JMXQuery>
 <AdditionalArguments>&amp;MaxDepth=0</AdditionalArguments>
 <ReturnMultiplePropertyBags>true</ReturnMultiplePropertyBags>
 <UseAttributesInKeysOfReturnedPropertyBags>false</UseAttributesInKeysOfReturnedPropertyBags>
 <!-- Interval currently set to four hours -->
 <IntervalSeconds>14400</IntervalSeconds>
 <TimeoutSeconds>900</TimeoutSeconds>
 <ClassId>$MPElement[Name="Microsoft.JEE.WebSphere.6.1.EJB.Application"]$</ClassId>
 <InstanceSettings>
 <Settings>
 <!-- The following properties are defined for the Application's parent classes -->
 <Setting>
 <Name>$MPElement[Name="System!System.Entity"]/DisplayName$</Name>
 <Value>$Data/Property[@Name='/MBeans/javax.management.modelmbean.RequiredModelMBean/objectNameElements/name']$</Value>
 </Setting>
 <!-- These properties are for the WebSphere Configuration-->
 <Setting>
 <Name>$MPElement[Name="JEE!Microsoft.JEE.ApplicationServer.Instance"]/Id$</Name>
 <Value>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Instance"]/Id$</Value>
 </Setting>
 <Setting>
 <Name>$MPElement[Name="JEE!Microsoft.JEE.ApplicationServer.Instance"]/HostName$</Name>
 <Value>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Instance"]/HostName$</Value>
 </Setting>
 <!-- The following properties are defined for the Application-->
 <Setting>
 <Name>$MPElement[Name="Microsoft.JEE.WebSphere.6.1.EJB.Application"]/ApplicationName$</Name>
 <Value>$Data/Property[@Name='/MBeans/javax.management.modelmbean.RequiredModelMBean/objectNameElements/name']$</Value>
 </Setting>
 <Setting>
 <Name>$MPElement[Name="Microsoft.JEE.WebSphere.6.1.EJB.Application"]/j2eeType$</Name>
 <Value>$Data/Property[@Name='/MBeans/javax.management.modelmbean.RequiredModelMBean/objectNameElements/j2eeType']$</Value>
 </Setting>
 <Setting>
 <Name>$MPElement[Name="Microsoft.JEE.WebSphere.6.1.EJB.Application"]/ObjectName$</Name>
 <Value>$Data/Property[@Name='/MBeans/javax.management.modelmbean.RequiredModelMBean/objectName']$</Value>
 </Setting>
 </Settings>
 </InstanceSettings>
 </DataSource>
 </Discovery>

 

Microsoft.JEE.WebSphere.6.1.EJB.xml