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); }
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'); }
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); }
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"); }