def stats(self, context, pool): result = {"stats": {}, "members": {}} with a10.A10Context(self, context, pool) as c: name = pool.id if name is not None: stats = c.client.slb.service_group.stats(name) result["stats"] = stats.get("stats", {}) result["members"] = stats.get("members", {}) return result
def stats(self, context, lb): with a10.A10Context(self, context, lb) as c: name = self.meta(lb, 'id', lb.id) resp = c.client.slb.virtual_server.stats(name) if not resp: return { "bytes_in": 0, "bytes_out": 0, "active_connections": 0, "total_connections": 0, "extended_stats": {} } if c.device_cfg.get('api_version') == "3.0": return self._stats_v30(c, resp, name) else: return self._stats_v21(c, resp)
def stats(self, context, lb_obj): with a10.A10Context(self, context, lb_obj) as c: try: r = c.client.slb.virtual_server.stats(lb_obj.id) return { "bytes_in": r["virtual_server_stat"]["req_bytes"], "bytes_out": r["virtual_server_stat"]["resp_bytes"], "active_connections": r["virtual_server_stat"]["cur_conns"], "total_connections": r["virtual_server_stat"]["tot_conns"] } except Exception: return { "bytes_in": 0, "bytes_out": 0, "active_connections": 0, "total_connections": 0 }
def stats(self, context, member): retval = { "servers_up": 0, "servers_down": 0, "servers_disable": 0, "servers_total": 0 } try: with a10.A10Context(self, context, member) as c: server_ip = self.neutron.member_get_ip( context, member, c.device_cfg['use_float']) server_name = self._meta_name(member, server_ip) stats = c.client.slb.service_group.member.stats( name=server_name) retval = stats except Exception as ex: LOG.exception(ex) finally: pass return retval