def sql0(sql, dbconncr, m_interval, M_ID, dbconn): try: #比较当前时间和上次执行时间间隔 compareResult = getTimeInterval.compareExecTime(m_interval, M_ID, dbconncr) if compareResult: dbconncr.prepare(sql) dbconncr.execute(sql) result = dbconncr.fetchall()[0][0] t_scn = '' startTime = "to_date('', 'hh24:mi:ss')" EndTime = "to_date('', 'hh24:mi:ss')" insertResult(M_ID, t_scn, m_interval, result, startTime, EndTime, dbconncr, dbconn) except Exception,e: with open(r'error.log','a') as error_log: print >> error_log,('%s %s %s' % (time.ctime(),'Execute Collect Faild:',e))
def sql0(sql, dbconncr, releation, key, M_ID, errStatus, errMsg, m_interval, dbconn): try: if errStatus == "SQL00": errType = 0 else: errType = 1 #比较本次执行时间和上次时间间隔 compareResult = getTimeInterval.compareExecTime(m_interval, M_ID, dbconncr) if compareResult: dbconncr.prepare(sql) dbconncr.execute(sql) result = dbconncr.fetchall()[0][0] t_scn = ' ' startTime = "to_date('', 'hh24:mi:ss')" EndTime = "to_date('', 'hh24:mi:ss')" compareKey(releation, result, key, M_ID, errType, errMsg, t_scn, m_interval, startTime, EndTime, dbconncr, dbconn) #dealResult.checkExecErrFlag(M_ID, dbconncr, dbconn) except Exception,e: with open(r'error.log','a') as error_log: print >> error_log,('%s %s %s' % (time.ctime(),'Excute Monitor SQL Faild:',e))