</div> </fieldset> </form> </div> <div id="check_graph" class="col-md-9"> <?php if ($action == 'edit') { ?> <div class="sidebar" id="sidebar"> <fieldset> <p>Check : <?php echo $check->prepareName(); ?> </p> <p>Target : <?php echo Check::constructTarget($check); ?> </p> <p id="graphiteGraph"><?php echo Check::showGraph($check); ?> </p> <div class="row"> <div class="col-md-4"> <select id="graphiteDateRange" class="form-control"> <?php $dateRange = array('-12hours' => '12 Hours', '-1days' => '1 Day', '-3days' => '3 Days', '-7days' => '7 Days', '-14days' => '14 Days', '-30days' => '30 Days', '-60days' => '60 Days'); foreach ($dateRange as $value => $text) { fHTML::printOption($text, $value, '-3days'); } ?>
/** * Creates all Check related URLs for the site * * @param string $type The type of URL to make: 'list', 'add', 'edit', 'delete' * @param Meetup $obj The Check object for the edit and delete URL types * @return string The URL requested */ public static function showGraph($obj = NULL, $img = true, $sample = false, $width = false, $hideLegend = false) { if ($img) { $link = '<img id="renderedGraphImage" src="'; } else { $link = '<a href="'; } if ($GLOBALS['PRIMARY_SOURCE'] == "GANGLIA") { $parts = explode("_|_", $obj->prepareTarget()); $link .= $GLOBALS['GANGLIA_URL'] . "/graph.php?json=1&ce=now&c=" . $parts[0] . "&h=" . $parts[1] . "&m=" . $parts[2]; if ($sample !== False) { $link .= '&cs=' . $sample; } else { $link .= '&cs=-' . $obj->prepareSample() . 'minutes'; } } else { $link .= $GLOBALS['GRAPHITE_URL'] . '/render/?'; $link .= 'target=legendValue(alias(' . Check::constructTarget($obj) . '%2C%22Check : ' . $obj->prepareName() . '%22),%22last%22)'; if ($sample !== False) { $link .= '&from=' . $sample; } else { $link .= '&from=-' . $obj->prepareSample() . 'minutes'; } if ($width !== false) { $link .= '&width=' . $width; } else { $link .= '&width=' . $GLOBALS['GRAPH_WIDTH']; } $link .= '&height=' . $GLOBALS['GRAPH_HEIGHT']; $link .= '&target=color(alias(threshold(' . $obj->getError() . ')%2C%22Error%20(' . $obj->getError() . ')%22)%2C%22' . $GLOBALS['ERROR_COLOR'] . '%22)'; $link .= '&target=color(alias(threshold(' . $obj->getWarn() . ')%2C%22Warning%20(' . $obj->getWarn() . ')%22)%2C%22' . $GLOBALS['WARN_COLOR'] . '%22)'; if ($hideLegend !== false) { $link .= '&hideLegend=true'; } } if ($img) { $link .= '" title="' . $obj->prepareName() . '" alt="' . $obj->prepareName(); $link .= '" />'; } else { $link .= '"> ' . $obj->prepareTarget() . '</a>'; } return $link; }