Browse Source

Changed files on generate crontab

Jean Sumara Leopoldo 5 years ago
parent
commit
0964452645

+ 1 - 1
app/config/parameters.yml.dist

@@ -28,7 +28,7 @@ parameters:
     db_session_name: fd_session
     db_session_user: root
     db_session_password: '%env(MYSQL_ROOT_PASSWORD)%'
-    app_path: '/opt/stats'
+    app_path: '/opt/stats_command'
     geoserver_service: false
     geoserver_host: '%env(HOST_GEOSERVER)%'
     geoserver_port: 8082

+ 1 - 1
app/config/parameters.yml.docker

@@ -35,7 +35,7 @@ parameters:
     db_session_name: fd_session
     db_session_user: root
     db_session_password: '%env(MYSQL_ROOT_PASSWORD)%'
-    app_path: '/opt/stats'
+    app_path: '/opt/stats_command'
     geoserver_service: false
     geoserver_host: '%env(HOST_GEOSERVER)%'
     geoserver_port: 8082

+ 3 - 86
src/StatsBundle/Command/GenerateCrontabCommand.php

@@ -87,44 +87,16 @@ class GenerateCrontabCommand extends ContainerAwareCommand
                 $deviceId = $device->getDeviceId();
 
                 $timeScan = $data['timeScan'];
-                $timeOnuStats = $data['timeOnuStats'];
-                $timePonStats = $data['timePonStats'];
-                $timeOltOctets = $data['timeOltOctets'];
+                $timeOltScan = $data['timeOnuScan'];
 
-                $params = "--olt-ip={$deviceIp} --olt-community={$snmpCommunity} --olt-snmp-library={$library} --olt-device-id={$deviceId} --olt-server-id={$serverId}";
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$mark}:pon:scan {$params}";
+                $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}:onu:scan {$params}";
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$mark}:olt:scan {$params}";
-                
-                $params .= " --save-historic={$saveHistoric}";
-                $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$mark}:onu:stats {$params}";
-                $commands[] = "*/{$timePonStats} * * * * {$pathConsole} {$mark}:pon:stats {$params}";
-
-                if($mark == "huawei") {
-                    $commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$mark}:onu:octets {$params}";
-                }
-                $commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$mark}:pon:octets {$params}";
-                
-                $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} stats:onu --olt-device-id={$deviceId} --olt-server-id={$serverId}";
-                $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} stats:ponport --olt-device-id={$deviceId} --olt-server-id={$serverId}";
-
+                $commands[] = "*/{$timeOltScan} * * * * {$pathConsole} {$mark}:olt:scan {$params}";
                 
                 fwrite($handle, PHP_EOL."# OLT {$oltName} ({$deviceIp})".PHP_EOL);
                 
                 fwrite($handle, implode(PHP_EOL,$commands).PHP_EOL.PHP_EOL);
             }
-            
-            if($this->getContainer()->getParameter('geoserver_service')) {
-                fwrite($handle, PHP_EOL.PHP_EOL."# MAPAS".PHP_EOL);
-                
-                $commands = array();
-                $commands[] = "*/5 * * * * {$pathConsole} stats:onu:geo --olt-server-id={$serverId}";
-                $commands[] = "*/10 * * * * {$pathConsole} stats:ponport:geo --olt-server-id={$serverId}";
-                
-                fwrite($handle, implode(PHP_EOL,$commands));
-                
-                fwrite($handle, PHP_EOL.PHP_EOL);
-            }
 
             // APARTADO NAS
             $nasDevices = $doctrine->getRepository('\StatsBundle\Entity\Device')->findBy(array('deviceType' => 'RadiusBundle\Entity\NAS', 'deviceServer' => $server));
@@ -159,61 +131,6 @@ class GenerateCrontabCommand extends ContainerAwareCommand
                 fwrite($handle, implode(PHP_EOL,$commands).PHP_EOL.PHP_EOL);
                 
             }
-
-            // APARTADO CMTS
-            $cmtsDevices = $doctrine->getRepository('\StatsBundle\Entity\Device')->findBy(array('deviceType' => 'CablemodemBundle\Entity\CMTS', 'deviceServer' => $server));
-
-            foreach ($cmtsDevices as $device) {
-                $commands = array();
-                $data = $device->jsonExtraData();
-                $deviceId = $device->getDeviceId();
-
-                if (is_null($data['snmpCommunity']) || empty($data['snmpCommunity'])){
-		            $content .= PHP_EOL . PHP_EOL . "# Device(CMTS) {$deviceId} skiped, snmpCommunity is null or empty" . PHP_EOL;
-                    continue;
-		        }   
-                if (!in_array($data['library'], array('OIDSBase'))){
-		            $content .= PHP_EOL . PHP_EOL . "# Device(CMTS) {$deviceId} skiped, library not exist" . PHP_EOL;
-                    continue;
-                }   
-                
-                if (!$data['executeSnmp']){
-		            $content .= PHP_EOL . PHP_EOL . "# Device(CMTS) {$deviceId} skiped, because executeSnmp is 0". PHP_EOL;
-                    continue;
-                }
-                
-                $library = $data['library'];
-                $snmpCommunity = $data['snmpCommunity'];
-                $docsVersion = $data['docsVersion'];
-                $description = $data['name'];
-                $deviceIp = $device->getIp();
-                $timeScan = $data['timeScan'];
-                $timeOctets = $data['timeCmtsOctets'];
-                (isset($data['timeCmStats']))? $timeCmStats = $data['timeCmStats'] : $timeCmStats = 10;
-
-                $params = "--cmts-ip={$deviceIp} --cmts-community={$snmpCommunity} --cmts-snmp-library={$library} --cmts-device-id={$deviceId} --cmts-server-id={$serverId}";
-                
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} cmts:cm:scan {$params}";
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} cmts:interface:scan {$params}";
-                
-                $params .= " --save-historic={$saveHistoric}";
-                
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} cmts:interface:stats {$params}";
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} cmts:interface:description {$params}";
-
-                $params .= " --cmts-docs={$docsVersion}";
-
-                $commands[] = "*/{$timeOctets} * * * * {$pathConsole}  cmts:octets {$params}";
-                
-                $params = "--cmts-device-id={$deviceId} --cmts-server-id={$serverId}";
-
-                $commands[] = "*/{$timeScan} * * * * {$pathConsole} stats:interface {$params}";
-                $commands[] = "*/{$timeCmStats} * * * * {$pathConsole} stats:cm {$params}";
-                
-                fwrite($handle, PHP_EOL.PHP_EOL."# CMTS {$description} ({$deviceIp})".PHP_EOL);
-                fwrite($handle, PHP_EOL);
-                fwrite($handle, implode(PHP_EOL,$commands).PHP_EOL.PHP_EOL);
-            }
         }
 
 	fwrite($handle, PHP_EOL . PHP_EOL);