def shrink_dblog_monitor_task(): with open('./config/table_check.json', 'r') as f: Jsonlist = json.load(f) logger.debug(Jsonlist) thrlist = range(len(Jsonlist)) threads=[] for (i,info) in zip(thrlist, Jsonlist): #print("alltask.__name__:", alltask.__name__) t = dbm.MyThread(dbm.shrink_dblog_monitor,(info,),dbm.shrink_dblog_monitor.__name__ + str(i)) threads.append(t) for i in thrlist: threads[i].start() check_list = [] for i in thrlist: threads[i].join() threadResult = threads[i].get_result() if (not threadResult) : check_list.append(0) else: check_list.append(1) check_flag = (sum(check_list)==len(check_list)) if (not check_flag) : logger.error("error:有数据库日志压缩检查处理失败,请检查详细错误信息") logger.error(check_list) ct.send_sms_control("NoLimit", "error:有数据库日志压缩检查失败,请检查详细错误信息") else: logger.info("OK:所有数据库日志压缩检查正常")
def db_trade_monitor_task(): with open('./config/table_check.json', 'r') as f: Jsonlist = json.load(f) logger.debug(Jsonlist) # if os.path.isdir("./tempdata"): # for filename in os.listdir('./tempdata'): # os.remove('./tempdata/' + filename) # else: # os.mkdir("./tempdata") logger.info("Start to excute the trading_monitor") thrlist = range(len(Jsonlist)) threads = [] for (i, info) in zip(thrlist, Jsonlist): t = dbm.MyThread(dbm.trading_monitor, (info, ), dbm.trading_monitor.__name__ + str(i)) threads.append(t) # print "thrcouat3:", threading.active_count() for i in thrlist: threads[i].start() for i in thrlist: threads[i].join() trading_check = threads[i].get_result() sysstr = platform.system() if (not trading_check): logger.error("数据库交易中监控报警,请查看服务器详细信息") if (sysstr == "Windows"): ct.readTexts("Database trading Worning")
def before_cleanup_db_monitor_task(): with open('./config/table_check.json', 'r') as f: Jsonlist = json.load(f) logger.debug(Jsonlist) thrlist = range(len(Jsonlist)) threads=[] for (i,info) in zip(thrlist, Jsonlist): #print("alltask.__name__:", alltask.__name__) t = dbm.MyThread(dbm.before_cleanup_db_monitor,(info,),dbm.before_cleanup_db_monitor.__name__ + str(i)) threads.append(t) for i in thrlist: threads[i].start() for i in thrlist: threads[i].join() threadResult = threads[i].get_result() sysstr = platform.system() if (not threadResult) : logger.error("error:数据库盘后清库盘前检查失败,请检查详细错误信息") ct.send_sms_control("NoLimit", "error:数据库盘后清库盘前检查失败,请检查详细错误信息") if (sysstr == "Windows"): ct.readTexts("Database cleanup Worning") else: logger.info("OK:数据库盘后清库盘前检查正常")
def db_init_monitor_task(): with open('./config/table_check.json', 'r') as f: Jsonlist = json.load(f) logger.debug(Jsonlist) logger.info("Start to excute the before trade monitor") thrlist = range(len(Jsonlist)) threads = [] for (i, info) in zip(thrlist, Jsonlist): #print("alltask.__name__:", alltask.__name__) t = dbm.MyThread(dbm.before_trade_monitor, (info, ), dbm.before_trade_monitor.__name__ + str(i)) threads.append(t) for i in thrlist: threads[i].start() for i in thrlist: threads[i].join() threadResult = threads[i].get_result() sysstr = platform.system() if (not threadResult): logger.error("error:奇点服务器盘前数据库初始化数据错误,请检查详细错误信息") # ct.send_sms_control("db_init", "error:奇点服务器盘前数据库初始化数据错误,请检查详细错误信息") if (sysstr == "Windows"): ct.readTexts("Database init Worning") else: logger.info("OK:奇点服务器数据库init检查正常") ct.send_sms_control("db_init", "OK:奇点服务器盘前数据库init检查正常")