|
@@ -1360,7 +1360,11 @@ class StatsController extends Controller
|
|
|
$prefix = "d_{$cmtsDeviceId}_s_{$serverId}";
|
|
|
$_mac = $mac = strtolower($cablemodem->getMac());
|
|
|
|
|
|
- $star = $this->getConsumptionDevice($serverId,$cmtsDeviceId,1,$mac,null,null);
|
|
|
+ $fs = strtotime('-30 days');
|
|
|
+ $ts = strtotime('now');
|
|
|
+ $fromStar = date("Y-m-d",$fs);
|
|
|
+ $toStar = date("Y-m-d",$ts);
|
|
|
+ $star = $this->getConsumptionDevice($serverId,$cmtsDeviceId,1,$mac,$fromStar,$toStar);
|
|
|
|
|
|
// Get Cablemodem stats from Redis
|
|
|
$key = "cm_stats_{$prefix}";
|
|
@@ -1425,7 +1429,13 @@ class StatsController extends Controller
|
|
|
'from' => $from,
|
|
|
'to' => $to,
|
|
|
'portsMetrics' => $portsMetrics,
|
|
|
- 'star' => $star
|
|
|
+ 'star' => $star,
|
|
|
+ 'fs' => $fs,
|
|
|
+ 'ts' => $ts,
|
|
|
+ 'server' => $serverId,
|
|
|
+ 'fatherDevice' => $cmtsDeviceId,
|
|
|
+ 'fatherDeviceType' => 1,
|
|
|
+ 'device' => $mac
|
|
|
));
|
|
|
}
|
|
|
|
|
@@ -1567,7 +1577,7 @@ class StatsController extends Controller
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- return new JsonResponse(array('series' => $series,));
|
|
|
+ return new JsonResponse(array('series' => $series));
|
|
|
}
|
|
|
|
|
|
private function getPonportOnus($onus) {
|
|
@@ -1674,41 +1684,6 @@ class StatsController extends Controller
|
|
|
$this->getSeries($series, $errors, $targets, $search, "olt: {$prefix}");
|
|
|
$end = microtime(true);
|
|
|
|
|
|
- /*
|
|
|
- // Get Interface stats from Redis
|
|
|
- $key_ifs_stats = "cmts_stats_ifs_{$prefix}";
|
|
|
- $interfacesStats = $redis->get($key_ifs_stats);
|
|
|
-
|
|
|
- // Get interfaces with snr, cer and utilization
|
|
|
- foreach($interfacesStats as $index => $value) {
|
|
|
- if(isset($value['utilization'])) {
|
|
|
- foreach($value['utilization'] as $i => $value) {
|
|
|
- if($value != 0) {
|
|
|
- $utilizationSum += $value;
|
|
|
- $utilizationCount++;
|
|
|
- $utilizations[] = "{$index}.{$i}";
|
|
|
- $targets["utilization_{$index}.{$i}"] = array("target" => "{$prefix}_if_utilization_{$index}.{$i}");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(isset($value['signal']) && $value['signal'] > 0) {
|
|
|
- $snrs[] = $index;
|
|
|
- $snrSum += $value['signal'];
|
|
|
- $snrCount++;
|
|
|
- $targets["signal_{$index}"] = array("target" => "{$prefix}_if_signal_{$index}");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if($cers = $this->getInterfaceWithCer($cmtsDeviceId, $serverId)) {
|
|
|
- foreach($cers as $index) {
|
|
|
- $targets["cer_{$index}"] = array("target" => "{$prefix}_if_cer_{$index}");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- */
|
|
|
-
|
|
|
$adminPool = $this->get('sonata.admin.pool');
|
|
|
|
|
|
$filter = array('deviceId' => $oltDeviceId, 'deviceServer' => $serverId, 'deviceType' => 'FTTHBundle\Entity\OLT');
|
|
@@ -1717,21 +1692,6 @@ class StatsController extends Controller
|
|
|
|
|
|
$signals = $this->onuSignal($oltDeviceId, $serverId);
|
|
|
|
|
|
- /*
|
|
|
- $key = "cmts_desc_{$prefix}";
|
|
|
- $dataCached = $redis->get($key);
|
|
|
-
|
|
|
- $_desc = array();
|
|
|
- if(isset($dataCached[0])) {
|
|
|
- $desc = explode(",", $dataCached[0]);
|
|
|
- foreach($desc as $d) {
|
|
|
- $_desc[] = ucfirst(trim($d));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- */
|
|
|
-
|
|
|
$end = microtime(true);
|
|
|
$time = $end - $init;
|
|
|
|
|
@@ -1828,7 +1788,7 @@ class StatsController extends Controller
|
|
|
|
|
|
|
|
|
$categories = $series = $serie_accumulated = $serie_total = $serie_total_x_day = $serie_in = $serie_out = array();
|
|
|
- $total = $total_in = $total_out = $accumulated = $daily_prom = $projection = $count_days = 0;
|
|
|
+ $total = $total_in = $total_out = $accumulated = $projection = $count_days = 0;
|
|
|
|
|
|
$days = $this->getDaysWeek();
|
|
|
|
|
@@ -1843,7 +1803,7 @@ class StatsController extends Controller
|
|
|
$d = $date->format('Y-m-d');
|
|
|
$label = $date->format('d/m');
|
|
|
$categories[$d] = "'$label'";
|
|
|
- $serie_accumulated[$d] = $serie_total[$d] = $serie_in[$d] = $serie_out[$d] = null;
|
|
|
+ $serie_accumulated[$d] = $serie_total[$d] = $serie_in[$d] = $serie_out[$d] = 00.00;
|
|
|
}
|
|
|
|
|
|
foreach($consumed as $data) {
|
|
@@ -1857,9 +1817,9 @@ class StatsController extends Controller
|
|
|
|
|
|
$_d = $data['date']->format('N');
|
|
|
|
|
|
- $serie_total_x_day[$_d]['total'] += ($data['in'] + $data['out']);
|
|
|
- $serie_total_x_day[$_d]['in'] += $data['in'];
|
|
|
- $serie_total_x_day[$_d]['out'] += $data['out'];
|
|
|
+ $serie_total_x_day[$_d]['total'] += number_format(($data['in'] + $data['out']),'3','.','');
|
|
|
+ $serie_total_x_day[$_d]['in'] += number_format($data['in'],'3','.','');
|
|
|
+ $serie_total_x_day[$_d]['out'] += number_format($data['out'],'3','.','');
|
|
|
$total += ($data['in'] + $data['out']);
|
|
|
}
|
|
|
|
|
@@ -1869,19 +1829,8 @@ class StatsController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /* $dPer = $dIn = $dOut = $dTot = array(1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0);
|
|
|
- foreach($serie_total_x_day as $d => &$data) {
|
|
|
-
|
|
|
- $data['percent']
|
|
|
- $dIn[$d] = $data['in'];
|
|
|
- $dOut[$d] = $data['out'];
|
|
|
- $dTot[$d] = $data['total'];
|
|
|
- if($total > 0) {
|
|
|
- $dPer[$d] = number_format(($data['total'] / $total) * 100, 2, '.','');
|
|
|
- }
|
|
|
- } */
|
|
|
|
|
|
- $series = array('in' => $serie_in,'out' => $serie_out,'total' => $serie_total,'categories' => $categories, 'accumulated' => $serie_accumulated, 'xday' => $serie_total_x_day);
|
|
|
+ $series = array('in' => $serie_in,'out' => $serie_out,'total' => $serie_total,'categories' => $categories, 'accumulated' => $serie_accumulated, 'xday' => $serie_total_x_day, 'accumulated_last' => $accumulated);
|
|
|
|
|
|
return $series;
|
|
|
|
|
@@ -1894,4 +1843,26 @@ class StatsController extends Controller
|
|
|
return $days;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Route("/admin/stats/star/getjson", name="star_get_json")
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function starGetJson(Request $request)
|
|
|
+ {
|
|
|
+
|
|
|
+ ($request->get('from'))? $from = date("Y-m-d", $request->get('from')) : $from = date("Y-m-d",strtotime("-12 hour"));
|
|
|
+ ($request->get('to'))? $to = date("Y-m-d", $request->get('to')) : $to = date("Y-m-d",strtotime("now"));
|
|
|
+
|
|
|
+ $server = $request->get('server');
|
|
|
+ $fatherDevice = $request->get('fatherDevice');
|
|
|
+ $fatherDeviceType = $request->get('fatherDeviceType');
|
|
|
+ $device = $request->get('device');
|
|
|
+
|
|
|
+
|
|
|
+ $series = $this->getConsumptionDevice($server,$fatherDevice,$fatherDeviceType,$device,$from,$to);
|
|
|
+
|
|
|
+ return new JsonResponse($series);
|
|
|
+ }
|
|
|
+
|
|
|
}
|