Place domainSAF.properties file,SAFMonitoring.py and runSAFMonitoringAutomationWLST.sh inside a folder and execute ./runSAFMonitoringAutomationWLST.sh to run the program.
#***************************************************** # Environment details * #domainSAF.properties file * #***************************************************** ADMIN_USERNAME = weblogic ADMIN_PASSWORD = welcome1 ADMIN_URL = t3://localhost:7001 #***************************************************** # Sleep Time in millis * #***************************************************** SleepTime = 5000 #***************************************************** # Running Servers List in Order Required * #***************************************************** serverRunningNamesArray = AIA_01,AIA_02,AIA_03,AIA_04 #***************************************************** # SAF Agents List bases on MServers required * #***************************************************** SAFAgents = OSM_SAF_Agent01,OSM_SAF_Agent02,OSM_SAF_Agent03,OSM_SAF_Agent04 #***************************************************** # SAFRemoteContextName * #***************************************************** SAFRemoteContextName = OSM_queues #***************************************************** # SAF Remote Endpoint Names to Monitor * #***************************************************** SAFQueuesNames = AIA_CRTFO_IN_JMSQ,AIA_UPDBO_IN_JMSQ,AIA_UPDCUST_IN_JMSQ
######################################################################################## # SAF Monitoring Automation WLST Script # # @Team Fusion # #Do not change the discription # ######################################################################################## ######################################################################################## #Running the script # #Run runSAFMonitoringAutomationWLST.sh # ######################################################################################## from java.io import FileInputStream import java.lang import string from java.util import Date from time import time, sleep import sys import os #read properties file propInputStream = FileInputStream("domainSAF.properties"); configProps = Properties(); configProps.load(propInputStream); #Connecting to Server adminusername = configProps.get('ADMIN_USERNAME'); adminpassword = configProps.get('ADMIN_PASSWORD'); adminurl = configProps.get('ADMIN_URL'); clusterName = configProps.get('CLUSTER_NAME'); connect(adminusername, adminpassword, adminurl) def SAFMonitoringAutomation(): domainRuntime(); SAFRemoteContextName = configProps.get('SAFRemoteContextName') SleepTime = int(configProps.get('SleepTime')) SAFAgents = configProps.get('SAFAgents') SAFQueuesNames = configProps.get('SAFQueuesNames') SAFAgent = String(SAFAgents).split(",") SAFQueuesName = String(SAFQueuesNames).split(",") serverRunningNamesArray = configProps.get('serverRunningNamesArray') serversRunningList = String(serverRunningNamesArray).split(",") while 1: i = 0; j = 0; java.lang.Thread.sleep(SleepTime) while i<len(serversRunningList) and j<len(SAFAgent): serverName = serversRunningList[i] SafAgent = SAFAgent[j] i = i+1 j = j+1 print 'Date\t\t\t\tQueueName\t\tMessagesPendingCount\tMessagesCurrentCount\tMessagesHighCount\tMessagesReceivedCount\tLastException\tServerName' for k in SAFQueuesName: cd('/ServerRuntimes/'+serverName+'/SAFRuntime/'+serverName+'.saf/Agents/'+SafAgent+'/RemoteEndpoints/AIAJMSModule!'+SAFRemoteContextName+'!'+k+'@'+SafAgent+'@'+serverName+'/') FailedMessagesTotal = cmo.getFailedMessagesTotal() LastException = cmo.getLastException() LastTimeConnected = cmo.getLastTimeConnected() LastTimeFailedToConnect = cmo.getLastTimeFailedToConnect() MessagesCurrentCount = cmo.getMessagesCurrentCount() MessagesHighCount = cmo.getMessagesHighCount() MessagesPendingCount = cmo.getMessagesPendingCount() MessagesReceivedCount = cmo.getMessagesReceivedCount() Url = cmo.getURL() date = Date() print '%s\t%s\t\t%d\t\t\t%d\t\t\t%d\t\t\t%d\t\t\t%s\t%s' % (date,k, MessagesPendingCount, MessagesCurrentCount, MessagesHighCount, MessagesReceivedCount, LastException, serverName) # MAIN #**************************************************************************** # # Calling all the Methods here print(' ————————– ') print('Monitoring SAF Endpoints') print('#########################################################################################################################') if __name__== "main": SAFMonitoringAutomation() print ('##########################################################################################################################') print(' ————————– ') print 'Monitoring SAF Endpoints Ends' print 'Disconnecting from AdminServer and exiting WLST now' disconnect(); exit();
########################################################################################
#Running the script #
#Run runSAFMonitoringAutomationWLST.sh #
########################################################################################
#!/bin/bash
# ************* Setting the Environment ***********************
echo "Setting the Environment"
#WL_HOME=/app/oracle/fmw/wlserver_10.3
source /app/oracle/fmw/wlserver_10.3/server/bin/setWLSEnv.sh
echo "Environment has been set....."
# ************* Changing the directory***********************
cd .
echo "Calling the script....."
# ************* Calling the WLST script *****************
java weblogic.WLST SAFMonitoring.py > SAFMonitoring.log
0 comments:
Post a Comment