Bläddra i källkod

Se envía el consumo de la OLT al StatsD.

Maximiliano Schvindt 7 år sedan
förälder
incheckning
7dbcd4d2ef
1 ändrade filer med 14 tillägg och 2 borttagningar
  1. 14 2
      Command/FiberlinkPonOctetsCommand.php

+ 14 - 2
Command/FiberlinkPonOctetsCommand.php

@@ -81,7 +81,7 @@ class FiberlinkPonOctetsCommand extends BaseCommand
         $subId = $this->d_s;
         
         $t1 = time();
-        $totalIn = $totalOut = 0;
+        $totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
         foreach($dataCached as $index => $pon) {
             $ponPort = $index;
             if(!isset($inverse[$index])) continue;
@@ -120,10 +120,17 @@ class FiberlinkPonOctetsCommand extends BaseCommand
 
                 $sendData["{$subId}_inbandwidth_pon_{$ponPort}"] = "{$inBandwidth}|g";
                 $sendData["{$subId}_outbandwidth_pon_{$ponPort}"] = "{$outBandwidth}|g";
+
+                if(date("d",$t0) != date("d",$t1)) {
+                    $inAcc = $outAcc = 0;
+                }
+
+                $totalConsOut += $outAcc;
+                $totalConsIn += $inAcc;
                 
                 $bandwidthCached[$index] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => $inAcc, 'outAcc' => $outAcc, 'inBand' => $inBandwidth, 'outBand' => $outBandwidth);
             } else {
-                $bandwidthCached[$index] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => $in1, 'outAcc' => $out1, 'inBand' => 0, 'outBand' => 0);
+                $bandwidthCached[$index] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => 0, 'outAcc' => 0, 'inBand' => 0, 'outBand' => 0);
             }
         }
         
@@ -133,8 +140,13 @@ class FiberlinkPonOctetsCommand extends BaseCommand
         $oltBandwidth["{$subId}_inbandwidth_olt"] = "{$totalIn}|g";
         $oltBandwidth["{$subId}_outbandwidth_olt"] = "{$totalOut}|g";
 
+        $oltConsumption = array();
+        $oltConsumption["{$subId}_inconsumption_olt"] = "{$totalConsIn}|g";
+        $oltConsumption["{$subId}_outconsumption_olt"] = "{$totalConsOut}|g";
+
         $statsdService = $this->getContainer()->get('statsd');
         $statsdService->send($oltBandwidth);
+        $statsdService->send($oltConsumption);
         
         if($sendData && $saveHistoric) {
             $t_start_script = microtime(true);