Skip to content

Commit

Permalink
add addl jmx args option to nodetool
Browse files Browse the repository at this point in the history
  • Loading branch information
eedgar committed Nov 21, 2022
1 parent 81cca17 commit 4f5a367
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions cstar/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,4 @@ def _add_ssh_arguments(parser):
def _add_jmx_auth_arguments(parser):
parser.add_argument('--jmx-username', help='JMX username', default=None)
parser.add_argument('--jmx-passwordfile', help='JMX passwordfile', default=None)
parser.add_argument('--jmx-addlargs', help='JMX args passed to nodetool', default=None)
1 change: 1 addition & 0 deletions cstar/cstarcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def execute_command(args):
jmx_username=args.jmx_username,
jmx_password=args.jmx_password,
jmx_passwordfile=args.jmx_passwordfile,
addl_jmx_args=args.jmx_addlargs,
resolve_hostnames=args.resolve_hostnames,
hosts_variables=hosts_variables)
job.run()
Expand Down
10 changes: 8 additions & 2 deletions cstar/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self):
self.jmx_username = None
self.jmx_password = None
self.jmx_passwordfile = None
self.addl_jmx_args = None
self.hosts_variables = dict()
self.returned_jobs = list()
self.schema_versions = list()
Expand Down Expand Up @@ -240,15 +241,19 @@ def run_nodetool(self, conn, *cmds):
jmx_args.extend(["-pw", self.jmx_password])
if self.jmx_passwordfile:
jmx_args.extend(["-pwf", self.jmx_passwordfile])

if self.addl_jmx_args:
self.addl_jmx_args = self.addl_jmx_args.replace('\\','')
jmx_args.extend([self.addl_jmx_args])

return conn.run((*sudo, "nodetool", *jmx_args, *cmds))

def setup(self, hosts, seeds, command, job_id, strategy, cluster_parallel, dc_parallel, job_runner,
max_concurrency, timeout, env, use_sudo, sudo_args, stop_after, key_space, output_directory,
ignore_down_nodes, dc_filter,
sleep_on_new_runner, sleep_after_done,
ssh_username, ssh_password, ssh_identity_file, ssh_lib,
jmx_username, jmx_password, jmx_passwordfile, resolve_hostnames, hosts_variables):
jmx_username, jmx_password, jmx_passwordfile, addl_jmx_args,
resolve_hostnames, hosts_variables):

msg("Starting setup")

Expand All @@ -275,6 +280,7 @@ def setup(self, hosts, seeds, command, job_id, strategy, cluster_parallel, dc_pa
self.jmx_username = jmx_username
self.jmx_password = jmx_password
self.jmx_passwordfile = jmx_passwordfile
self.addl_jmx_args = addl_jmx_args
self.resolve_hostnames = resolve_hostnames
self.hosts_variables = hosts_variables
if not os.path.exists(self.output_directory):
Expand Down
1 change: 1 addition & 0 deletions cstar/jobreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _parse(input, file, output_directory, job, job_id, stop_after, max_days, end
job.sudo_args = data['sudo_args']
job.jmx_username = data['jmx_username']
job.jmx_passwordfile = data['jmx_passwordfile']
job.addl_jmx_args = data['addl_jmx_args']
job.hosts_variables = data['hosts_variables']

strategy = cstar.strategy.parse(state['strategy'])
Expand Down
1 change: 1 addition & 0 deletions tests/jobreader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def get_example_file():
"timeout": null,
"jmx_username": null,
"jmx_passwordfile": null,
"addl_jmx_args": null,
"use_sudo": "false",
"version": 8,
"hosts_variables": null
Expand Down
1 change: 1 addition & 0 deletions tests/resources/failed_job.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"timeout": null,
"jmx_username": null,
"jmx_passwordfile": null,
"addl_jmx_args": null,
"use_sudo": false,
"version": 8,
"hosts_variables": null
Expand Down

0 comments on commit 4f5a367

Please sign in to comment.