Friday, August 19, 2011

setting a WLDF watch to monitor a cluster

Here the official Oracle documentation on WLDF


Here my previous post on WLDF.



Here the WLST to create a WLDF Diagnostic Module with a watch on the number of members in the cluster:

domain=osb_domain
managed server=ms1
cluster=myCluster

It will generate a SNMP trap every time the number of AliveServerCount on ms1 is less than 3:

edit()
startEdit()
cd('/')
cmo.createWLDFSystemResource('ClusterMonitor')

cd('/SystemResources/ClusterMonitor')
cmo.setDescription('')

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/Harvester/ClusterMonitor')
cmo.createHarvestedType('weblogic.management.runtime.ClusterRuntimeMBean')

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/Harvester/ClusterMonitor/HarvestedTypes/weblogic.management.runtime.ClusterRuntimeMBean')
set('HarvestedAttributes',jarray.array([String('AliveServerCount'), String('CurrentSecondaryServer'), String('ForeignFragmentsDroppedCount'), String('FragmentsReceivedCount'), String('FragmentsSentCount'), String('MulticastMessagesLostCount'), String('PrimaryCount'), String('ResendRequestsCount'), String('SecondaryCount'), String('SecondaryServerDetails')], String))
set('HarvestedInstances',jarray.array([String('com.bea:Name=myCluster,ServerRuntime=ms1,Type=ClusterRuntime')], String))
cmo.setNamespace('ServerRuntime')

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/WatchNotification/ClusterMonitor')
cmo.createWatch('clusterGone')

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/WatchNotification/ClusterMonitor/Watches/clusterGone')
cmo.setRuleType('Harvester')
cmo.setEnabled(true)
cmo.setRuleExpression('(${ServerRuntime//[weblogic.management.runtime.ClusterRuntimeMBean]com.bea:Name=myCluster,ServerRuntime=ms1,Type=ClusterRuntime//AliveServerCount} < 3)')
cmo.setAlarmType('AutomaticReset')
cmo.setAlarmResetPeriod(60000)

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/WatchNotification/ClusterMonitor')
cmo.createSNMPNotification('snmptrap')

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/WatchNotification/ClusterMonitor/SNMPNotifications/snmptrap')
cmo.setEnabled(true)

cd('/WLDFSystemResources/ClusterMonitor/WLDFResource/ClusterMonitor/WatchNotification/ClusterMonitor/Watches/clusterGone')
set('Notifications',jarray.array([ObjectName('com.bea:Name=snmptrap,Type=weblogic.diagnostics.descriptor.WLDFSNMPNotificationBean,Parent=[osb_domain]/WLDFSystemResources[ClusterMonitor],Path=WLDFResource[ClusterMonitor]/WatchNotification[ClusterMonitor]/SNMPNotifications[snmptrap]')], ObjectName))

activate()


When the watch triggers, it logs this in the Server log:

####<16-Aug-2011 15:29:21 o'clock BST> <notice> <diagnostics> <pierrepc> <ms1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<wls Kernel>> <> <1b7e5955c26b51de:219aeffc:131d2f16195:-8000-0000000000000369> <1313504961943> <BEA-320068> <watch 'clusterGone' with severity 'Notice' on server 'ms1' has triggered at 16-Aug-2011 15:29:21 o'clock BST. Notification details: 
WatchRuleType: Harvester 
WatchRule: (${ServerRuntime//[weblogic.management.runtime.ClusterRuntimeMBean]com.bea:Name=myCluster,ServerRuntime=ms2,Type=ClusterRuntime//AliveServerCount} <3) ) 
WatchData: com.bea:Name=myCluster,ServerRuntime=ms1,Type=ClusterRuntime//AliveServerCount < 3  
WatchAlarmType: AutomaticReset 
WatchAlarmResetPeriod: 60000 
> 
If you need a free SNMP manager, download this Some snaphots here if you setup Watches and Notification through the WebLogic console: Selecting metrics to collect with the Harvester: select MBean
Selecting metrics to collect with the Harvester: select MBean attributes
selecting Managed Server instances from which to collect metrics
adding a clusterInTrouble notification which takes a diagnosticImage when the watch triggers:
assiging the clusterInTrouble notification to the clusterGone watch:







No comments: