Chinaunix首页 | 论坛 | 博客
  • 博客访问: 346618
  • 博文数量: 38
  • 博客积分: 1289
  • 博客等级: 中尉
  • 技术积分: 533
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-10 22:30
个人简介

Good Good Study. Day Day Up.

文章分类

全部博文(38)

文章存档

2018年(1)

2016年(3)

2015年(12)

2014年(7)

2013年(10)

2012年(5)

分类: 系统运维

2013-09-05 15:37:57

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) |
给主人留下些什么吧!~~