title: Get Cassandra node state for bash script
body: <p>I need to get Cassandra node status in some variable for further using it in bash script. How to make thst in most efficient way?</p>
  
  <p>I know that I can get status from</p>
  
  <pre><code># nodetool status
  Datacenter: DC1
  ===============
  Status=Up/Down
  |/ State=Normal/Leaving/Joining/Moving
  --  Address        Load       Tokens       Owns    Host ID                               Rack
  UJ  10.131.75.142  698.74 KB  256          ?       d032b36b-ffb6-496a-b814-bab399ce8a1f  RAC2
  UN  10.131.75.141  729.76 KB  256          ?       739c1e5f-2ff4-4bfa-9ae8-4f64ff061ce9  RAC1
  Datacenter: DC2
  ===============
  Status=Up/Down
  |/ State=Normal/Leaving/Joining/Moving
  --  Address        Load       Tokens       Owns    Host ID                               Rack
  UN  10.131.75.144  19.12 MB   256          ?       47430976-dee6-40bb-bce2-2a9f8d401aba  RAC2
  UN  10.131.75.143  28.98 MB   256          ?       7b3faef4-ba62-4d1d-87f8-9b0b082a0011  RAC1
  </code></pre>
  
  <p>Or (mode value)</p>
  
  <pre><code># nodetool netstats
  Mode: NORMAL
  Not sending any streams.
  Read Repair Statistics:
  Attempted: 0
  Mismatch (Blocking): 0
  Mismatch (Background): 0
  Pool Name                    Active   Pending      Completed
  Large messages                  n/a         0              0
  Small messages                  n/a         0              7
  Gossip messages                 n/a         0          12199
  </code></pre>
  
  <p>But maybe exists better way?</p>