List of usage examples for org.apache.cassandra.locator DynamicEndpointSnitchMBean getScores
@Deprecated
public Map<InetAddress, Double> getScores();
From source file:com.spotify.cassandra.opstools.DynamicSnitchDumper.java
License:Apache License
public static void main(String... args) throws IOException, MalformedObjectNameException { String host = "localhost"; if (args.length > 0) host = args[0];//from w w w. j a va 2 s . c o m int port = 7199; if (args.length > 1) port = Integer.parseInt(args[1]); boolean munin = false; if (args.length > 2 && args[2].equals("munin")) munin = true; boolean muninConfig = false; if (args.length > 3 && args[3].equals("config")) muninConfig = true; JMXServiceURL jmxUrl = new JMXServiceURL(String.format(fmtUrl, host, port)); Map<String, Object> env = new HashMap<String, Object>(); DynamicEndpointSnitchMBean dsnitch = getDSnitchMbean(jmxUrl, env); Map<InetAddress, Double> sorted = sortMap(dsnitch.getScores()); if (munin) { if (muninConfig) printMuninConfig(sorted); else printForMunin(sorted); } else { for (Map.Entry<InetAddress, Double> score : sorted.entrySet()) { System.out.println(score.getKey().getHostName() + " : " + score.getValue()); } } }