import os
userName = 'weblogic'
passWord = 'welcome1'
Url = 't3://192.168.0.2:7001'
connect(userName,passWord,Url)
serverAll = cmo.getServers()
domainRuntime()
fdAllStuck = open('stuckAll.log', 'w')
for serverEach in serverAll:
monitorServer = serverEach.getName()
cd('ServerRuntimes/' + monitorServer + '/ThreadPoolRuntime/ThreadPoolRuntime')
stuckThreadFile = "stuck" + monitorServer + ".log"
redirect(stuckThreadFile)
ls()
stopRedirect()
fdEachServer = open(stuckThreadFile)
allLineServer = fdEachServer.readlines()
fdEachServer.close()
stuckCounter = 0
for i in allLineServer:
if i.count('STUCK') != 0:
stuckCounter += 1
print >> fdAllStuck, ' '.join([monitorServer, str(stuckCounter)])
fdAllStuck.close()
stuckThreshold = 10
fdAllStuck = open('stuckAll.log')
allLineDomain = fdAllStuck.readlines()
fdAllStuck.close()
for i in allLineDomain:
stuckNum = i.split(' ')
if int(stuckNum[1]) > stuckThreshold:
os.system('mailx -s "Stuck thread count exceeded the threshold" Shell_HAT@ChinaUnix.net < stuckAll.log')
break
exit()
阅读(2355) | 评论(0) | 转发(0) |