فهرست منبع

FD3-235 Se agrega opción para enviar datos al StatsD. En caso de no
enviarlos, tampoco se visualizan las gráfica de grafana en los perfiles
de ONU y OLT.

Maximiliano Schvindt 7 سال پیش
والد
کامیت
2110ed5101

+ 3 - 0
src/StatsBundle/Admin/DeviceServerAdmin.php

@@ -57,6 +57,9 @@ class DeviceServerAdmin extends BaseAdmin
                 ->add('url', TextType::class, array(
                     'help' => $this->trans('help.url'),
                 ))
+                ->add('saveHistoric', null, array(
+                    'help' => $this->trans('help.saveHistoric'),
+                ))
                 ->add('deviceTypes', ChoiceType::class, array(
                     'choices' => DeviceTypes::getChoices(),
                     'multiple' => true,

+ 2 - 1
src/StatsBundle/Command/GenerateCrontabCommand.php

@@ -63,6 +63,7 @@ class GenerateCrontabCommand extends ContainerAwareCommand
             $oltDevices = $doctrine->getRepository('\StatsBundle\Entity\Device')->findBy(array('deviceType' => 'FTTHBundle\Entity\OLT','deviceServer' => $server));
 
             $serverId = $server->getId();
+            $saveHistoric = $server->getSaveHistoric();
 
             foreach($oltDevices as $device) {
                 $commands = array();
@@ -86,7 +87,7 @@ class GenerateCrontabCommand extends ContainerAwareCommand
                 $timePonStats = $data['timePonStats'];
                 $timeOltOctets = $data['timeOltOctets'];
 
-                $params = "--olt-ip={$deviceIp} --olt-community={$snmpCommunity} --olt-snmp-library={$library} --olt-device-id={$deviceId} --olt-server-id={$serverId}";
+                $params = "--olt-ip={$deviceIp} --olt-community={$snmpCommunity} --olt-snmp-library={$library} --olt-device-id={$deviceId} --olt-server-id={$serverId} --save-historic={$saveHistoric}";
                 $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$mark}:pon:scan {$params}";
                 $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$mark}:onu:scan {$params}";
                 

+ 3 - 2
src/StatsBundle/Command/GenerateRemoteCrontabCommand.php

@@ -88,6 +88,7 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
             $oltDevices = $doctrine->getRepository('\StatsBundle\Entity\Device')->findBy(array('deviceType' => 'FTTHBundle\Entity\OLT', 'deviceServer' => $server));
 
             $serverId = $server->getId();
+            $saveHistoric = $server->getSaveHistoric();
 
             foreach ($oltDevices as $device) {
                 $commands = array();
@@ -114,9 +115,9 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
                 $timePonStats = $data['timePonStats'];
                 $timeOltOctets = $data['timeOltOctets'];
 
-                $params = "--olt-ip={$deviceIp} --olt-community={$snmpCommunity} --olt-snmp-library={$library} --olt-device-id={$deviceId} --olt-server-id={$serverId}";
+                $params = "--olt-ip={$deviceIp} --olt-community={$snmpCommunity} --olt-snmp-library={$library} --olt-device-id={$deviceId} --olt-server-id={$serverId} --save-historic={$saveHistoric}";
                 if ($amqp) {
-                    $params = "--args=--olt-ip:{$deviceIp} --args=--olt-community:{$snmpCommunity} --args=--olt-snmp-library:{$library} --args=--olt-device-id:{$deviceId} --args=--olt-server-id:{$serverId}";
+                    $params = "--args=--olt-ip:{$deviceIp} --args=--olt-community:{$snmpCommunity} --args=--olt-snmp-library:{$library} --args=--olt-device-id:{$deviceId} --args=--olt-server-id:{$serverId} --args=--save-historic:{$saveHistoric}";
                 }
 
                 $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:pon:scan {$params}";

+ 27 - 0
src/StatsBundle/Entity/DeviceServer.php

@@ -63,6 +63,11 @@ class DeviceServer
      */
     protected $devices;
 
+    /**
+     * @ORM\Column(type="boolean", nullable=true, columnDefinition="BOOLEAN DEFAULT TRUE")
+     */
+    protected $saveHistoric = true;
+
 
     /**
      * @return string
@@ -170,4 +175,26 @@ class DeviceServer
         return $this->devices;
     }
 
+    /**
+     * Set saveHistoric
+     *
+     * @param boolean $e
+     * @return DeviceServer
+     */
+    public function setSaveHistoric($e)
+    {
+        $this->saveHistoric = $e;
+        return $this;
+    }
+
+    /**
+     * Get saveHistoric
+     *
+     * @return boolean 
+     */
+    public function getSaveHistoric()
+    {
+        return $this->saveHistoric;
+    }
+
 }

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

@@ -42,6 +42,7 @@ form:
     label_tenancy_id: Tenencia
     label_bias_current: Bias Current
     label_array_rx_power: Rx Power
+    label_save_historic: Guardar Históricos
 
 show:
     label_name: Nombre
@@ -68,6 +69,7 @@ show:
     label_rx_power_pon_port: Rx Power PonPort
     label_rx_power_onu: Rx Power ONU
     label_tx_power_onu: Tx Power ONU
+    label_save_historic: Guardar Históricos
 
 list:
     label_name: Nombre
@@ -92,10 +94,12 @@ list:
     label_updated: Actualizado
     label_bias_current: Bias Current
     label_array_rx_power: Rx Power
+    label_save_historic: Guardar Históricos
     
 help:
     url: Url a consultar dispositivos
     deviceTypes: Tipos de dispositivos a consultar estadísticas
+    saveHistoric: Si desea almacenar valores históricos o solo ver los últimos obtenidos
 
 Stats: Estadísticas
 DeviceServer: Servidor Dispositivos

+ 2 - 0
src/StatsBundle/Resources/views/Onu/base_show.html.twig

@@ -3,6 +3,8 @@
 {% block show %}
     {{ parent() }}
     
+    {% if object.getDeviceServer().getSaveHistoric() == 1 %}
     {{ render(controller('StatsBundle:Stats:grafanaOnu', { 'ponSerialNumber':object.ponSerialNumber })) }}
+    {% endif %}
     
 {% endblock %}

+ 2 - 0
src/StatsBundle/Resources/views/PonPort/base_show.html.twig

@@ -36,6 +36,8 @@
         </div>
     </div>
 
+    {% if object.getDeviceServer().getSaveHistoric() == 1 %}
     {{ render(controller('StatsBundle:Stats:grafanaPonPort', { 'id':object.getId() })) }}
+    {% endif %}
     
 {% endblock %}