Ejemplo n.º 1
0
 public function execute()
 {
     $type = $this->getRequest()->getQuery('type');
     $status = $this->getRequest()->getQuery('status');
     $page = $this->getRequest()->getQuery('page', 1);
     $host = $this->getRequest()->getQuery('host');
     $path = $this->getRequest()->getQuery('path');
     $from = strtotime($this->getRequest()->getQuery('from', date('Y-m-d')));
     $to = strtotime($this->getRequest()->getQuery('to'));
     $to = empty($to) ? $from + 86400 : $to;
     $output = array();
     $condition = array();
     if (empty($type)) {
         return false;
     }
     if (!empty($status)) {
         $condition['status'] = $status;
     }
     $systemHostService = new Service_System_Host();
     $analyticsAccessService = new Service_Analytics_Access();
     $hostPathID = array();
     foreach (explode(',', $host) as $h) {
         $hosts = $systemHostService->getHostPathId($h, $path);
         if ($hosts) {
             $hostPathID[] = array($hosts[0]['host_id'], $hosts[0]['path_id']);
         }
     }
     $output = $analyticsAccessService->getList($type, $hostPathID, $path, $from, $to, $page, $condition);
     Sys_Common::output(true, '', $output);
 }
Ejemplo n.º 2
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.º 3
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.º 4
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'));
     $to = empty($to) ? $to : $from + 86400;
     $output = array();
     $analyticsAccessService = new Service_Analytics_Access();
     //$systemHostService      = new Service_System_Host();
     //$logPersistentService   = new Service_Log_Persistent();
     // $recordTime = $logPersistentService->getRecordTime('accesslog');
     /*if (empty($to) || $to - $from = 86400) {
           $to = $recordTime - 60;
       }*/
     $output['series'] = $analyticsAccessService->getErrorTrend($hosts, $from, $to);
     /*array(502=>array(
           array("time"=>1418601900,"num"=>10,"top"=>array(array('credit.gamelala.com','/hascredit/cache/getAppCredit',1))),
           array("time"=>1418605900,"num"=>13,"top"=>array(array('credit.gamelala.com','/hascredit/cache/getAppCredit',1))),
       ));*/
     //$analyticsAccessService->getErrorTrend($hosts, $from, $to);
     Sys_Common::output(true, '', $output);
 }