def events(d, filters=''): results = [] dc_found = False if dcs: for dc in dcs: if dc['name'] == d: dc_found = True if check_connection(dc): results += get_events(dc, timeout, filters.split(',')) break if dc_found is False: abort(404) results = sorted( results, lambda x, y: _cmp(x['check']['status'], y['check']['status']), reverse=True) return render_template('events.html', dc=dc, data=results, filter_data=get_filter_data(dcs, timeout), appcfg=appcfg)
def filtered(filters): aggregated = [] for dc in dcs: if check_connection(dc): aggregated.append( agg_data(dc, get_data(dc, timeout), get_stashes(dc, timeout), get_clients(dc, timeout), filters)) return render_template('data.html', dcs=dcs, data=aggregated, filter_data=get_filter_data(dcs, timeout), appcfg=appcfg)
def root(): aggregated = list() pool = ThreadPool(len(dcs)) try: aggregated = pool.map(get_agg_data, dcs) except Exception as e: print("Exception: ", e) finally: pool.close() return render_template('data.html', dcs=dcs, data=aggregated, filter_data=get_filter_data(dcs, timeout), appcfg=appcfg)
def showgrid(d, filters=None): data_detail = {} if dcs: for dc in dcs: if dc['name'] == d: if check_connection(dc): if filters: clients = get_clients(dc, timeout) else: clients = None data_detail = agg_host_data(get_data(dc, timeout), get_stashes(dc, timeout), clients, filters) if data_detail: break else: abort(404) return render_template('detail.html', dc=dc, data=data_detail, filter_data=get_filter_data(dcs, timeout), appcfg=appcfg)