.
[corvix.git] / var / deb-package / cluster_raw_old / opt / cluster / lib / www / ganglia / get_ganglia.php
blobe3db785fecba9f991d9d5c489352a34a59127870
1 <?php
2 # $Id: get_ganglia.php 589 2005-10-10 07:42:26Z knobi1 $
3 # Retrieves and parses the XML output from gmond. Results stored
4 # in global variables: $clusters, $hosts, $hosts_down, $metrics.
5 # Assumes you have already called get_context.php.
8 if (! Gmetad($ganglia_ip, $ganglia_port) )
10 print "<H4>There was an error collecting ganglia data ".
11 "($ganglia_ip:$ganglia_port): $error</H4>\n";
12 exit;
15 # If we have no child data sources, assume something is wrong.
16 if (!count($grid) and !count($cluster))
18 print "<H4>Ganglia cannot find a data source. Is gmond running?</H4>";
19 exit;
22 # If we only have one cluster source, suppress MetaCluster output.
23 if (count($grid) == 2 and $context=="meta")
25 # Lets look for one cluster (the other is our grid).
26 foreach($grid as $source)
27 if (isset($source['CLUSTER']) and $source['CLUSTER'])
29 $standalone = 1;
30 $context = "cluster";
31 # Need to refresh data with new context.
32 Gmetad($ganglia_ip, $ganglia_port);
33 $clustername = $source['NAME'];