def host_interval(host, begin, end): begin_str = Timestamp.format_timestamp(int(begin)) if begin_str is None: return(bottle.template('bad_value', host=host, filesys='n/a', begin=begin, end=end, data='n/a', value='begin')) end_str = Timestamp.format_timestamp(int(end)) if end_str is None: return(bottle.template('bad_value', host=host, filesys='n/a', begin=begin, end=end, data='n/a', value='end')) bulk_scratch = '/pylmt/%s/scratch/%s/%s/bulk' % (host, begin, end) bulk_scratch2 = '/pylmt/%s/scratch2/%s/%s/bulk' % (host, begin, end) metadata_scratch = '/pylmt/%s/scratch/%s/%s/metadata' % (host, begin, end) metadata_scratch2 = '/pylmt/%s/scratch2/%s/%s/metadata' % (host, begin, end) return(bottle.template('host_interval', host=host, begin=begin_str, end=end_str, bulk_scratch=bulk_scratch, bulk_scratch2=bulk_scratch2, metadata_scratch=metadata_scratch, metadata_scratch2=metadata_scratch2))
def do_main(args): """ args.both - Add together the read and write rates for calculation config - (file) The lmtrc config file telling how to get to the DB cpu - (boolean) Do the CPU utilization calculations (always set this true) fs - (string) The dbname entry in the config file for the file system of interest. index - (int) The index of the file system of interest in the config file oss - (string) The hostname of the OSS to be analyzed. read - Caclulate for the read data rate seconds - (int) The length of time over which to average the observations. threshold - (int) Sound the alarm if the average exceeds this value. default - 40: GiB for rates, or pct. CPU utilization verbose - (boolean) Turn on debugging output version - (boolean) print the version string and exit write - Calculate for the write data rate """ fsrc = LMTConfig.process_configuration(args) bulk = Bulk.Bulk(fsrc['dbname']) if args.verbose == True: bulk.debug() bulk.getOSSs(fsrc['conn']) now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # Now we want to generate the begin/end pair for this day end_sie = Timestamp.calc_sie(now) # This will be upset by savings time changes begin_sie = end_sie - args.seconds args.begin = Timestamp.format_timestamp(begin_sie) args.end = Timestamp.format_timestamp(end_sie) (beginTimestamp, endTimestamp) = Timestamp.process_timestamps(args, fsrc) Steps = TimeSteps.TimeSteps() Steps.getTimeSteps(beginTimestamp, endTimestamp, fsrc['conn']) bulk.setSteps(Steps) if (bulk.Steps == None) or (bulk.Steps.steps() == 0): print "pyalarm.do_main(): Warning - No steps from FS %s" % bulk.name return(None) bulk.getData() if args.cpu == True: bulk.getCPU() return(bulk)