def findManagedServers():
print strftime('%Y%m%d %H:%M.%S') + " INFO: Finding Managed Servers"
try:
global findManagedServerFail
findManagedServerFail = 0
domainConfig()
print "CD to cluster" + clusterAddress
cd('Clusters/' +clusterAddress)
global managedServers
managedServers=cmo.getServers()
global numberofManagedServers
numberofManagedServers=`len(managedServers)`
print strftime('%Y%m%d %H:%M.%S') + " INFO: Found " + numberofManagedServers + " Managed Servers"
except:
global findManagedServerFail
findManagedServerFail += 1
print strftime('%Y%m%d %H:%M.%S') + " FATAL: Error navigating DomainConfig MBean tree for managed servers"
global managedServerState
managedServerState.append(environment + ';' + "Managed Server Name NOT Found" + ';' + " " + ';' + " " + ';' + component + ';' + "FAILEDMSMBEAN")
Name:
2012-08-10 11:13
def getManagedServerState():
domainRuntime()
for servers in managedServers:
managedServerName=servers.getName()
print "Checking MS State of " + managedServerName
try:
print strftime('%Y%m%d %H:%M.%S') + " INFO: Getting " + managedServerName + " Server Status"
cd('/ServerRuntimes/' + managedServerName)
ss = cmo.getState()
hs = cmo.getHealthState()
x = hs.toString().split(',')[1].split(':')[1]
print strftime('%Y%m%d %H:%M.%S') + " INFO: " + managedServerName + ': ' + ss + ': ' + x
cd('../..')
global managedServerState
managedServerState.append(environment + ';' + managedServerName + ';' + ss + ';' + x + ';' + component + ';')
except:
print strftime('%Y%m%d %H:%M.%S') + " WARNING: " + managedServerName + " could NOT be contacted please investigate!"
global managedServersFail
managedServersFail =+ 1
global managedServersErrorCapture
managedServersErrorCapture.append(environment + ';' + managedServerName + ';' + " " + ';' + " " + ';' + component)
global managedServerState
managedServerState.append(environment + ';' + managedServerName + ';' + " " + ';' + " " + ';' + component + ';' + "FAILEDCONNECTMANAGED")
if managedServersFail == numberofManagedServers:
print strftime('%Y%m%d %H:%M.%S') + " FATAL: No Managed Servers Can Be Contacted in Cluster " + clusterAddress
exitCode = -1
def internalServiceBus(component):
if component == INTSB:
try:
domainRuntime()
for server in serverNames:
cd ('ServerRuntimes/intsb_ms1/JMSRuntime/intsb_ms1.jms/JMSServers/idecideserver_1/Destinations/idecideresources!idecideserver_1@idecide.commonerror')
except:
print strftime('%Y%m%d %H:%M.%S') + " Warning: Unable to connect to " + managedServerName
managedServersFail += 1
managedServersErrorCapture.append(server + " Unable to navigate domainRuntime MBean tree, please investigate")
exitCode = -1
def exitDomainState():
print ""
print "---------------------------------------------------"
print " Domain State Checks Complete"
print "---------------------------------------------------"
print ""
print ""
print "The Following Services are Running Without Issue:"
print ""
for smallsEnv in environments:
print smallsEnv
for smallsComponents in components:
for keys in adminServerLog:
key=keys.split(";")
if key[0] == smallsEnv:
if key[4] == smallsComponents:
if key[5] != "FAILEDCONNECTADMIN" and key[5] != "PROPSNOTFOUND":
printcount = 0
while printcount < 1:
print "-" + smallsComponents
print "--Administration Server"
printcount += 1
if key[2] == "RUNNING":
print " INFO: Weblogic Server " + key[1] + " is currently " + key[2] + " " + key[3]
global msprintcount
msprintcount = 0
for keys in managedServerState:
key=keys.split(";")
if key[0] == smallsEnv:
if key[4] == smallsComponents:
if key[5] != "FAILEDCONNECTMANAGED":
while msprintcount < 1:
print "--Managed Servers"
global msprintcount
msprintcount += 1
if key[2] == "RUNNING":
print " INFO: Weblogic Server " + key[1] + " is currently " + key[2] + " " + key[3]
print "---------------------------------------------------"
print ""
print ""
print "---------------------------------------------------"
print "The Following Services have issues :"
print "---------------------------------------------------"
print ""
for smallsEnv in environments:
global smallscount
smallscount = 0
for smallsComponents in components:
for keys in adminServerLog:
key=keys.split(";")
if key[0] == smallsEnv:
if key[4] == smallsComponents:
if key[5] == "FAILEDCONNECTADMIN" or key[5] == "PROPSNOTFOUND" or key[2] != "RUNNING" or key[3] != "HEALTH_OK":
printcount = 0
while printcount < 1:
while smallscount < 1:
print smallsEnv
smallscount += 1
print "-" + smallsComponents
print "--Administration Server"
printcount += 1
if key[5] == "FAILEDCONNECTADMIN":
print " FATAL: Could NOT Connect to " + key[1] + " Administration Server - Check Properties and/or server logs"
if key[5] == "PROPSNOTFOUND":
print " FATAL: Properties NOT found for " + smallsComponents + " Please Check Files"
if (key[2] != "RUNNING") and `len(key[2])` < 1:
print " WARNING: Weblogic Server " + key[1] + " is communicating but has a state of " + key[2] + " check log files"
if (key[3] != "HEALTH_OK") and `len(key[2])` < 1:
print " WARNING: Weblogic Server " + key[1] + " is " + key[2] + " but has a bad health status"
global msprintcount
msprintcount = 0
for keys in managedServerState:
key=keys.split(";")
if key[0] == smallsEnv:
if key[4] == smallsComponents:
if key[5] == "FAILEDMSMBEAN" or key[5] == "FAILEDCONNECTMANAGED" or key[2] != "RUNNING" or key[3] != "HEALTH_OK":
while msprintcount < 1:
while smallscount < 1:
print smallsEnv
print "-" + smallsComponents
smallscount += 1
print "--Managed Servers"
global msprintcount
msprintcount += 1
if key[5] == "FAILEDCONNECTMANAGED":
print " FATAL: Could NOT Connect to Managed Server: " + key[1] + " - server state " + key[2] + " check console and logfiles"
if key[5] == "FAILEDMSMBEAN":
print " ERROR: Failed to traverse Managed Server MBEAN Tree in domainConfig() - Check Admin server health and properties, this error can also be generated if the domain has NO managed servers"
if (key[2] != "RUNNING") and `len(key[2])` < 1:
print " WARNING: Weblogic Server " + key[1] + " is communicating but has a state of " + key[2] + " check log files"
if (key[3] != "HEALTH_OK") and `len(key[2])` < 1:
print " WARNING: Weblogic Server " + key[1] + " is " + key[2] + "but has a bad health status"
global smallscount
smallscount = 0
disconnect()
exit()
Name:
2012-08-10 11:14
try:
environment=sys.argv[1]
component=sys.argv[2]
print "Environment " + environment
if environment == "App1":
global environments
environments = []
environments.extend(["SM1","SM2","SM3",])
global components
components = []
components.extend(["IL2CMS","IL2FORMS","IL2PORTAL","IL3FORMS","IL3COMMS",])
if environment == "App2":
global environments
environments = []
environments.extend(["SM1","SM2","SM3","SM4",])
global components
components = []
components.extend(["BPM","INTSB","EXTSB","OPA","VRD","BULKINTSB","BULKEXTSB",])
if environment == "App3":
global environments
environments = []
environments.extend(["SM1","SM2","SM3",])
global components
components = []
components.extend(["ETL","PORTAL","SB","SP",])
if environment == "ALL":
global environments
environments = []
environments.extend(["SM1","SM2","SM3","SM4"])
global components
components = []
components.extend(["IL2CMS","IL2FORMS","IL2PORTAL","IL3FORMS","IL3COMMS","BPM","INTSB","EXTSB","OPA","VRD","BULKINTSB","BULKEXTSB","ETL","PORTAL","SB","SP",])
for environmentState in environments:
print "Checking and connecting to " + environmentState
for componentState in components:
environment = environmentState
component = componentState
setEnvironmentProperties(environment, component)
if setEnvironmentPropertiesFail == 0:
connectToAdmin()
if connectToAdminServerFail == 0:
findManagedServers()
if findManagedServerFail == 0:
getManagedServerState()
disconnect()
# if setEnvironmentPropertiesFail > 0:
# global managedServerState
# managedServerState.append(environment + ';' + managedServerName + ';;;' + component + ';' + "FAILED")