Ver Fonte

Bandwidth para OLT.

Maximiliano Schvindt há 7 anos atrás
pai
commit
630151ece2
1 ficheiros alterados com 11 adições e 3 exclusões
  1. 11 3
      Command/FiberlinkPonOctetsCommand.php

+ 11 - 3
Command/FiberlinkPonOctetsCommand.php

@@ -81,6 +81,7 @@ class FiberlinkPonOctetsCommand extends BaseCommand
         $subId = $this->d_s;
         
         $t1 = time();
+        $totalIn = $totalOut = 0;
         foreach($dataCached as $index => $pon) {
             $ponPort = $index;
             if(!isset($inverse[$index])) continue;
@@ -114,6 +115,9 @@ class FiberlinkPonOctetsCommand extends BaseCommand
                     $outBandwidth = ($diff / ($t1 - $t0)) * 8;
                 }
 
+                $totalIn += $inBandwidth;
+                $totalOut += $outBandwidth;
+
                 $sendData["{$subId}_inbandwidth_pon_{$ponPort}"] = "{$inBandwidth}|g";
                 $sendData["{$subId}_outbandwidth_pon_{$ponPort}"] = "{$outBandwidth}|g";
                 
@@ -122,14 +126,18 @@ class FiberlinkPonOctetsCommand extends BaseCommand
                 $bandwidthCached[$index] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => $in1, 'outAcc' => $out1, 'inBand' => 0, 'outBand' => 0);
             }
         }
-
-        
         
         $this->setData($key_olt_pon_bandwidth, $bandwidthCached, true);
         
+        $oltBandwidth = array();
+        $oltBandwidth["{$subId}_inbandwidth_olt"] = "{$totalIn}|g";
+        $oltBandwidth["{$subId}_outbandwidth_olt"] = "{$totalOut}|g";
+
+        $statsdService = $this->getContainer()->get('statsd');
+        $statsdService->send($oltBandwidth);
+        
         if($sendData && $saveHistoric) {
             $t_start_script = microtime(true); 
-            $statsdService = $this->getContainer()->get('statsd');
             $statsdService->send($sendData);
             $t_end_script = microtime(true); 
             $time = $t_end_script - $t_start_script;