/** * @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']); }
$tabs = Dashboard::$DB_TABS; $tab_url = Dashboard::getTabUrl(__FILE__); include 'phplib/template_tabs.php'; ?> <form id="controls" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <?php echo Controls::buildTimeControl($time, $times); ?> </form> <div class='section'> <?php $activity_arr = array('pgb_v2_avg_querytime', 'pgb_v2_avg_req', 'pgb_v2_cl_active', 'pgb_v2_cl_waiting', 'pgb_v2_sv_active', 'pgb_v2_sv_idle', 'pgb_v2_sv_used'); foreach ($pgbouncer_cluster_arr as &$cluster) { echo "<h2>{$cluster["name"]} pgBouncer pool status (" . Dashboard::displayTime($time) . ")</h2>"; foreach ($activity_arr as &$activity) { $g = new Graph_Ganglia($time); $g->addMetric("{$cluster["name"]}", "{$cluster["machines"]}", "{$activity}"); echo $g->getDashboardHTML('medium', GraphConstants::THREE_GRAPH_WIDTH); } } ?> </div> </body> </html>