User Tools

Site Tools


due_to_source_code_changing_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
due_to_source_code_changing_2 [2013/08/16 15:43]
noskov
due_to_source_code_changing_2 [2013/08/16 15:50]
noskov
Line 314: Line 314:
           $tpl->​assign("​url",​ $url);           $tpl->​assign("​url",​ $url);
 </​code>​ </​code>​
 +
 +in order to list new IPMI metrics additionally in the cluster overview page the function start_cluster was changed to ganglia.php
 +<file changing ganglia.php>​
 +...
 +function start_cluster ($parser, $tagname, $attrs)
 +{
 +   ​global $clustername,​ $rrds, $metrics, $cluster, $self, $grid, $hosts_up, $hosts_down;​
 +   ​static $hostname;
 +
 +   ​switch ($tagname)
 +      {
 +         case "​GANGLIA_XML":​
 +            preamble($attrs);​
 +            break;
 +         case "​GRID":​
 +            $self = $attrs['​NAME'​];​
 +            $grid = $attrs;
 +            break;
 +
 +         case "​CLUSTER":​
 +            $cluster = $attrs;
 +            break;
 +
 +         case "​HOST":​
 +            $hostname = $attrs['​NAME'​];​
 +
 +            if (host_alive($attrs,​ $cluster))
 +               {
 +   isset($cluster['​HOSTS_UP'​]) or $cluster['​HOSTS_UP'​] = 0;
 +                  $cluster['​HOSTS_UP'​]++;​
 +                  $hosts_up[$hostname] = $attrs;
 +               }
 +            else
 +               {
 +   isset($cluster['​HOSTS_DOWN'​]) or $cluster['​HOSTS_DOWN'​] = 0;
 +                  $cluster['​HOSTS_DOWN'​]++;​
 +                  $hosts_down[$hostname] = $attrs;
 +               }
 +            # Pseudo metrics - add useful HOST attributes like gmond_started & last_reported to the metrics list:
 +            $metrics[$hostname]['​gmond_started'​]['​NAME'​] = "​GMOND_STARTED";​
 +            $metrics[$hostname]['​gmond_started'​]['​VAL'​] = $attrs['​GMOND_STARTED'​];​
 +            $metrics[$hostname]['​gmond_started'​]['​TYPE'​] = "​timestamp";​
 +            $metrics[$hostname]['​last_reported'​]['​NAME'​] = "​REPORTED";​
 +            $metrics[$hostname]['​last_reported'​]['​VAL'​] = uptime($cluster['​LOCALTIME'​] - $attrs['​REPORTED'​]);​
 +            $metrics[$hostname]['​last_reported'​]['​TYPE'​] = "​string";​
 +            $metrics[$hostname]['​ip_address'​]['​NAME'​] = "​IP";​
 +            $metrics[$hostname]['​ip_address'​]['​VAL'​] = $attrs['​IP'​];​
 +            $metrics[$hostname]['​ip_address'​]['​TYPE'​] = "​string";​
 +            $metrics[$hostname]['​location'​]['​NAME'​] = "​LOCATION";​
 +            $metrics[$hostname]['​location'​]['​VAL'​] = $attrs['​LOCATION'​];​
 +            $metrics[$hostname]['​location'​]['​TYPE'​] = "​string";​
 +
 +     /* Addition of IPMI metrics */
 +     $rrddir = "​$rrds/​$clustername/​$hostname";​
 +     $metrics=add_ipmi_metrics_cview($hostname,​$metrics,​$rrddir);​
 +     #​error_log("​rrd= $rrddir"​);​
 +
 +            break;
 +
 +         case "​METRIC":​
 +            $metricname = $attrs['​NAME'​];​
 +            $metrics[$hostname][$metricname] = $attrs;
 +            break;
 +
 +         ​default:​
 +            break;
 +      }
 +}
 +...
 +</​file>​
due_to_source_code_changing_2.txt · Last modified: 2013/08/16 15:53 by noskov