Esempio n. 1
0
 /**
  * @param array $graph_config
  * @param string $graph_time
  * @param int $width
  * @return string
  */
 private function getGangliaDashboardHTML($graph_config)
 {
     $is_dev = isset($graph_config['is_dev']) ? $graph_config['is_dev'] : false;
     $is_report = isset($graph_config['is_report']) ? $graph_config['is_report'] : false;
     $no_legend = isset($graph_config['no_legend']) ? $graph_config['no_legend'] : false;
     $until = isset($graph_config['until']) ? $graph_config['until'] : null;
     $g = new Graph_Ganglia($graph_config['graph_time'], $until);
     $g->isDev($is_dev);
     $metrics = $this->getMetrics($graph_config);
     for ($i = 0; $i < count($metrics); $i++) {
         $metric = $metrics[$i];
         $source = isset($metric['source']) ? $metric['source'] : null;
         $node = isset($metric['node']) ? $metric['node'] : null;
         $datum = isset($metric['datum']) ? $metric['datum'] : null;
         if ($is_report) {
             $g->addReport($source, $node, $datum);
         } else {
             $title = isset($graph_config['title']) ? $graph_config['title'] : '';
             $g->addMetric($source, $node, $datum, $title, null, $no_legend);
         }
     }
     if ($graph_config['show_deploys']) {
         $g->showDeploys(true);
     } else {
         $g->showDeploys(false);
     }
     return $g->getDashboardHTML('medium', $graph_config['width']);
 }