def parse_snmp_data(source_dir): """ This method reads the content of the snmpwalk-worker files into our python methods. This is necessary for inserting the content into the databackend and into the rrd files. """ doc = {} timestamps = set() files = glob.glob(source_dir + "/*.txt") time_begin = time.time() time_current = time.time() time_last = time.time() counter = 0 for file in files: (read_lines, timestamp, doc) = snmp_preprocess.parse_snmp_file(file, doc) counter += read_lines timestamps.add(timestamp) # output some performance statistics time_current = time.time() if (time_current - time_last > 5): #print "Processed %s lines in %s seconds (%s lines per second)" % ( #counter, time_current - time_begin, counter / (time_current - time_begin)) time_last = time_current if (time_current - time_last > 5): #print "Processed %s lines in %s seconds (%s lines per second)" % ( #counter, time_current - time_begin, counter / (time_current - time_begin)) time_last = time_current if len(timestamps) != 1: print "ERROR: There should only be a single timestamp in the directory. Check your configuration ..." sys.exit(1) return doc
def parse_snmp_data(source_dir): doc = {} timestamps = set() files = glob.glob(source_dir + "/*.txt") time_begin = time.time() time_current = time.time() time_last = time.time() counter = 0 for file in files: (read_lines, timestamp, doc) = snmp_preprocess.parse_snmp_file(file, doc) counter += read_lines timestamps.add(timestamp) # do statistical calculation time_current = time.time() if time_current - time_last > 5: print "Processed %s lines in %s seconds (%s lines per second)" % ( counter, time_current - time_begin, counter / (time_current - time_begin), ) time_last = time_current if time_current - time_last > 5: print "Processed %s lines in %s seconds (%s lines per second)" % ( counter, time_current - time_begin, counter / (time_current - time_begin), ) time_last = time_current if len(timestamps) != 1: print "ERROR: There should only be a single timestamp in the directory. Check your configuration ..." sys.exit(1) return doc
def parse_snmp_data(source_dir): """ This method reads the content of the snmpwalk-worker files into our python methods. This is necessary for inserting the content into the databackend and into the rrd files. """ doc = {} timestamps = set() files = glob.glob(source_dir + "/*.txt") time_begin = time.time() time_current = time.time() time_last = time.time() counter = 0 for file in files: (read_lines, timestamp, doc) = snmp_preprocess.parse_snmp_file(file, doc) counter += read_lines timestamps.add(timestamp) # output some performance statistics time_current = time.time() if (time_current - time_last > 5): #print "Processed %s lines in %s seconds (%s lines per second)" % ( #counter, time_current - time_begin, counter / (time_current - time_begin)) time_last = time_current if (time_current - time_last > 5): #print "Processed %s lines in %s seconds (%s lines per second)" % ( #counter, time_current - time_begin, counter / (time_current - time_begin)) time_last = time_current if len(timestamps) != 1 and len(timestamps) != 0: print "ERROR: There should only be a single timestamp in the directory. Check your configuration ..." sys.exit(1) return doc
def parse_snmp_data(source_dir): doc = {} timestamps = set() files = glob.glob(source_dir + "/*.txt") time_begin = time.time() time_current = time.time() time_last = time.time() counter = 0 for file in files: (read_lines, timestamp, doc) = snmp_preprocess.parse_snmp_file(file, doc) counter += read_lines timestamps.add(timestamp) # do statistical calculation time_current = time.time() if (time_current - time_last > 5): print "Processed %s lines in %s seconds (%s lines per second)" % ( counter, time_current - time_begin, counter / (time_current - time_begin)) time_last = time_current if (time_current - time_last > 5): print "Processed %s lines in %s seconds (%s lines per second)" % ( counter, time_current - time_begin, counter / (time_current - time_begin)) time_last = time_current if len(timestamps) != 1: print "ERROR: There should only be a single timestamp in the directory. Check your configuration ..." sys.exit(1) return doc