Skip to content

Commit

Permalink
Merge pull request #86 from citrusleaf/TOOLS-1530
Browse files Browse the repository at this point in the history
Tools 1530
  • Loading branch information
dwelch-spike authored Aug 12, 2020
2 parents eca019a + 1e00919 commit 10f9bdf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
7 changes: 6 additions & 1 deletion asadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions lib/basiccontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/getcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand Down
8 changes: 8 additions & 0 deletions lib/utils/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def __init__(self, adict):
"execute": False,
"log-analyser": False,
"log-path": "",

"pmap": False
},
}

Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 10f9bdf

Please sign in to comment.