|
@@ -27,7 +27,7 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
new InputOption('cmts-ip', false, InputOption::VALUE_OPTIONAL, "IP del CMTS"),
|
|
new InputOption('cmts-ip', false, InputOption::VALUE_OPTIONAL, "IP del CMTS"),
|
|
new InputOption('cmts-community', false, InputOption::VALUE_OPTIONAL, "Community del CMTS"),
|
|
new InputOption('cmts-community', false, InputOption::VALUE_OPTIONAL, "Community del CMTS"),
|
|
new InputOption('cmts-snmp-library', false, InputOption::VALUE_OPTIONAL, "Versión de librería SNMP"),
|
|
new InputOption('cmts-snmp-library', false, InputOption::VALUE_OPTIONAL, "Versión de librería SNMP"),
|
|
- new InputOption('cmts-docs', false, InputOption::VALUE_OPTIONAL, "Versión DOCS-QOS del CMTS.", 1),
|
|
|
|
|
|
+ new InputOption('cmts-docs', false, InputOption::VALUE_OPTIONAL, "Versión DOCS-QOS del CMTS.", 2),
|
|
new InputOption('save-historic', null, InputOption::VALUE_OPTIONAL, "Send data to StatsD",1)
|
|
new InputOption('save-historic', null, InputOption::VALUE_OPTIONAL, "Send data to StatsD",1)
|
|
))
|
|
))
|
|
;
|
|
;
|
|
@@ -42,7 +42,6 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
parent::execute($input, $output);
|
|
parent::execute($input, $output);
|
|
|
|
|
|
$key_cm_octets = "cm_octets_{$this->d_s}";
|
|
$key_cm_octets = "cm_octets_{$this->d_s}";
|
|
- //$key_cmts_octets = "cmts_octets_{$this->d_s}";
|
|
|
|
$saveHistoric = (int) $input->getOption('save-historic');
|
|
$saveHistoric = (int) $input->getOption('save-historic');
|
|
$cmtsDocs = (int) $input->getOption('cmts-docs');
|
|
$cmtsDocs = (int) $input->getOption('cmts-docs');
|
|
$inicio = microtime(true);
|
|
$inicio = microtime(true);
|
|
@@ -54,7 +53,6 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
$this->apiSNMP = $SNMP->$library();
|
|
$this->apiSNMP = $SNMP->$library();
|
|
|
|
|
|
$cmOctetsCached = $this->getData($key_cm_octets, true);
|
|
$cmOctetsCached = $this->getData($key_cm_octets, true);
|
|
- //$cmtsOctetsCached = $this->getData($key_cmts_octets, true);
|
|
|
|
|
|
|
|
$inBandTotal = $outBandTotal = $inAccTotal = $outAccTotal = 0;
|
|
$inBandTotal = $outBandTotal = $inAccTotal = $outAccTotal = 0;
|
|
|
|
|
|
@@ -63,11 +61,6 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
$cmOctetsCached = array();
|
|
$cmOctetsCached = array();
|
|
}
|
|
}
|
|
|
|
|
|
- /* if(empty($cmtsOctetsCached)) {
|
|
|
|
- $this->output->writeln("Se inicializa {$key_cmts_octets}.");
|
|
|
|
- $cmtsOctetsCached = array();
|
|
|
|
- } */
|
|
|
|
-
|
|
|
|
switch($cmtsDocs) {
|
|
switch($cmtsDocs) {
|
|
|
|
|
|
case 1:
|
|
case 1:
|
|
@@ -93,7 +86,7 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
|
|
|
|
$data = array();
|
|
$data = array();
|
|
$totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
|
|
$totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
|
|
-
|
|
|
|
|
|
+
|
|
foreach($index as $mac => $_flows) {
|
|
foreach($index as $mac => $_flows) {
|
|
|
|
|
|
$new = array('flows' => array());
|
|
$new = array('flows' => array());
|
|
@@ -137,27 +130,32 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
$new['flows'][$flow] = array('d' => $d, 'oct' => $o1);
|
|
$new['flows'][$flow] = array('d' => $d, 'oct' => $o1);
|
|
}
|
|
}
|
|
|
|
|
|
- $new['inBand'] = $inBand;
|
|
|
|
- $new['outBand'] = $outBand;
|
|
|
|
- $new['inAcc'] = $inAcc;
|
|
|
|
- $new['outAcc'] = $outAcc;
|
|
|
|
- $new['t'] = $time;
|
|
|
|
-
|
|
|
|
- $data[$mac] = $new;
|
|
|
|
$sendData["inbandwidth_cm_{$mac}"] = "{$inBand}|g";
|
|
$sendData["inbandwidth_cm_{$mac}"] = "{$inBand}|g";
|
|
$sendData["outbandwidth_cm_{$mac}"] = "{$outBand}|g";
|
|
$sendData["outbandwidth_cm_{$mac}"] = "{$outBand}|g";
|
|
-
|
|
|
|
|
|
+
|
|
$div = 1073741824; //bytes => giga
|
|
$div = 1073741824; //bytes => giga
|
|
$consIn = number_format(($inAcc / $div),3);
|
|
$consIn = number_format(($inAcc / $div),3);
|
|
$consOut = number_format(($outAcc / $div),3);
|
|
$consOut = number_format(($outAcc / $div),3);
|
|
|
|
|
|
$sendData["inconsumption_cm_{$mac}"] = "{$consIn}|g";
|
|
$sendData["inconsumption_cm_{$mac}"] = "{$consIn}|g";
|
|
$sendData["outconsumption_cm_{$mac}"] = "{$consOut}|g";
|
|
$sendData["outconsumption_cm_{$mac}"] = "{$consOut}|g";
|
|
-
|
|
|
|
|
|
+
|
|
$inBandTotal += $inBand;
|
|
$inBandTotal += $inBand;
|
|
$outBandTotal += $outBand;
|
|
$outBandTotal += $outBand;
|
|
$inAccTotal += $inAcc;
|
|
$inAccTotal += $inAcc;
|
|
$outAccTotal += $outAcc;
|
|
$outAccTotal += $outAcc;
|
|
|
|
+
|
|
|
|
+ if(date("n",$t0) != date("n",$time)) {
|
|
|
|
+ $inAcc = $outAcc = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $new['inBand'] = $inBand;
|
|
|
|
+ $new['outBand'] = $outBand;
|
|
|
|
+ $new['inAcc'] = $inAcc;
|
|
|
|
+ $new['outAcc'] = $outAcc;
|
|
|
|
+ $new['t'] = $time;
|
|
|
|
+
|
|
|
|
+ $data[$mac] = $new;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -191,6 +189,7 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
$this->output->writeln("Tiempo: $time segundos");
|
|
$this->output->writeln("Tiempo: $time segundos");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*
|
|
private function octets(&$ifStatsCached, $dataCached, $saveHistoric) {
|
|
private function octets(&$ifStatsCached, $dataCached, $saveHistoric) {
|
|
|
|
|
|
$inOctets = $this->getSNMP("inOctets","cmtsIfInOctets");
|
|
$inOctets = $this->getSNMP("inOctets","cmtsIfInOctets");
|
|
@@ -241,7 +240,7 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
$sendData["{$subId}_inbandwidth_if_{$index}"] = "{$inBandwidth}|g";
|
|
$sendData["{$subId}_inbandwidth_if_{$index}"] = "{$inBandwidth}|g";
|
|
$sendData["{$subId}_outbandwidth_if_{$index}"] = "{$outBandwidth}|g";
|
|
$sendData["{$subId}_outbandwidth_if_{$index}"] = "{$outBandwidth}|g";
|
|
|
|
|
|
- if(date("d",$t0) != date("d",$t1)) {
|
|
|
|
|
|
+ if(date("n",$t0) != date("n",$t1)) {
|
|
$inAcc = $outAcc = 0;
|
|
$inAcc = $outAcc = 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -285,5 +284,6 @@ class CmtsOctetsCommand extends BaseCmtsCommand
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ */
|
|
|
|
|
|
}
|
|
}
|