Parcourir la source

Se contabliza cantidad de CM online/offline por CMTS y se almacena en MongoDB.

Maxi Schvindt il y a 6 ans
Parent
commit
0ad4d24824
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6 0
      Command/CmtsInterfaceStatsCommand.php

+ 6 - 0
Command/CmtsInterfaceStatsCommand.php

@@ -78,6 +78,7 @@ class CmtsInterfaceStatsCommand extends BaseCmtsCommand
         
         $cmCached = $this->getData($key_cm_scan, true);
         $states = array();
+        $cmtsStatus = array(0 => 0, 1 => 0);
         
         if(empty($cmCached)) {
             $this->output->writeln("Se requiere {$key_cm_scan} para obtener cantidad de CM por Interface.");
@@ -93,6 +94,8 @@ class CmtsInterfaceStatsCommand extends BaseCmtsCommand
                 $states[$up][$state]++;
                 $states[$down][$state]++;
 
+                $cmtsStatus[$state]++;
+
                 $mac = strtolower($value['mac']);
                 $sendData["cm_status_{$mac}"] = "{$state}|g";
             }
@@ -143,6 +146,9 @@ class CmtsInterfaceStatsCommand extends BaseCmtsCommand
             $this->setData($key_ifs_stats, $ifStatsCached, true);
         }
 
+        $sendData["{$subId}_state_on"] = "{$cmtsStatus[1]}|g";
+        $sendData["{$subId}_state_off"] = "{$cmtsStatus[0]}|g";
+
         if($sendData && $saveHistoric) {
             $t_start_script = microtime(true); 
             $statsdService = $this->getContainer()->get('statsd');