Ejemplo n.º 1
0
 public function dailyAction()
 {
     $this->initView();
     $hostStr = $this->getRequest()->getQuery('host');
     $from = strtotime($this->getRequest()->getQuery('from', date('Y-m-d', time() - 86400)));
     $to = strtotime($this->getRequest()->getQuery('to'));
     $trendFrom = $from;
     if (empty($to)) {
         $to = $from + 86400;
         $trendFrom = $from - 86400;
     }
     $systemHostService = new Service_System_Host();
     $analyticsAccessService = new Service_Analytics_Access();
     $hosts = $systemHostService->getHostId($hostStr);
     $errorList = $analyticsAccessService->getList(Service_Analytics_Access::LIST_ACCESS, $hosts, $from, $to, 1, array("status" => "500,502,504,505"));
     $sizeList = $analyticsAccessService->getList(Service_Analytics_Access::LIST_SIZE, $hosts, $from, $to, 1);
     $timesList = $analyticsAccessService->getList(Service_Analytics_Access::LIST_TIMES, $hosts, $from, $to, 1);
     $pageVisit = $analyticsAccessService->getIndex($hosts, 'pv', $from, $to);
     $errorVisit = $analyticsAccessService->getIndex($hosts, 'error', $from, $to);
     $minuteMax = $analyticsAccessService->getRequestMinute('max', $hosts, $from, $to);
     $minuteMin = $analyticsAccessService->getRequestMinute('min', $hosts, $from, $to);
     $data = array("page_visit" => $pageVisit, "error_visit" => $errorVisit, "minute_max" => $minuteMax, "minute_min" => $minuteMin, "error_list" => $errorList, "size_list" => $sizeList, "times_list" => $timesList);
     $this->getView()->assign('host', $hostStr);
     $this->getView()->assign('data', $data);
     $this->getView()->assign('trendFrom', $trendFrom);
     $this->getView()->assign('to', $to);
     $email = $this->render('daily');
     echo $email;
     //        Sys_Message::send('mail', '*****@*****.**', '监控日报', $email, '172.30.10.111');
 }
Ejemplo n.º 2
0
 public function execute()
 {
     $hosts = trim($this->getRequest()->getQuery('host'));
     $from = strtotime($this->getRequest()->getQuery('from', date('Y-m-d')));
     $to = strtotime($this->getRequest()->getQuery('to'));
     $output = array();
     if (empty($to)) {
         $to = $from + 86400;
     }
     $analyticsAccessService = new Service_Analytics_Access();
     $systemHostService = new Service_System_Host();
     $hosts = $systemHostService->getHostId($hosts);
     $output['series'] = $analyticsAccessService->getErrorTopTen($hosts, $from, $to);
     Sys_Common::output(true, '', $output);
 }
Ejemplo n.º 3
0
 public function screenAction()
 {
     $type = $this->getRequest()->getQuery('type');
     $hosts = trim($this->getRequest()->getQuery('host'));
     $from = strtotime($this->getRequest()->getQuery('from', date('Y-m-d')));
     $to = strtotime($this->getRequest()->getQuery('to'));
     if (empty($to)) {
         $to = $from + 86400;
         $from = $from - 86400;
     }
     $output = null;
     $serviceChartScreen = new Service_Chart_Screen();
     $serviceChartConfig = new Service_Chart_Config();
     $systemHostService = new Service_System_Host();
     $hosts = $systemHostService->getHostId($hosts);
     $option = array('from' => $from, 'to' => $to);
     $config = json_encode($serviceChartConfig->get($type, $hosts, $option));
     $output = $serviceChartScreen->get($config);
     Sys_Tools::response(base64_decode($output), "image/png");
 }