def logs(): #导入了分析Nginx脚本,用脚本调用里面的函数方法: stat_dict = logfile.logfile('www_access_.log') #用脚本调用里面方法,15是想查看的Nginx top 值 result_list = logfile.datalist(stat_dict, 15) #执行完的结果,则返回log.html页面去展示,result_list得到的是一个没有排序过的列表, #把值赋值给logs,供log.html页面调用 return render_template('log.html', logs=result_list);
def CommunicationThread(threadName, num): global ServerLog sleep(0.25) print threadName + ' started.' # Create two logs: ServerLog = logfile(SERVER_LOG) ServerLog.log_full_date() ServerLog.add_ts(WELCOME_MESSAGE) ServerLog.add_ts('Logs created.') while True: OpenSocket()
def __init__(self, conffile): import nodemgrdbthr, nodemgrsvr, nodemgrsslsvr, nodemgrhttpsvr import socket, xmlconf, logfile, resolve threading.Thread.__init__(self) self.rlock = threading.RLock() self.conf = xmlconf.nodemgrconf(conffile) self.logfile = logfile.logfile(self.conf.logfile) self.host = socket.getfqdn(socket.gethostname()) self.ip = resolve.getlocalip() self.dbthr = nodemgrdbthr.nodemgrdbthr(self) self.svrthr = nodemgrsvr.nodemgrsvrthr(self) self.sslsvrthr = nodemgrsslsvr.nodemgrsslsvrthr(self) self.httpsvrthr = nodemgrhttpsvr.nodemgrhttpsvrthr(self)
def __init__(self, conffile): import gmetadthr, agentsvr, agentsslsvr, agenthttpsvr, agentdbthr import socket, xmlconf, logfile, resolve threading.Thread.__init__(self) self.rlock = threading.RLock() self.conf = xmlconf.agentconf(conffile) self.logfile = logfile.logfile(self.conf.logfile) self.host = socket.getfqdn(socket.gethostname()) self.ip = resolve.getlocalip() self.dbthr = agentdbthr.agentdbthr(self) self.gmetadthr = gmetadthr.gmetadthr(self) self.svrthr = agentsvr.agentsvrthr(self) self.sslsvrthr = agentsslsvr.agentsslsvrthr(self) self.httpsvrthr = agenthttpsvr.agenthttpsvrthr(self) self.leasestoips = {} self.slicestoips = {} self.logfile.log("Initializing")
if len(sys.argv) == 1: print(termcolor.colored(""" +----------------------------------------+ | STARTING 3CX ANALYZER | +----------------------------------------+ """, 'green')) while True: path = emailAndParser.downloadEmail( conf['download']['addr'], conf['download']['port'], conf['download']['usr'], conf['download']['pwd'] ) if path: lf = logfile.logfile(path) filePath = lf.getPDF() emailAndParser.sendEmail( filePath, conf['send']['addr'], conf['send']['port'], conf['send']['usr'], conf['send']['pwd'], conf['send']['saddr'], conf['send']['raddr'] ) break else: time.sleep(15) elif sys.argv[1] == '-l': print(termcolor.colored("""
help='sql database file for messages') args = parser.parse_args() if args.gnubg is None: args.gnubg=Popen(['which','gnubg'], stdout=PIPE).communicate()[0].rstrip('\n') if args.gnubg=='': print 'gnubg location must be specified with --gnubg' sys.exit(1) if args.ladder is not None: for l in args.ladder: if l not in args.type: print 'Chosen ladder conflicts with game type restriction' sys.exit(1) log_file = None if args.log is None else logfile(args.log) alphA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' alphz = 'zyxwvutsrqponmlkjihgfedcba' def get_pip( board, caps ): pip = 0 k = 0 for a in alphA if caps else alphz: i = board.find(a) if i!=-1: while i%2==1: i = board.find(a,i+1) if i==-1: break if i!=-1: pip += k*int(board[i+1],16)
def ParserThread(threadName, num): global Lines, DataLog, ServerLog print threadName + ' started.' DataLog = logfile(DATA_LOG) DataLog.log_full_date() XYLog = logfile(XY_LOG, True) x = 0.0 y = 0.0 Theta = 0.0 S = 0.0 SeqId = '0000' LastCounter = 0 SeqLogger = logfile(SEQ_LOG_FILENAME.format(SeqId), True) while (1): if (len(Lines) == 0): sleep(1) continue while (len(Lines) > 0): line = Lines.pop(0) DataLog.add_ts(line) # (1) Handle header lines if ('---' in line): SeqId, FW = parse_header_line(line) LastCounter = 0 SeqLogger = logfile(SEQ_LOG_FILENAME.format(SeqId), True) ServerLog.add_ts("New sequence found: [{0}], FW [{1}].".format( SeqId, FW)) continue # (2) Handle data lines line_object = RoombaLineParser(line) if (line_object.valid): SeqLogger.add(line_object.parse_sensors()) ServerLog.add_ts("Parsed line [{0}].".format( line_object.counter_str)) dS = line_object.dS dTheta = line_object.dTheta Theta = Theta + dTheta S = S + dS x = x + dS * np.cos(Theta) y = y + dS * np.sin(Theta) XYLog.add( str(x) + ',' + str(y) + ',' + str(line_object.Wall) + ',' + str(Theta) + ',' + str(S)) else: ServerLog.add_ts("Invalid line [{0}]:\n\t\t{1}".format( line_object.counter_str, '\n\t\t'.join(line_object.error_log))) if (line_object.counter != LastCounter + 1): ServerLog.add_ts("WARNING: Skipped line [{0}].".format( line_object.counter_str)) LastCounter = line_object.counter
import os from logfile import logfile from plotandsavegraphic import plotandsave as pas fileList = os.listdir('./') for file in fileList: if 'LogChiamateLastWeek' in file: # with open(os.path.join('./', file), 'r') as actualFilePtr: actualFile = logfile(os.path.join('./', file)) pas(actualFile) #actualFileConent = actualFile.getContent() #for p in actualFileConent: # print(p + '\n')#str(actualFileConent).split("\n")) # load conf file yaml # schedule every monday # Connect to email box # download email and get link of the week # dowload the log file # analize file # number of total calls # number of answered phone calls # number of missed phone calls # number of answered calls per operator (oper code) # build a graphic of datas # send an email to list-mail-address