Ejemplo n.º 1
0
def checkErrFlag(M_ID, START_TIME, dbconncr, dbconn):
	try:
                sql = "select err_flag, err_msg from monitor.t_mot_conf_log a where a.M_ID = '" + M_ID + "' and a.start_time = " + START_TIME
                dbconncr.prepare(sql)
                dbconncr.execute(sql)
                result = dbconncr.fetchall()
		if len(result) != 0:
			if result[0][0] == '1':
				#调短信接口
				sendResult = getMessage.getMessageInterface(dbconncr, result[0][1])
				if sendResult == 1:
					#更新日志表记录err_flag
					updateErrFlag(M_ID, START_TIME, dbconncr, dbconn)
	except Exception,e:
		with open(r'error.log','a') as error_log:
			print >> error_log,('%s %s %s' % (time.ctime(),'Check Flag Faild:',e))
Ejemplo n.º 2
0
def checkExecErrFlag(M_ID, dbconncr, dbconn):
    try:
        sql = (
            "select err_flag, err_msg, exec_time from monitor.t_mot_conf_log a where a.M_ID = '"
            + M_ID
            + "' order by exec_time desc"
        )
        dbconncr.prepare(sql)
        dbconncr.execute(sql)
        result = dbconncr.fetchall()
        if result[0][0] == "1":
            # 调短信接口
            sendResult = getMessage.getMessageInterface(dbconncr, result[0][1])
            if sendResult == 1:
                # 更新日志表记录err_flag
                updateExecErrFlag(M_ID, result[0][2], dbconncr, dbconn)
    except Exception, e:
        with open(r"error.log", "a") as error_log:
            print >> error_log, ("%s %s %s" % (time.ctime(), "Check Flag Faild:", e))