/** * 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 */ static public function showGraph($obj=NULL,$img=true,$sample=false,$width=false,$hideLegend=false) { if ($img) { $link = '<img 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(); } } else { $link .= $GLOBALS['GRAPHITE_URL'] . '/render/?'; $link .= 'target=legendValue(alias(' . $obj->prepareTarget() . '%2C%22Check : ' . $obj->prepareName() .'%22),%22last%22)'; if ($sample !== False) { $link .= '&from=' . $sample; } else { $link .= '&from=' . $obj->prepareSample(); } 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; }
/** * 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 setResultsLevel($value, $obj = NULL) { if ($obj->getOverUnder() == 0) { if ($value >= $obj->getError()) { $state = 1; } elseif ($value >= $obj->getWarn()) { $state = 2; } else { //echo 'all good ' . " $value <br />"; $state = 0; } return $state; } if ($obj->getOverUnder() == 1) { if ($value > $obj->getWarn()) { $state = 0; } elseif ($value > $obj->getError()) { $state = 2; } else { fCore::debug('error state' . " {$value} compared to " . $obj->getError() . "<br />", FALSE); $state = 1; } return $state; } }
/** * 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 */ static public function showGraph($obj=NULL,$img=true,$sample=false,$width=false,$hideLegend=false) { if ($img) { $link = '<img src="'; } else { $link = '<a href="'; } $link .= GRAPHITE_URL . '/render/?'; $link .= 'target=legendValue(alias(' . $obj->prepareTarget() . '%2C%22Check : ' . $obj->prepareName() .'%22),%22last%22)'; //$link .= 'target=legendValue(' . $obj->prepareTarget() .',%22last%22)'; if ($sample !== False) { $link .= '&from=' . $sample; } else { $link .= '&from=' . $obj->prepareSample(); } if ($width !== false) { $link .= '&width=' .$width; } else { $link .= '&width=' .GRAPH_WIDTH; } $link .= '&height=' .GRAPH_HEIGHT; $link .= '&target=color(alias(threshold('. $obj->getError() . ')%2C%22Error%20('. $obj->getError() . ')%22)%2C%22' . ERROR_COLOR . '%22)'; $link .= '&target=color(alias(threshold('. $obj->getWarn() . ')%2C%22Warning%20('. $obj->getWarn() . ')%22)%2C%22' . 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; }