当前位置: 首页>>代码示例>>PHP>>正文


PHP Check::prepareTarget方法代码示例

本文整理汇总了PHP中Check::prepareTarget方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::prepareTarget方法的具体用法?PHP Check::prepareTarget怎么用?PHP Check::prepareTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Check的用法示例。


在下文中一共展示了Check::prepareTarget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dirname

<?php

include dirname(__FILE__) . '/../inc/init.php';
fAuthorization::requireLoggedIn();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$debug = fRequest::get('debug', 'boolean');
if (!$debug) {
    header('Content-type: application/json');
}
$check_id = fRequest::get('check_id', 'integer');
$check = new Check($check_id);
$url = GRAPHITE_URL . '/graphlot/rawdata?&from=-24hour&until=-0hour' . '&target=' . $check->prepareTarget() . '&target=keepLastValue(threshold(' . $check->prepareWarn() . '))';
//       '&target=threshold(' . $check->prepareError() . ')';
$contents = file_get_contents($url);
//$contents = file_get_contents(GRAPHITE_URL . '/graphlot/rawdata?&from=-24hour&until=-0hour&target=' . $check->prepareTarget() . '&target=' . $check->prepareWarn() . '&target=' . $check->prepareError());
print $contents;
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:17,代码来源:get_rawdata.php

示例2: getData

 /**
  * Requests Graphite Data for check
  *
  * @param  Check $obj   The Check object to get the graphite data for
  * @return array either a Graphite json_data array or an empty one
  */
 public static function getData($obj = NULL)
 {
     if ($obj->getType() == 'threshold') {
         if ($GLOBALS['PRIMARY_SOURCE'] == "GANGLIA") {
             $check_url = $GLOBALS['GANGLIA_URL'] . '/graph.php/?' . 'target=' . $obj->prepareTarget() . '&cs=-' . $obj->prepareSample() . 'minutes' . '&ce=now&format=json';
         } else {
             $target = Check::constructTarget($obj);
             $target = str_replace("&quot;", "\"", $target);
             $target = urlencode($target);
             $check_url = $GLOBALS['PROCESSOR_GRAPHITE_URL'];
             if ($check_url == "") {
                 $check_url = $GLOBALS['GRAPHITE_URL'];
             }
             $check_url = "{$check_url}/render/?target={$target}&format=json";
             if ($GLOBALS['ALERTS_TIME_OFFSET'] > 0) {
                 $check_url .= "&from=-" . ($obj->getSample() + $GLOBALS['ALERTS_TIME_OFFSET']) . "minutes" . "&until=-" . $GLOBALS['ALERTS_TIME_OFFSET'] . "minutes";
             } else {
                 $check_url .= '&from=-' . $obj->prepareSample() . 'minutes';
             }
         }
         $json_data = @file_get_contents($check_url);
         if ($json_data) {
             $data = json_decode($json_data);
             if (count($data) <= 0) {
                 fCore::debug("bad json data for {$check_url}\n", FALSE);
                 fCore::debug("Json: {$json_data}\n");
             }
         } else {
             fCore::debug("no data for {$check_url}\n", FALSE);
             $data = array();
         }
         return $data;
     } elseif ($obj->getType() == 'predictive') {
         $data = array();
         for ($i = $obj->getNumberOfRegressions(); $i >= 0; $i--) {
             $regression_size = 0;
             if ($obj->getRegressionType() == 'daily') {
                 $regression_size = self::MINUTES_PER_DAY * $i;
             } elseif ($obj->getRegressionType() == 'weekly') {
                 $regression_size = self::MINUTES_PER_WEEK * $i;
             } elseif ($obj->getRegressionType() == 'monthly') {
                 $regression_size = self::MINUTES_PER_MONTH * $i;
             }
             $from = $regression_size + $obj->getSample();
             $until = $regression_size;
             $check_url = $GLOBALS['PROCESSOR_GRAPHITE_URL'] . '/render/?' . 'target=' . $obj->prepareTarget() . '&from=-' . $from . 'minutes' . '&until=-' . $until . 'minutes' . '&format=json';
             $json_data = @file_get_contents($check_url);
             if ($json_data) {
                 $temp_data = json_decode($json_data);
                 $value = 0;
                 if ($obj->getBaseline() == 'average') {
                     $value = subarray_average($temp_data[0]->datapoints);
                 } elseif ($obj->getBaseline() == 'median') {
                     $value = subarray_median($temp_data[0]->datapoints);
                 }
                 array_push($data, $value);
                 //$temp_data = $temp_data[0]->datapoints;
                 //fCore::debug("Iteration: " . $i,FALSE);
                 //for($j=0; $j < count($temp_data); $j++) {
                 //  if($temp_data[$j][0] != 0) {
                 //    fCore::debug($temp_data[$j][0],FALSE);
                 //  }
                 //}
                 //fCore::debug("\n",FALSE);
                 //$data = array_merge($data, $temp_data);
             }
         }
         return $data;
     }
 }
开发者ID:nagyist,项目名称:Tattle,代码行数:76,代码来源:Check.php

示例3: Check

$tmpl->place('header');

 try {
        $check = new Check($check_id);
	$affected = fMessaging::retrieve('affected', fURL::get());
  } catch (fEmptySetException $e) {
?>
        <p class="info">There are currently no Tattle checks. <a href="<?php echo Check::makeURL('add') ?>">Add one now</a></p>
        <?php

  }
	?>

<fieldset>
        <span>Name : <?php echo $check->prepareName(); ?></span> | 
        <span>Target : <?php echo $check->prepareTarget(); ?></span>
        <div class="graphite">
                <div id="canvas" style="padding:1px">
                    <div id="graphcontainer" style="float:left;">
                        <div id="graph" style="width:600px;height:300px"></div>
                        <div id="overview" style="width:600px;height:66px"></div>
                    </div>
                     <p style="clear:left">&nbsp</p>

                      <div class="metricrow" style="display:none">
                         <span id="target" class="metricName"><?php echo $check->prepareTarget();?></span>.
                         <span id="error_threshold"><?php echo $check->prepareError();?></span>
                         <span id="warn_threshold"><?php echo $check->prepareWarn();?></span>
                         <span id="check_id"><?php echo $check->prepareCheckId();?></span> 
                      </div>
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:30,代码来源:list_check_results.php

示例4: getData

        /**
	 * Requests Graphite Data for check
	 * 
	 * @param  Check $obj   The Check object to get the graphite data for
	 * @return array either a Graphite json_data array or an empty one  
	 */
	static public function getData($obj=NULL)
	{
          if ( $GLOBALS['PRIMARY_SOURCE'] == "GANGLIA" ) {
            $check_url = $GLOBALS['GANGLIA_URL'] . '/graph.php/?' .
                        'target=' . $obj->prepareTarget() . 
                        '&cs='. $obj->prepareSample() . 
                        '&ce=now&format=json';
          } else {
            $check_url = $GLOBALS['GRAPHITE_URL'] . '/render/?' .
                        'target=' . $obj->prepareTarget() . 
                        '&from='. $obj->prepareSample() . 
                        '&format=json';
          }
          $json_data = @file_get_contents($check_url);
          if ($json_data) {
            $data = json_decode($json_data);
          } else {
            $data = array();
          }
      return $data;
	}   
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:27,代码来源:Check.php

示例5: getData

        /**
	 * Requests Graphite Data for check
	 * 
	 * @param  Check $obj   The Check object to get the graphite data for
	 * @return array either a Graphite json_data array or an empty one  
	 */
	static public function getData($obj=NULL)
	{
          $check_url = GRAPHITE_URL . '/render/?target=' . $obj->prepareTarget() . '&from='. $obj->prepareSample() . '&format=json';
          $json_data = @file_get_contents($check_url);
          if ($json_data) {
            $data = json_decode($json_data);
          } else {
            $data = array();
          }
      return $data;
	}   
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:17,代码来源:Check.php

示例6: header

<?php

include '../inc/init.php';
fAuthorization::requireLoggedIn();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$debug = fRequest::get('debug', 'boolean');
if (!$debug) {
    header('Content-type: application/json');
}
$check_id = fRequest::get('check_id', 'integer');
$check = new Check($check_id);
if ($GLOBALS['PRIMARY_SOURCE'] == "GANGLIA") {
    $parts = explode("_|_", $check->prepareTarget());
    $url = $GLOBALS['GANGLIA_URL'] . "/graph.php?graphlot=1&cs=-1day&ce=now&c=" . $parts[0] . "&h=" . $parts[1] . "&m=" . $parts[2];
} else {
    $url = $GLOBALS['GRAPHITE_URL'] . '/graphlot/rawdata?&from=-24hour&until=-0hour' . '&target=' . $check->prepareTarget() . '&target=keepLastValue(threshold(' . $check->prepareWarn() . '))';
}
$contents = file_get_contents($url);
print $contents;
开发者ID:nagyist,项目名称:Tattle,代码行数:20,代码来源:get_rawdata.php


注:本文中的Check::prepareTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。