浏览代码

Merged in FD3-630 (pull request #39)

Actualización vista de OLT en Stats / FD3-630
Maximiliano Schvindt 6 年之前
父节点
当前提交
67801934c2

+ 3 - 0
src/StatsBundle/Command/StatsCmCommand.php

@@ -185,6 +185,7 @@ class StatsCmCommand extends BaseCommand
     {
         foreach($cmsCached as $index => $info) {
             if($info['ip'] == '0.0.0.0') continue;
+            if($info['status'] != 1) continue;
 
             $ip = $info['ip'];
             $mac = strtolower($info['mac']);
@@ -220,6 +221,7 @@ class StatsCmCommand extends BaseCommand
 
         foreach($cmsCached as $index => $info) {
             if($info['ip'] == '0.0.0.0') continue;
+            if($info['status'] != 1) continue;
 
             $ip = $info['ip'];
             $mac = strtolower($info['mac']);
@@ -269,6 +271,7 @@ class StatsCmCommand extends BaseCommand
 
         foreach($cmsCached as $index => $info) {
             if($info['ip'] == '0.0.0.0') continue;
+            if($info['status'] != 1) continue;
 
             $ip = $info['ip'];
             $mac = strtolower($info['mac']);

+ 12 - 3
src/StatsBundle/Command/StatsPonPortCommand.php

@@ -63,7 +63,8 @@ class StatsPonPortCommand extends BaseCommand
             $_ponPorts[$pp->getPonPort()] = $pp->getId();
         }
 
-        $sendData = array();
+        $portsCounted = $sendData = array();
+        $onusStatus = array(0 => 0, 1 => 0); //total x olt
         foreach($ponsCached as $index => $stats) {
             
             $row = array();
@@ -96,10 +97,15 @@ class StatsPonPortCommand extends BaseCommand
             
             if(isset($status[$ponPort])) {
                 $p = str_replace("/",".",$ponPort);
-                $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_on_$p"] = "{$status[$ponPort][1]}|g";
-                $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_off_$p"] = "{$status[$ponPort][0]}|g";
                 $row['online'] = $status[$ponPort][1];
                 $row['offline'] = $status[$ponPort][0];
+                if(!isset($portsCounted[$p])) {
+                    $portsCounted[$p] = true;
+                    $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_on_$p"] = "{$status[$ponPort][1]}|g";
+                    $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_off_$p"] = "{$status[$ponPort][0]}|g";
+                    $onusStatus[1] += $status[$ponPort][1];
+                    $onusStatus[0] += $status[$ponPort][0];
+                }
             } else {
                 $row['online'] = $row['offline'] = "NULL";
             }
@@ -120,6 +126,9 @@ class StatsPonPortCommand extends BaseCommand
         $conn->query($sql);
         $conn->close();
 
+        $sendData["d_{$oltDeviceId}_s_{$oltServerId}_state_on"] = "{$onusStatus[1]}|g";
+        $sendData["d_{$oltDeviceId}_s_{$oltServerId}_state_off"] = "{$onusStatus[0]}|g";
+
         if($sendData) {
             $statsdService = $this->getContainer()->get('statsd');
             $statsdService->send($sendData);

+ 1 - 1
src/StatsBundle/Controller/OltReportController.php

@@ -14,7 +14,7 @@ class OltReportController extends Controller
 {
 
     /**
-     * @Route("admin/stats/olt/{oltServerId}/{oltDeviceId}/report", name="admin_stats_olt_report")
+     * @Route("admin/stats/olt/{oltServerId}/{oltDeviceId}/report_back", name="admin_stats_olt_report_back  ")
      */
     public function oltReport($oltServerId, $oltDeviceId) {
 

+ 168 - 4
src/StatsBundle/Controller/StatsController.php

@@ -1070,7 +1070,7 @@ class StatsController extends Controller
 
             $cms[$index] = $row;
 
-            if($lat && $lng) {
+            if($lat && $lng && $rx) {
                 $locations[$index] = array('mac' => $mac, 'tx' => $tx, 'rx' => $rx, 'lat' => $lat, 'lng' => $lng, 'status' => $status);
             }
 
@@ -1234,7 +1234,7 @@ class StatsController extends Controller
         foreach($cms as $data) {
             if($data['txPower'] == null || $data['rxPowerCmts'] == null) continue;
 
-            $color = $this->getRxColor($data['rxPowerCmts']);
+            $color = $this->getCmRxColor($data['rxPowerCmts']);
 
             $signals[] = "{color: '{$color}', x: {$data['txPower']}, y: {$data['rxPowerCmts']}, extraData: '{$data['mac']}', id: '{$data['mac']}~{$cmtsDeviceId}~{$serverId}'}";
 
@@ -1249,7 +1249,7 @@ class StatsController extends Controller
         
     }
 
-    private function getRxColor($value) 
+    private function getCmRxColor($value) 
     {
 
         if($value <= -12)
@@ -1597,7 +1597,7 @@ class StatsController extends Controller
 
             $_onus[$index] = $row;
 
-            if($lat && $lng) {
+            if($lat && $lng && $rx) {
                 $locations[$index] = array('psn' => $psn, 'tx' => $tx, 'rx' => $rx, 'lat' => $lat, 'lng' => $lng, 'status' => $status);
             }
 
@@ -1632,4 +1632,168 @@ class StatsController extends Controller
         
     }
 
+    /**
+     * @Route("admin/stats/olt/{serverId}/{oltDeviceId}/report", name="admin_stats_olt_report")
+     */
+    public function showOltAction($serverId, $oltDeviceId, Request $request) 
+    {
+        $init = microtime(true);
+        $em = $this->get("doctrine.orm.entity_manager");
+        $endpoint = $this->get('endpoint.mongo');
+        $redis = $this->get('redis');
+        $prefix = "d_{$oltDeviceId}_s_{$serverId}";
+        
+        ($request->get('from'))? $from = $request->get('from') : $from = strtotime("-12 hour");
+        ($request->get('to'))? $to = $request->get('to') : $to = strtotime("now");
+        $range = array('from' => date("Y-m-d H:i:s", $from), 'to' => date("Y-m-d H:i:s", $to));
+
+        $cers = $snrs = $utilizations = $errors = $series = $targets = array();
+
+        $key = "olt_scan_card_{$prefix}";
+        $dataCached = $redis->get($key);
+
+        /* % cpu & memory cards */
+        (isset($dataCached['cpu']))? $cpu = $dataCached['cpu'] : $cpu = array();
+        (isset($dataCached['memory']))? $memory = $dataCached['memory'] : $memory = array();
+
+        /* series */
+        $targets["in_bandwidth"] = array("target" => "{$prefix}_inbandwidth_olt");
+        $targets["out_bandwidth"] = array("target" => "{$prefix}_outbandwidth_olt");
+        $targets["in_consumption"] = array("target" => "{$prefix}_inconsumption_olt");
+        $targets["out_consumption"] = array("target" => "{$prefix}_outconsumption_olt");
+        $targets["on"] = array("target" => "{$prefix}_state_on");
+        $targets["off"] = array("target" => "{$prefix}_state_off");
+        
+        $search = array('targets' => $targets, 'maxDataPoints' => 500000, 'range' => $range);
+        $start = microtime(true);
+        $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');
+        $device = $em->getRepository('StatsBundle:Device')->findOneBy($filter);
+        $data = $device->jsonExtraData();
+
+        $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;
+
+        return $this->render('StatsBundle:Stats:show_olt.html.twig', array(
+            'base_template' => $adminPool->getTemplate('layout'),
+            'admin_pool' => $adminPool,
+            'admin' => $adminPool->getAdminByAdminCode("sonata.admin.stats.olt"),
+            'device' => $device,
+            'data' => $data,
+            'cpu' => $cpu,
+            'memory' => $memory,
+            'series' => $series,
+            'signals' => $signals,
+            'time' => $time,
+            'from' => $from,
+            'to' => $to
+        ));
+    }
+
+    public function onuSignal($oltDeviceId, $serverId) 
+    {
+
+        $em = $this->get('doctrine')->getManager();
+        $onus = $em->getRepository('StatsBundle:Onu')->createQueryBuilder('o')
+            ->select('o.txPower','o.rxPowerOlt', 'o.ponSerialNumber')
+            ->where('o.deviceServer = :serverId')
+            ->andWhere('o.oltDeviceId = :oltDeviceId')
+            ->setParameter('serverId', $serverId)
+            ->setParameter('oltDeviceId', $oltDeviceId)
+            ->getQuery()->getResult();
+
+        $colors = $signals = array();
+
+        foreach($onus as $data) {
+            if($data['txPower'] == null || $data['rxPowerOlt'] == null) continue;
+
+            $color = $this->getOnuRxColor($data['rxPowerOlt']);
+
+            $signals[] = "{color: '{$color}', x: {$data['txPower']}, y: {$data['rxPowerOlt']}, extraData: '{$data['ponSerialNumber']}', id: '{$data['ponSerialNumber']}~{$oltDeviceId}~{$serverId}'}";
+
+        }
+
+        $_signals = "{}";
+        if($signals) {
+            $_signals = implode(",",$signals);
+        }
+
+        return $_signals;
+        
+    }
+
+    private function getOnuRxColor($value) 
+    {
+        if($value < -30)
+            return "#a00400"; //bordó
+        elseif($value >= -30 and $value < -28)
+            return "#ff4d3f"; //rojo
+        elseif($value >= -28 and $value < -26)
+            return "#ffa732"; //amarillo
+        elseif($value >= -26 and $value < -20)
+            return "#00a65a"; //verde
+        elseif($value >= -20 and $value < -15)
+            return "#ffa732"; //amarillo
+        elseif($value >= -15 and $value < -13)
+            return "#ff4d3f"; //rojo
+        else
+            return "#a00400"; //bordó
+    }
+
 }

+ 18 - 0
src/StatsBundle/Resources/public/css/style.css

@@ -22,6 +22,24 @@
     font-weight: normal;
 }
 
+.label-c-danger {
+    background-color: #cf0016;
+    font-size: 14px;
+    font-weight: normal;
+}
+
+.label-c-alert {
+    background-color: #e26673;
+    font-size: 14px;
+    font-weight: normal;
+}
+
+.label-c-low-alert {
+    background-color: #da7a3b;
+    font-size: 14px;
+    font-weight: normal;
+}
+
 .label-c-disabled {
     background-color: #d2d6de;
     font-size: 14px;

+ 4 - 1
src/StatsBundle/Resources/translations/StatsBundle.es.yml

@@ -9,6 +9,7 @@ breadcrumb:
     link_cmts_interface_list: Listado de Interfaces
     link_cablemodem_list: Listado de Cablemodems
     link_cmts_list: Listado de CMTS
+    link_olt_list: Listado de OLT
 
 filter:
     label_name: Nombre
@@ -324,4 +325,6 @@ interface_cms_map_title: RX de cablemodems en la Interface
 consumption_subtitle: Consumo mensual acumulado
 ponport_onu_map_title: RX de onus en el PonPort
 onus_with_lat_lng: onus geolocalizadas
-tx_title: TX Power
+tx_title: TX Power
+memory_cards_percent: Memory Cards
+cpu_cards_percent: CPU Cards

+ 1 - 1
src/StatsBundle/Resources/views/Device/action_olt_show_report.html.twig

@@ -1,4 +1,4 @@
-<a href="{{path('admin_stats_olt_report',{'oltServerId': object.getDeviceServer.getId(), 'oltDeviceId': object.getDeviceId()})}}" class="btn btn-sm btn-default view_link" title="{{ 'action_olt_show_report'|trans({}, 'StatsBundle') }}">
+<a href="{{path('admin_stats_olt_report',{'serverId': object.getDeviceServer.getId(), 'oltDeviceId': object.getDeviceId()})}}" class="btn btn-sm btn-default view_link" title="{{ 'action_olt_show_report'|trans({}, 'StatsBundle') }}">
     <i class="fa fa-area-chart" aria-hidden="true" style="font-size: 14px; vertical-align: bottom;"></i>
     {{ 'action_olt_show_report'|trans({}, 'StatsBundle') }}
 </a>

+ 94 - 0
src/StatsBundle/Resources/views/Stats/Template/olt_info_1.html.twig

@@ -0,0 +1,94 @@
+<div class="box box-widget">
+    <div class="box-body">
+        <table class="table table-hover table-condensed table-striped table-bordered">
+        <thead><th colspan=2>{{ 'list.label_olt'|trans({}, 'StatsBundle') }}</th></thead>
+        <tbody>
+            <tbody>
+                <tr>
+                    <td>{{ 'list.label_name'|trans({}, 'StatsBundle') }}</td>
+                    <td>{{ data.name }}</td>
+                </tr>
+                <tr>
+                    <td>{{ 'list.label_ip'|trans({}, 'StatsBundle') }}</td>
+                    <td>{{ device.getIp() }}</td>
+                </tr>
+                <tr>
+                    <td>{{ 'list.label_olt_mark'|trans({}, 'StatsBundle') }}</td>
+                    <td>{{ data.mark }}</td>
+                </tr>
+                <tr>
+                    <td>{{ 'list.label_olt_library'|trans({}, 'StatsBundle') }}</td>
+                    <td>{{ data.library }}</td>
+                </tr>
+                <tr>
+                    <td>{{ 'list.label_olt_executeSnmp'|trans({}, 'StatsBundle') }}</td>
+                    <td>
+                        {% if data.executeSnmp %}
+                          <i class="fa fa-check" style="color:#53D356"></i>
+                            {{ 'yes'|trans({}, 'StatsBundle') }}
+                        {% else %}
+                          <i class="fa fa-times" style="color:#F82929"></i>
+                            {{ 'no'|trans({}, 'StatsBundle') }}
+                        {% endif %}
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+        <br />
+
+        <table class="table table-hover table-condensed table-striped table-bordered">
+        <thead><th colspan=1>{{ 'cpu_cards_percent'|trans({}, 'StatsBundle') }}&nbsp;&nbsp;<span class="no_defined">%</span></th></thead>
+        <tbody>
+            <tbody>
+                <tr>
+                    <td>
+                    {% if cpu|length > 0 %}
+                        {% for index, value in cpu %}
+                            {% set style = "label-c-primary" %}
+                            {% if value >= 50 and value < 75 %}
+                                {% set style = "label-c-low-alert" %}
+                            {% elseif value >= 75 and value < 90 %}
+                                {% set style = "label-c-alert" %}
+                            {% elseif value >= 90 %}
+                                {% set style = "label-c-danger" %}
+                            {% endif %}
+                            
+                            <span class="label {{style}}" style="float:left; margin-right: 2px; margin-top:2px">{{index}} : <b>{{value}}</b></span>
+                        {% endfor %}
+                    {% else %}
+                        <span class="no_defined">{{ 'no_defined'|trans({}, 'StatsBundle') }}</span>
+                    {% endif %}
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+        
+        <br />
+        <table class="table table-hover table-condensed table-striped table-bordered">
+        <thead><th colspan=1>{{ 'memory_cards_percent'|trans({}, 'StatsBundle') }}&nbsp;&nbsp;<span class="no_defined">%</span></th></thead>
+        <tbody>
+            <tbody>
+                <tr>
+                    <td>
+                    {% if memory|length > 0 %}
+                        {% for index, value in memory %}
+                            {% set style = "label-c-primary" %}
+                            {% if value >= 50 and value < 75 %}
+                                {% set style = "label-c-low-alert" %}
+                            {% elseif value >= 75 and value < 90 %}
+                                {% set style = "label-c-alert" %}
+                            {% elseif value >= 90 %}
+                                {% set style = "label-c-danger" %}
+                            {% endif %}
+                            <span class="label {{style}}" style="float:left; margin-right: 2px; margin-top:2px">{{index}} : <b>{{value}}</b></span>
+                        {% endfor %}
+                    {% else %}
+                        <span class="no_defined">{{ 'no_defined'|trans({}, 'StatsBundle') }}</span>
+                    {% endif %}
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+        
+    </div>
+</div>

+ 323 - 0
src/StatsBundle/Resources/views/Stats/show_olt.html.twig

@@ -0,0 +1,323 @@
+{% extends "@BaseAdminBundle/Resources/views/standard_layout.html.twig" %}
+
+{% block stylesheets %}
+{{ parent() }}
+{# <link rel="stylesheet" href="{{ asset('bundles/stats/datatables/jquery.dataTables.min.css') }}"> #}
+<link rel="stylesheet" type="text/css" href="{{ asset('bundles/stats/css/style.css') }}">
+{# <link rel="stylesheet" href="{{ asset('bundles/stats/datatables/jquery.dataTables.min.css') }}"> #}
+<style>
+
+.cpu_card {
+    border: 1px solid rgba(0,0,0,0.2);
+    float: left;
+    margin: 2px;
+    padding: 2px;
+}
+
+table.dataTable thead tr th, table.dataTable tbody tr td {
+    text-align: center;
+}
+</style>
+{% endblock %}
+
+{% block javascripts %}
+{{ parent() }}
+
+{# {% include 'LeafletBundle:Leaflet:resources_only_leaflet.html.twig' %} #}
+<script src="{{ asset('bundles/stats/highcharts/code/highcharts.js') }}" type="text/javascript" charset="utf-8"></script>
+<script src="{{ asset('bundles/stats/highcharts/highchartsConfig.js') }}" type="text/javascript" charset="utf-8"></script>
+{# <script src="{{ asset('bundles/stats/datatables/jquery.dataTables.min.js') }}"></script> #}
+
+{% endblock %}
+
+{% block sonata_page_content %}
+<section class="content-header">
+    <div class="sticky-wrapper" style="">
+        <nav class="navbar navbar-default" role="navigation" style="width: auto;">
+            <div class="container-fluid">
+                <div class="hidden-xs">
+                    <ol class="nav navbar-top-links breadcrumb">
+                        <li><a href="/app_dev.php/admin/dashboard"><i class="fa fa-home"></i></a></li>
+                        <li><a href="{{url('admin_stats_olt_list')}}">{{"breadcrumb.link_olt_list"|trans({}, 'StatsBundle')}}</a></li>
+                        <li class="active"><span>{{data['name']}}</span></li>
+                    </ol>
+                </div>
+                <div class="navbar-collapse"></div>
+            </div>
+        </nav>
+    </div>
+</section>
+
+{% set onuOn = series['on']['last'] %}
+{% set onuOff = series['off']['last'] %}
+{% set onuTotal = onuOn + onuOff %}
+{% set onuOnPercent = 0 %}
+{% if onuTotal > 0 %}
+    {% set onuOnPercent = ((onuOn / onuTotal) * 100)|number_format(2,'.','') %}
+{% endif %}
+
+<section class="content">
+    <div class="box box-primary">
+        <br />
+        <div class="box-body">
+            <div class="col-sm-12">
+                <div class="nav-tabs-custom">
+                    <ul class="nav nav-tabs">
+                        <li class="active">
+                            <a href="#tab_1" data-toggle="tab">Description</a>
+                        </li>
+                    </ul>
+                    <div class="tab-content clearfix">
+                        {# TAB Description #}
+                        <div class="tab-pane active" id="tab_1">
+                            <div class="clearfix">
+                                <div class="col-sm-3">
+                                    {% include '@Stats/Stats/Template/olt_info_1.html.twig' %}
+                                </div>
+                                <div class="col-sm-3">
+                                    <div id="onu_count" style="width:75%; margin:0 auto"></div>
+                                </div>
+                                <div class="col-sm-6">
+                                    {% include '@Stats/Stats/picker.html.twig' %}
+                                    <br />
+                                    <div id="onu_consumption"></div>
+                                </div>
+                            </div>
+                            <br />
+
+                            <div class="clearfix">
+                                <div class="col-sm-9">
+                                    <div id="olt_bandwidth"></div>
+                                </div>
+                                <div class="col-sm-3">
+                                    {% include '@Stats/Stats/Template/interface_bandwidth_info.html.twig' %}
+                                </div>
+                            </div>
+
+                            <div>
+                                <div class="col-sm-8">
+                                    <div id="olt_cm" style="height: 400px;"></div>
+                                </div>
+                                <div class="col-sm-4">
+                                    <div id="olt_signals"></div>
+                                </div>
+                            </div>
+                        </div>
+
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</section>
+
+<script type="text/javascript">
+
+var from = {{from}};
+var to = {{to}};
+var markerEnable = false;
+if((to - from) <= 21600) {
+    markerEnable = true;
+}
+
+Highcharts.chart('onu_count', {
+    chart: {type: 'pie'},
+    title: {text: "{{onuOnPercent}} % online"},
+    subtitle: {text: "{{onuTotal}} onus"},
+    tooltip: {pointFormat: '{series.name}: <b>{point.y:.0f}</b>({point.percentage:.1f}%)'},
+    plotOptions: {pie: {allowPointSelect: true,cursor: 'pointer',dataLabels: {enabled: true,format: '<b>{point.name}</b>: {point.y:.0f} ({point.percentage:.1f} %)',style: {color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'}}}},
+    series: [{
+        name: 'Onus',
+        colorByPoint: true,
+        data: [{
+            name: 'Online',
+            y: {{onuOn}},
+            sliced: true,
+            selected: true,
+            color: '#4DD351'
+        }, {
+            name: 'Offline',
+            y: {{onuOff}},
+            color: '#D75C62'
+        }]
+    }]
+});
+
+
+Highcharts.chart('onu_consumption', {
+    chart: {type: 'spline'},
+    title: {text: '{{'Consumption OLT'|trans({}, 'StatsBundle')}}'},
+    subtitle: {text: '{{'consumption_subtitle'|trans({},'StatsBundle')}}'},
+    xAxis: {type: 'datetime',dateTimeLabelFormats: {month: '%e. %b',year: '%b'},title: {text: 'Date'}},
+    yAxis: {labels: {formatter: consumptionAxisLabel,align: 'left'},min: 0},
+    tooltip: {formatter: consumptionTooltip},
+    plotOptions: {series: {marker: {enabled: markerEnable}, dataLabels: {enabled: false, color: '#666666', formatter: bandwidthDataLabel}}},
+    series: [{
+        name: "OUT Consumption",
+        data: {{series['out_consumption']['data']|json_encode}},
+        color: '#e24d42'
+        },{
+        name: "IN Consumption",
+        data: {{series['in_consumption']['data']|json_encode}},
+        color: '#3f6833'
+    }]
+});
+
+Highcharts.chart('olt_bandwidth', {
+    chart: {type: 'spline'},
+    title: {text: '{{'Bandwidth OLT'|trans({}, 'StatsBundle')}}'},
+    subtitle: {},
+    xAxis: {type: 'datetime',dateTimeLabelFormats: {month: '%e. %b',year: '%b'},title: {text: 'Date'}},
+    yAxis: {labels: {formatter: bandwidthAxisLabel,align: 'left'},min: 0},
+    tooltip: {formatter: bandwidthTooltip},
+    plotOptions: {series: {marker: {enabled: markerEnable}, dataLabels: {enabled: false, color: '#666666', formatter: bandwidthDataLabel}}},
+    series: [{
+        name: "OUT Bandwidth",
+        data: {{series['out_bandwidth']['data']|json_encode}},
+        color: '#e24d42'
+        },{
+        name: "IN Bandwidth",
+        data: {{series['in_bandwidth']['data']|json_encode}},
+        color: '#3f6833'
+    }]
+});
+
+Highcharts.chart('olt_cm', {
+    chart: {type: 'area'},
+    title: {text: 'Onus'},
+    subtitle: {text: 'Online / Offline'},
+    xAxis: {type: 'datetime',dateTimeLabelFormats: {month: '%e. %b',year: '%b'},title: {text: 'Date'}},
+    yAxis: {min: 0,stackLabels: {enabled: false,style: {fontWeight: 'bold',color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'}}},
+    tooltip: {valueSuffix: ' onus',valueDecimals: 0},
+    plotOptions: {series: {marker: {enabled: false}}, area: {stacking: 'normal', dataLabels: {enabled: false, color: '#666666'}}},
+    series: [{
+        name: 'Online',
+        data: {{series['on']['data']|json_encode}},
+        color: '#3f6833'
+    }, {
+        name: 'Offline',
+        data: {{series['off']['data']|json_encode}},
+        color: '#e24d42'
+    }]
+});
+
+Highcharts.chart('olt_signals', {
+    
+    chart: {
+        type: 'scatter',
+        zoomType: 'xy'
+    },
+    series: {
+        type: 'scatter'
+    },
+    title: {
+        text: '{{'Signal ONU'|trans({}, 'StatsBundle')}}'
+    },
+    subtitle: {
+        text: '{{'Values of TX y RX Power'|trans({}, 'StatsBundle')}}'
+    },
+    xAxis: {
+        startOnTick: true,
+        endOnTick: true,
+        showLastLabel: true,
+        type:'linear',
+        title: {
+            enabled: true,
+            text: 'TX'
+        },
+        crosshair: true
+    },
+    yAxis: {
+        title: {
+            enabled: true,
+            text: 'RX'
+        },
+        crosshair: true,
+    },
+    legend: {enabled: false},
+    plotOptions: {
+        series: {lineWidth: 0},
+        scatter: {marker: {radius: 5,states: {hover: {enabled: true,lineColor: 'rgb(100,100,100)'}}},states: {hover: {marker: {enabled: false}}},
+            point: {events: {click: function () {
+                            var url = "{{url('admin_stats_onu_show',{id:'IDCM'})}}";
+                            url = url.replace('IDCM', this.id);
+                            window.open(url, '_blank');
+                            }}}
+        }
+    },
+    tooltip: {formatter: scatterTxRxTooltip},
+    series: [
+        {
+        name: 'Signals',
+        type: 'scatter',
+        data:[{{signals|raw}}]
+        }]
+});
+
+
+/*
+{#
+
+
+
+Highcharts.chart('interface_utilization', {
+    chart: {type: 'spline'},
+    title: {text: '{{'Interfaces Utilization'|trans({}, 'StatsBundle')}}'},
+    subtitle: {},
+    xAxis: {type: 'datetime',dateTimeLabelFormats: {month: '%e. %b',year: '%b'},title: {text: 'Date'}},
+    yAxis: {labels: {align: 'left'},min: 0, max: 100},
+    tooltip: {valueSuffix: ' %',valueDecimals: 2},
+    plotOptions: {series: {marker: {enabled: markerEnable}}, spline: {marker: {enabled: false}}},
+    series: [
+        {% for index in utilizations %}
+        {
+            name: "Interface {{index}}",
+            data: {{series['utilization_' ~ index]['data']|json_encode}}
+        },
+        {% endfor %}
+    ]
+});
+
+Highcharts.chart('interface_snr', {
+    chart: {type: 'spline'},
+    title: {text: '{{'Interfaces SNR'|trans({}, 'StatsBundle')}}'},
+    subtitle: {},
+    xAxis: {type: 'datetime',dateTimeLabelFormats: {month: '%e. %b',year: '%b'},title: {text: 'Date'}},
+    yAxis: {labels: {align: 'left'}},
+    tooltip: {valueSuffix: ' dB',valueDecimals: 2},
+    plotOptions: {series: {marker: {enabled: markerEnable}}, spline: {marker: {enabled: false}}},
+    series: [
+        {% for index in snrs %}
+        {
+            name: "Interface {{index}}",
+            data: {{series['signal_' ~ index]['data']|json_encode}}
+        },
+        {% endfor %}
+    ]
+});
+
+Highcharts.chart('interface_cer', {
+    chart: {type: 'spline'},
+    title: {text: '{{'Interfaces CER'|trans({}, 'StatsBundle')}}'},
+    subtitle: {},
+    xAxis: {type: 'datetime',dateTimeLabelFormats: {month: '%e. %b',year: '%b'},title: {text: 'Date'}},
+    yAxis: {labels: {align: 'left'}},
+    tooltip: {valueSuffix: ' %',valueDecimals: 6},
+    plotOptions: {series: {marker: {enabled: markerEnable}}, spline: {marker: {enabled: false}}},
+    series: [
+        {% for index in cers %}
+        {
+            name: "Interface {{index}}",
+            data: {{series['cer_' ~ index]['data']|json_encode}}
+        },
+        {% endfor %}
+    ]
+});
+
+
+#}
+*/
+
+</script>
+
+{% endblock %}