Check Memory Usage and Other Things without Cluster Admin

#1

The Jvm type can be a useful resource that allows you to profile memory usage on your nodes as well as many other things. Below is a script you can use to check old_gen percentage on all your cluster nodes.

Cluster.hosts().forEach(function(n) {
	c3Tunnel(n.nodeId+":8080");
	console.log(n.nodeId, ": ", Jvm.memory().pools['PS Old Gen'].percentage, "%");
})
c3Tunnel()
1 Like

#2

I have had issues where the Jvm.memory() would fail due to various problems which would cause the tunnel to never exit which can become a hassle. I use this one to prevent that:

Cluster.hosts().forEach(n => {
  try {
    c3Tunnel(n.nodeId + ":8080");
    console.log(n.nodeId, ": ", Jvm.memory().pools['PS Old Gen'].percentage);
  } catch (err) {
    console.log(n.nodeId + ': Failed to get memory')
    console.log('\t' + err.message)
  }
})
c3Tunnel()
1 Like