def GET(self): clusters = db.get_clusters() clusters = list(clusters) return render.index(clusters)
def GET(self, tid): global fail_filter clusters = db.get_clusters() clusters = list(clusters) cluster = db.get_cluster(tid) cluster_version = db.get_cluster_version(tid) if cluster_version is None: cluster_version = web.Storage(version='0.0.0.0', build='9999', oem='ARUBA') _aps = db.get_aps(tid) aps = [] ap = {} ap_count = 0 entry_count=web.Storage(warning=0, error=0, passed=0) for _ap in _aps: ap_count += 1 ap['name'] = _ap.name ap['type'] = _ap.type ap['uptime'] = _ap.uptime ap['status'] = _ap.status ap['time'] = _ap.time ap['ip'] = _ap.ip ap['clients'] = _ap.clientCount ap['entry_status'] = 0 ap['id'] = _ap.id mem = db.get_memory(_ap.id) if mem: ap['mem_free'] = mem.memoryFree ap['mem_used'] = mem.memoryTotal - mem.memoryFree ap['mem_time'] = mem.time else: ap['mem_free'] = 'NULL' ap['mem_used'] = 'NULL' ap['mem_time'] = 'NULL' cpu = db.get_cpu(_ap.id) if cpu: ap['cpu_idle'] = cpu.idle ap['cpu_time'] = cpu.time else: ap['cpu_idle'] = 'NULL' ap['cpu_time'] = 'NULL' for f in fail_filter: if f in _ap.status: ap['entry_status'] += -1 break if ap['cpu_idle'] <= 10: ap['entry_status'] += -2 if ap['entry_status'] == 0 and \ ('Null' in ap['status'] or \ 'NULL' in str(ap['mem_free']) or \ 'NULL' in str(ap['cpu_idle'])): ap['entry_status'] = 1 if ap['entry_status'] == 1: entry_count.warning += 1 elif ap['entry_status'] < 0: entry_count.error += 1 else: entry_count.passed += 1 aps.append(ap) ap = {} return render.view(clusters, cluster, cluster_version, aps, ap_count, entry_count)
def GET(self): clusters = db.get_clusters() clusters = list(clusters) return render.performance(clusters)