diff --git a/asadm.py b/asadm.py index 623f4a8b..621a833e 100755 --- a/asadm.py +++ b/asadm.py @@ -567,6 +567,10 @@ def main(): if cli_args.no_color: disable_coloring() + + if cli_args.pmap: + from lib.basiccontroller import CollectinfoController + CollectinfoController.get_pmap = True mode = AdminMode.LIVE_CLUSTER if cli_args.collectinfo: @@ -624,7 +628,8 @@ def main(): mode=mode, ssl_context=ssl_context, only_connect_seed=cli_args.single_node, - execute_only_mode=execute_only_mode, timeout=cli_args.timeout) + execute_only_mode=execute_only_mode, + timeout=cli_args.timeout) use_yappi = False if cli_args.profile: diff --git a/lib/basiccontroller.py b/lib/basiccontroller.py index 39350dd5..2ff9c597 100644 --- a/lib/basiccontroller.py +++ b/lib/basiccontroller.py @@ -974,6 +974,8 @@ def _do_default(self, line): @CommandHelp('"collectinfo" is used to collect cluster info, aerospike conf file and system stats.') class CollectinfoController(BasicCommandController): + get_pmap = False + def __init__(self): self.modifiers = set(['with']) self.aslogfile = "" @@ -1288,7 +1290,8 @@ def _get_collectinfo_data_json(self, default_user, default_pwd, default_ssh_port latency_map = self._get_as_latency() - pmap_map = self._get_as_pmap() + if CollectinfoController.get_pmap: + pmap_map = self._get_as_pmap() sys_map = self.cluster.info_system_statistics(default_user=default_user, default_pwd=default_pwd, default_ssh_key=default_ssh_key, default_ssh_port=default_ssh_port, credential_file=credential_file, nodes=self.nodes, @@ -1313,7 +1316,7 @@ def _get_collectinfo_data_json(self, default_user, default_pwd, default_ssh_port if node in latency_map: dump_map[node]['as_stat']['latency'] = latency_map[node] - if node in pmap_map: + if CollectinfoController.get_pmap and node in pmap_map: dump_map[node]['as_stat']['pmap'] = pmap_map[node] # Get the cluster name and add one more level in map diff --git a/lib/getcontroller.py b/lib/getcontroller.py index c5e0e1e0..851cb696 100644 --- a/lib/getcontroller.py +++ b/lib/getcontroller.py @@ -637,11 +637,13 @@ def get_pmap(self, nodes='all'): getter = GetStatisticsController(self.cluster) node_ids = util.Future(self.cluster.info, 'node', nodes=nodes).start() pmap_info = util.Future(self.cluster.info, 'partition-info', nodes=nodes).start() - service_stats = getter.get_service(nodes=nodes) - namespace_stats = getter.get_namespace(nodes=nodes) + service_stats = util.Future(getter.get_service, nodes=nodes).start() + namespace_stats = util.Future(getter.get_namespace, nodes=nodes).start() node_ids = node_ids.result() pmap_info = pmap_info.result() + service_stats = service_stats.result() + namespace_stats = namespace_stats.result() cluster_keys = {} for node in list(service_stats.keys()): diff --git a/lib/utils/conf.py b/lib/utils/conf.py index 8c37185e..70bc5a3f 100644 --- a/lib/utils/conf.py +++ b/lib/utils/conf.py @@ -80,6 +80,8 @@ def __init__(self, adict): "execute": False, "log-analyser": False, "log-path": "", + + "pmap": False }, } @@ -417,6 +419,7 @@ def print_config_help(): print (" --single-node Enable asadm mode to connect only seed node. \n" " By default asadm connects to all nodes in cluster.") print (" --collectinfo Start asadm to run against offline collectinfo files.") + print (" --pmap Include partition map analysis in collectinfo files.") print (" --log-analyser Start asadm in log-analyser mode and analyse data from log files.") print (" -f --log-path=path Path of cluster collectinfo file or directory \n" " containing collectinfo and system info files.") @@ -615,6 +618,11 @@ def get_cli_args(): add_fn("--tls_crl_check", action="store_true") add_fn("--tls_crl_check_all", action="store_true") + ### collectinfo options ### + # include pmap analysis in collect info file. + # Usage, `asadm collectinfo --pmap` + add_fn("--pmap", action="store_true") + if have_argparse: return parser.parse_args()