ソースを参照

Se agrega suma de bandwitdh para la OLT. Se envía al StatsD
independientemente si marca para históricas o no, por olt no genera
mucha carga en la DB.

Maximiliano Schvindt 7 年 前
コミット
0fe25b5449
1 ファイル変更11 行追加2 行削除
  1. 11 2
      Command/FiberhomePonOctetsCommand.php

+ 11 - 2
Command/FiberhomePonOctetsCommand.php

@@ -65,6 +65,7 @@ class FiberhomePonOctetsCommand extends BaseCommand
         $subId = $this->d_s;
         
         $t1 = time();
+        $totalIn = $totalOut = 0;
         foreach($dataCached as $index => $pon) {
             $ponPort = "{$pon['slot']}.{$pon['port']}";
             
@@ -95,6 +96,9 @@ class FiberhomePonOctetsCommand 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";
                 
@@ -104,12 +108,17 @@ class FiberhomePonOctetsCommand extends BaseCommand
             }
         }
 
-
         $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;