title: Cassandra status check using nodejs
body: <p>I use the nodejs in three environments and the Cassandra is running in all the three nodes.</p>
  
  <p>I totally understand using <code>nodetool status</code> I will be able to get the status of each node. But the problem is If my current node is down then I will not be able to perform nodetool status in the current node, So Is there a way to get the status using nodejs Cassandra driver?</p>
  
  <p>Any help is appreciated.</p>
  
  <p><strong><em>EDITED :</em></strong></p>
  
  <p>As per dilsingi's suggestion, I used the client.hosts but the problem is, In the following cluster, 172.30.56.61 is down still it is showing as available.
  How to get the status of each node? </p>
  
  <pre><code>const cassandra = require('cassandra-driver');
  const client = new cassandra.Client({ contactPoints: ['172.30.56.60','172.30.56.61','172.30.56.62'], keyspace: 'test', policies : { loadBalancing : new cassandra.policies.loadBalancing.RoundRobinPolicy }});
  
      async function read() {
          client.connect().then(function () {
            console.log('Connected to cluster with %d host(s): %j', client.hosts.length, client.hosts.keys());
            client.hosts.forEach(function (host) {
         console.log(host.address, host.datacenter, host.rack);
      });
  
          });
      }
  
      read();
  </code></pre>
  
  <p>nodeTool status output :</p>
  
  <pre><code>Datacenter: newyork
  ===================
  Status=Up/Down
  
      |/ State=Normal/Leaving/Joining/Moving
      --  Address       Load       Tokens       Owns (effective)  Host ID                               Rack
      UN  172.30.56.62  1.13 MiB   256          34.8%             e93827b7-ba43-4fba-8a51-4876832b5b22  rack1
      DN  172.30.56.60  1.61 MiB   256          33.4%             e385af22-803e-4313-bee2-16219f73c213  rack1
      UN  172.30.56.61  779.4 KiB  256          31.8%             be7fc52e-c45d-4380-85a3-4cbf6d007a5d  rack1
  
  
  Node Js Code :
  
      const cassandra = require('cassandra-driver');
      const client = new cassandra.Client({ contactPoints: ['172.30.56.60','172.30.56.61','172.30.56.62'], keyspace: 'qcs', policies : { loadBalancing : new cassandra.policies.loadBalancing.RoundRobinPolicy }});
  
      async function read() {
          client.connect().then(function () {
            console.log('Connected to cluster with %d host(s): %j', client.hosts.length, client.hosts.keys());
            client.hosts.forEach(function (host) {
                 console.log(host.address, host.datacenter, host.rack, host.isUp(), host.canBeConsideredAsUp());
            });
  
          });
      }
  
      read();
  </code></pre>
  
  <p>NodeJs output : </p>
  
  <pre><code>    Connected to cluster with 3 host(s): ["172.30.56.60:9042","172.30.56.61:9042","172.30.56.62:9042"]
      172.30.56.60:9042 newyork rack1 true true
      172.30.56.61:9042 newyork rack1 true true
      172.30.56.62:9042 newyork rack1 true true
  </code></pre>