datastax / diagnostic-collection

Diagnostic Collector for Apache Cassandra
Apache License 2.0
28 stars 35 forks source link

list_cassandra_nodes does not use the path variable when executing nodetool to discover the node list. #83

Closed AndrewHogg closed 1 year ago

AndrewHogg commented 2 years ago

Within the configuration addPath / prependPath is used to ensure nodetool is on the path for the calling command - however if the nodes are specified via a single contact node and not a list of nodes then it attempts to auto-discover the cluster IPs. This is done in the list_cassandra_nodes() function. The function itself does not use the path configuration, and alludes to this. As a result, the liklihood is that if you needed to specify a path in the configuration to access nodetool, then it would also be needed for this part of the process.

# shellcheck disable=SC2086
list_cassandra_nodes() {
  # change this if there's an alias, or a full path needs to be specified
  nodetoolCmd="nodetool"

It should use the same pathing it's default approach, so that when the path is configured (because nodetool is not on the path) it doesn't fail with a nodetool not found from the this initial step.

michaelsembwever commented 2 years ago

The update_path() function is called when the script is run on the node, i.e. here.

While list_cassandra_nodes() directly runs nodetool … commands on the contact host, see here.

I am open to suggestions on how to use addPath and prependPath configurations in list_cassandra_nodes() … 🤷🏻‍♀️