Beispiel #1
0
<?php

require_once 'core.php';
use lib\rrd_graph\sw_graph;
$time = time();
$rev = sw_graph::graph('2_4', 1, array('time_grid' => sw_graph::T_60_MIN));
var_dump($rev);
Beispiel #2
0
 /**
  * 单次执行
  *
  * @return void
  */
 protected function _run()
 {
     while (1) {
         $graph_info = $this->__redis->lpop(SWAN_QUEUE_GRAPH);
         if (!$graph_info) {
             // 空队列需要休眠
             usleep(500);
         }
         $graph_info = json_decode($graph_info, true);
         if (!isset($graph_info[1])) {
             continue;
         }
         list($monitor_id, $metric_id) = $graph_info;
         try {
             lib_graph::graph($monitor_id, $metric_id, array('time_grid' => lib_graph::T_15_MIN));
             lib_graph::graph($monitor_id, $metric_id, array('time_grid' => lib_graph::T_60_MIN));
             lib_graph::graph($monitor_id, $metric_id, array('time_grid' => lib_graph::T_1_DAY));
             lib_graph::graph($monitor_id, $metric_id, array('time_grid' => lib_graph::T_7_DAY));
             lib_graph::graph($monitor_id, $metric_id, array('time_grid' => lib_graph::T_30_DAY));
             lib_graph::graph($monitor_id, $metric_id, array('time_grid' => lib_graph::T_365_DAY));
         } catch (\swan\exception\sw_exception $e) {
             $this->log($e->getMessage(), LOG_INFO);
         }
     }
 }