@Ignore @Test public void clusterTest() { System.out.println("----- ClusterTest -----"); Ganglia g = new Ganglia(); Cluster c = g.getClusterInfo(clusterName); if (c == null) { System.out.println("No cluster '" + clusterName + "' found"); } else { System.out.println("Number of hosts in cluster " + clusterName + ": " + c.getHosts().size()); System.out.println("Name: " + c.getName()); for (Host host : c.getHosts()) { Assert.assertTrue(host.getLoadFive() >= 0); Assert.assertTrue(host.getLoadFifteen() >= 0); Assert.assertTrue(host.getCPUUser() >= 0); Assert.assertTrue(host.getCPUNice() >= 0); Assert.assertTrue(host.getCPUSystem() >= 0); Assert.assertTrue(host.getCPUIdle() >= 0); Assert.assertTrue(host.getCPUWio() >= 0); Assert.assertTrue(host.getDiskTotal() >= 0); Assert.assertTrue(host.getDiskFree() >= 0); Assert.assertTrue(host.getDiskUsed() >= 0); } } System.out.println("----------"); }
public Cluster getClusterInfo(String clusterName) { String gangliaXml = null; ArrayList<Cluster> cluster_list = new ArrayList<Cluster>(); Cluster ret_cluster = null; try { ParseGanglia p = new ParseGanglia(gangliaCollectorIP, gangliaPort, gangliaPortQuery); gangliaXml = p.queryGanglia("/" + clusterName); cluster_list = (ArrayList<Cluster>) p.parseGangliaXml(gangliaXml); } catch (MonitoringException ex) { Logger.getLogger(Ganglia.class.getName()).log(Level.SEVERE, null, ex); } for (Cluster cluster : cluster_list) { if (cluster.getName().equals(clusterName)) { ret_cluster = cluster; } } return ret_cluster; }
Ganglia { public Cluster getClusterInfo(String clusterName) { String gangliaXml = null; ArrayList<Cluster> cluster_list = new ArrayList<Cluster>(); Cluster ret_cluster = null; try { ParseGanglia p = new ParseGanglia(gangliaCollectorIP, gangliaPort, gangliaPortQuery); gangliaXml = p.queryGanglia("/" + clusterName); cluster_list = (ArrayList<Cluster>) p.parseGangliaXml(gangliaXml); } catch (MonitoringException ex) { Logger.getLogger(Ganglia.class.getName()).log(Level.SEVERE, null, ex); } for (Cluster cluster : cluster_list) { if (cluster.getName().equals(clusterName)) { ret_cluster = cluster; } } return ret_cluster; } }
Ganglia { public Cluster getClusterInfo(String clusterName) { String gangliaXml = null; ArrayList<Cluster> cluster_list = new ArrayList<Cluster>(); Cluster ret_cluster = null; try { ParseGanglia p = new ParseGanglia(gangliaCollectorIP, gangliaPort, gangliaPortQuery); gangliaXml = p.queryGanglia("/" + clusterName); cluster_list = (ArrayList<Cluster>) p.parseGangliaXml(gangliaXml); } catch (MonitoringException ex) { Logger.getLogger(Ganglia.class.getName()).log(Level.SEVERE, null, ex); } for (Cluster cluster : cluster_list) { if (cluster.getName().equals(clusterName)) { ret_cluster = cluster; } } return ret_cluster; } Ganglia(); }
Ganglia { public Cluster getClusterInfo(String clusterName) { String gangliaXml = null; ArrayList<Cluster> cluster_list = new ArrayList<Cluster>(); Cluster ret_cluster = null; try { ParseGanglia p = new ParseGanglia(gangliaCollectorIP, gangliaPort, gangliaPortQuery); gangliaXml = p.queryGanglia("/" + clusterName); cluster_list = (ArrayList<Cluster>) p.parseGangliaXml(gangliaXml); } catch (MonitoringException ex) { Logger.getLogger(Ganglia.class.getName()).log(Level.SEVERE, null, ex); } for (Cluster cluster : cluster_list) { if (cluster.getName().equals(clusterName)) { ret_cluster = cluster; } } return ret_cluster; } Ganglia(); ArrayList<Cluster> getGridInfo(); Cluster getClusterInfo(String clusterName); Host getHostInfo(String clusterName, String hostName); ClusterSummary getClusterSummaryInfo(String clusterName); void fetchData(String clusterName, String hostName, String metric, Integer startTime); }
Ganglia { public Cluster getClusterInfo(String clusterName) { String gangliaXml = null; ArrayList<Cluster> cluster_list = new ArrayList<Cluster>(); Cluster ret_cluster = null; try { ParseGanglia p = new ParseGanglia(gangliaCollectorIP, gangliaPort, gangliaPortQuery); gangliaXml = p.queryGanglia("/" + clusterName); cluster_list = (ArrayList<Cluster>) p.parseGangliaXml(gangliaXml); } catch (MonitoringException ex) { Logger.getLogger(Ganglia.class.getName()).log(Level.SEVERE, null, ex); } for (Cluster cluster : cluster_list) { if (cluster.getName().equals(clusterName)) { ret_cluster = cluster; } } return ret_cluster; } Ganglia(); ArrayList<Cluster> getGridInfo(); Cluster getClusterInfo(String clusterName); Host getHostInfo(String clusterName, String hostName); ClusterSummary getClusterSummaryInfo(String clusterName); void fetchData(String clusterName, String hostName, String metric, Integer startTime);  }