|
@@ -68,7 +68,7 @@ class NasOnuOctetsCommand extends BaseCommand
|
|
|
|
|
|
if($this->lock($this->flag)) {exit(1);}
|
|
if($this->lock($this->flag)) {exit(1);}
|
|
|
|
|
|
- $key_nas_scan = "nas_scan_{$this->d_s}";
|
|
|
|
|
|
+ //$key_nas_scan = "nas_scan_{$this->d_s}";
|
|
$key_nas_onu_bandwidth = "nas_bandwidth_onu_{$this->d_s}";
|
|
$key_nas_onu_bandwidth = "nas_bandwidth_onu_{$this->d_s}";
|
|
$saveHistoric = (int) $input->getOption('save-historic');
|
|
$saveHistoric = (int) $input->getOption('save-historic');
|
|
$inicio = microtime(true);
|
|
$inicio = microtime(true);
|
|
@@ -77,35 +77,29 @@ class NasOnuOctetsCommand extends BaseCommand
|
|
$library = "use".$this->nasSnmpLibrary;
|
|
$library = "use".$this->nasSnmpLibrary;
|
|
$this->apiSNMP = $SNMP->$library();
|
|
$this->apiSNMP = $SNMP->$library();
|
|
|
|
|
|
- $dataCached = $this->getData($key_nas_scan, true);
|
|
|
|
$bandwidthCached = $this->getData($key_nas_onu_bandwidth, true);
|
|
$bandwidthCached = $this->getData($key_nas_onu_bandwidth, true);
|
|
|
|
|
|
- if(empty($dataCached)) {
|
|
|
|
- $this->output->writeln("Se requiere {$key_nas_scan}.");
|
|
|
|
- $this->removeLock($this->flag);
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
$onus = $this->getSNMP("onuSerialNumber","onuSerialNumber");
|
|
$onus = $this->getSNMP("onuSerialNumber","onuSerialNumber");
|
|
|
|
|
|
//counter64
|
|
//counter64
|
|
$inOctets = $this->getSNMP("onuInOctets","onuInOctets");
|
|
$inOctets = $this->getSNMP("onuInOctets","onuInOctets");
|
|
$outOctets = $this->getSNMP("onuOutOctets","onuOutOctets");
|
|
$outOctets = $this->getSNMP("onuOutOctets","onuOutOctets");
|
|
|
|
|
|
-
|
|
|
|
- print_r($onus);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
$sendData = array();
|
|
$sendData = array();
|
|
-
|
|
|
|
|
|
+
|
|
$subId = $this->d_s;
|
|
$subId = $this->d_s;
|
|
|
|
|
|
$t1 = time();
|
|
$t1 = time();
|
|
$totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
|
|
$totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
|
|
- foreach($dataCached as $index => $onu) {
|
|
|
|
-
|
|
|
|
- $sn = $onu["serialNumber"];
|
|
|
|
-
|
|
|
|
|
|
+ foreach($onus as $index => $onu) {
|
|
|
|
+
|
|
|
|
+ if(preg_match("/^<pppoe-([^-]+)[-\d]*>$/",$onu, $match)){
|
|
|
|
+ $sn = strtolower($match[1]);
|
|
|
|
+ } else {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
(isset($inOctets[$index]))? $in1 = $inOctets[$index] : $in1 = 0;
|
|
(isset($inOctets[$index]))? $in1 = $inOctets[$index] : $in1 = 0;
|
|
(isset($outOctets[$index]))? $out1 = $outOctets[$index] : $out1 = 0;
|
|
(isset($outOctets[$index]))? $out1 = $outOctets[$index] : $out1 = 0;
|
|
|
|
|
|
@@ -149,7 +143,7 @@ class NasOnuOctetsCommand extends BaseCommand
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- $this->setData($key_olt_onu_bandwidth, $bandwidthCached, true);
|
|
|
|
|
|
+ $this->setData($key_nas_onu_bandwidth, $bandwidthCached, true);
|
|
|
|
|
|
if($sendData && $saveHistoric) {
|
|
if($sendData && $saveHistoric) {
|
|
$t_start_script = microtime(true);
|
|
$t_start_script = microtime(true);
|
|
@@ -160,7 +154,6 @@ class NasOnuOctetsCommand extends BaseCommand
|
|
print_r("Tiempo de envío al StatsD: {$time} ms / Cantidad: ".count($sendData).PHP_EOL);
|
|
print_r("Tiempo de envío al StatsD: {$time} ms / Cantidad: ".count($sendData).PHP_EOL);
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
|
|
|
|
/* Fin de bloqueo */
|
|
/* Fin de bloqueo */
|
|
$this->removeLock($this->flag);
|
|
$this->removeLock($this->flag);
|