浏览代码

Bandwidth para OLT.

Maximiliano Schvindt 7 年之前
父节点
当前提交
16b9e81634
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11 1
      Command/HuaweiPonOctetsCommand.php

+ 11 - 1
Command/HuaweiPonOctetsCommand.php

@@ -65,6 +65,7 @@ class HuaweiPonOctetsCommand extends BaseCommand
         $subId = $this->d_s;
         $subId = $this->d_s;
         
         
         $t1 = time();
         $t1 = time();
+        $totalIn = $totalOut = 0;
         foreach($dataCached as $index => $pon) {
         foreach($dataCached as $index => $pon) {
             $ponPort = str_replace("/",".",$pon['ponPort']);
             $ponPort = str_replace("/",".",$pon['ponPort']);
             
             
@@ -95,6 +96,9 @@ class HuaweiPonOctetsCommand extends BaseCommand
                     $outBandwidth = ($diff / ($t1 - $t0)) * 8;
                     $outBandwidth = ($diff / ($t1 - $t0)) * 8;
                 }
                 }
 
 
+                $totalIn += $inBandwidth;
+                $totalOut += $outBandwidth;
+
                 $sendData["{$subId}_inbandwidth_pon_{$ponPort}"] = "{$inBandwidth}|g";
                 $sendData["{$subId}_inbandwidth_pon_{$ponPort}"] = "{$inBandwidth}|g";
                 $sendData["{$subId}_outbandwidth_pon_{$ponPort}"] = "{$outBandwidth}|g";
                 $sendData["{$subId}_outbandwidth_pon_{$ponPort}"] = "{$outBandwidth}|g";
                 
                 
@@ -106,9 +110,15 @@ class HuaweiPonOctetsCommand extends BaseCommand
 
 
         $this->setData($key_olt_pon_bandwidth, $bandwidthCached, true);
         $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) {
         if($sendData && $saveHistoric) {
             $t_start_script = microtime(true); 
             $t_start_script = microtime(true); 
-            $statsdService = $this->getContainer()->get('statsd');
             $statsdService->send($sendData);
             $statsdService->send($sendData);
             $t_end_script = microtime(true); 
             $t_end_script = microtime(true); 
             $time = $t_end_script - $t_start_script;
             $time = $t_end_script - $t_start_script;