'antifixed', '') jsonresult = '' if senderNodeId: jsonresult = headJson + '''{"zone":"%s","group":"%s","accountid":"","acc":"%s","lv":"%s","name":"","party":"","wg":"","flag":"","optime":"","ver":"","is_killed":"","ret":"%s","ip":"%s","detime":"%s"}}''' jsonresult = jsonresult % (senderNodeId, logTime, limitNum, 'p1-antifixed', '1', area, group, acc, lv, ret, ip, detime) except: log(modname, 3, '日志分析错误: %s' % line) return return jsonresult if __name__ == '__main__': modname = 'antimodNew' writeConfigLimitNum('antilog') writeConfigLimitNum('antifixed') if 'game' not in hostname: print 'hostname error:%s' % hostname sys.exit() reviewprocess(mod=modname) if not checkpidfile(mod=modname): savemodpid(mod=modname) antilogN_func() antilog() antifixedN_func() removemodpid(mod=modname) #cmd = '''ps -ef |grep %s|grep -v grep|wc -l'''%modname #num = shell_cmd(cmd, modname) #if int(num) == 1: #antilog_func()
conn_num = stdout.read().strip() #print 'dddddddddddddddd',hostname,conn_num s.close() except Exception, e: print 'error:%s', str(e) if conn_num: return conn_num else: conn_num = 0 return conn_num if __name__ == '__main__': modname = 'remoteline.py' if not os.path.exists('/home/config'): os.makedirs('/home/config', 0777) if not os.path.exists('/home/config/monitorNewlinenumber.ini'): get_output( '\cp -rf /tools/config/nsconfig/monitorlinenumber.ini /home/config/monitorNewlinenumber.ini' ) writeConfigLimitNum('line') writeConfigLimitNum('cpumen') cmd = '''ps -ef |grep %s|grep -v grep|wc -l''' % modname num = getoutput(cmd) if int(num) == 1: line() cpumen() else: log(modname, 3, '进程已经存在: %s' % modname) sys.exit()
elif table > lasttable: tablelist.append([table, 0]) else: shell = '''%s -e "select count(*) from %s;"|grep -v count''' % ( mysqlconf, alltablelist[-1]) retcode, ret = getstatusoutput(shell) if retcode: print 'mysql connected error' return if int(ret) and int(ret) > 100000: lastuserlogid = int(ret) - 100000 else: lastuserlogid = 0 tablelist.append([alltablelist[-1], int(lastuserlogid)]) return tablelist if __name__ == '__main__': writeConfigLimitNum('diamond') writeConfigLimitNum('welfare') modname = 'diamondNew.py' cmd = '''ps -ef |grep %s|grep -v grep|wc -l''' % modname num = getoutput(cmd) if int(num) == 1: welfareN_func() diamondN_func() else: print 'pidname is exists' sys.exit()
try: pass # sockettcp.send('<134>{"heartbeat":0}\n') #发送心跳信息 except: log(modname, 3, '发送心跳信息失败。: %s' % modname) return if json: try: # print '<134>%s\n'%json sockettcp.sendall('<134>%s\n' % json) print 'successful!!' # print 'finished send over!' #debuglog(mod=modname,content=json) except Exception, e: log(modname, 3, '发送采集数据失败。: %s %s' % (modname, json)) #debuglog(mod=modname,content='ERROR') try: sockettcp.connect((socketserver, int(socketport))) except: log(modname, 3, 'flume服务器连接不上。: %s' % modname) return # finally: sockettcp.close() if __name__ == '__main__': modname = 'rankNew' writeConfigLimitNum('rank') main(modname)
print str(e) sockettcp.close() log(modname, 3, '发送采集数据失败。: %s %s' % (modname, json)) try: time.sleep(2) sockettcp.connect((socketserver, int(socketport))) except: try: log(modname, 3, 'flume服务器连接不上。: %s' % modname) return except Exception, e: log(modname, 3, 'socket关闭异常。: %s' % str(e)) return if __name__ == '__main__': modname = 'actmodNew' writeConfigLimitNum('actmod') if 'game' not in hostname: print 'hostname error:%s' % hostname sys.exit() reviewprocess(mod=modname) if not checkpidfile(mod=modname): savemodpid(mod=modname) actmod_func() removemodpid(mod=modname) else: print '进程已经存在: %s' % modname log(modname, 3, '进程已经存在: %s' % modname) sys.exit()
atime = t[0:4]+'-'+t[4:6]+'-'+t[6:8]+t[8:] text = line.split(']')[2].strip('\n').replace("'","\'") senderNodeId,logTime,limitNum,headJson = getNodeIdAndType('gmlog','') if senderNodeId: jsonresult = headJson+'''{"zone":"%s","group":"%s","sender":"%s","receiver":"%s","fc":"%s","num":"%s","atime":"%s","cmd":"%s"}}''' jsonresults = jsonresult%( senderNodeId,logTime,limitNum,'p1-gmlog','1',area,group,sender,receiver,fc,num,atime,text ) except: log(modname, 3, '日志分析错误: %s' %line) return return jsonresults if __name__ == '__main__': writeConfigLimitNum('gmlog') if 'game' not in hostname: print 'hostname error:%s'%hostname sys.exit() modname = 'gmlogNew' reviewprocess(mod=modname) if not checkpidfile(mod=modname): savemodpid(mod=modname) gmlogN_func() removemodpid(mod=modname) #cmd = '''ps -ef |grep %s|grep -v grep|wc -l'''%modname #num = shell_cmd(cmd, modname) #if int(num) == 1: # gmlog_func() else: log(modname, 3, '进程已经存在: %s' %modname)
addtime = t[0:4] + '-' + t[4:6] + '-' + t[6:8] + t[8:] if senderNodeId: jsonresult = headJson + '''{"zone":"%s","mac":"%s","ip":"%s","name":"%s","addtime":"%s"}}''' jsonresult = jsonresult % ( str(senderNodeId), str(logTime), str(limitNum), 'p1-onlinemac', '1', str(area), str(mac), str(ip), str(name), str(addtime)) except: log(modname, 3, '日志分析错误: %s' % line) return print jsonresult return jsonresult if __name__ == '__main__': modname = 'macNew' writeConfigLimitNum('mac') if 'login' not in hostname: print 'hostname error:%s' % hostname sys.exit() reviewprocess(mod=modname) if not checkpidfile(mod=modname): savemodpid(mod=modname) print 'macN_funcmacN_funcmacN_func' macN_func() removemodpid(mod=modname) #cmd = '''ps -ef |grep %s|grep -v grep|wc -l'''%modname #num = shell_cmd(cmd, modname) #if int(num) == 1: # mac_func() else: log(modname, 3, '进程已经存在: %s' % modname)