|
@@ -2,7 +2,7 @@
|
|
# bin/console cmts:cm:stats --cmts-device-id=14 --cmts-server-id=1 --cm-ip=10.42.0.27 --cm-mac=00237406d524 --cm-community=public
|
|
# bin/console cmts:cm:stats --cmts-device-id=14 --cmts-server-id=1 --cm-ip=10.42.0.27 --cm-mac=00237406d524 --cm-community=public
|
|
# http://200.50.168.115/Provisioning/admin/cablemodem/00237406d524
|
|
# http://200.50.168.115/Provisioning/admin/cablemodem/00237406d524
|
|
|
|
|
|
-# bin/console cmts:cm:stats --cmts-device-id=14 --cmts-server-id=1 --cm-ip=10.42.0.27 --cm-mac=0011e3039a4a --cm-community=public
|
|
|
|
|
|
+# bin/console cmts:cm:stats --cmts-device-id=14 --cmts-server-id=1 --cm-ip=10.50.2.3 --cm-mac=001a6663dcde --cm-community=public
|
|
|
|
|
|
namespace CmtsBundle\Command;
|
|
namespace CmtsBundle\Command;
|
|
|
|
|
|
@@ -13,6 +13,10 @@ use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use CmtsBundle\SNMP\SNMP as SNMP;
|
|
use CmtsBundle\SNMP\SNMP as SNMP;
|
|
|
|
|
|
|
|
+use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|
|
|
+use Symfony\Component\Console\Input\ArgvInput;
|
|
|
|
+use Symfony\Component\Console\Output\BufferedOutput;
|
|
|
|
+
|
|
class CmtsCmStatsCommand extends BaseCmCommand
|
|
class CmtsCmStatsCommand extends BaseCmCommand
|
|
{
|
|
{
|
|
|
|
|
|
@@ -75,6 +79,13 @@ class CmtsCmStatsCommand extends BaseCmCommand
|
|
$correcteds = $this->getSNMP("docsIfSigQCorrecteds","cmCorrecteds");
|
|
$correcteds = $this->getSNMP("docsIfSigQCorrecteds","cmCorrecteds");
|
|
$uncorrectables = $this->getSNMP("docsIfSigQUncorrectables","cmUncorrectables");
|
|
$uncorrectables = $this->getSNMP("docsIfSigQUncorrectables","cmUncorrectables");
|
|
|
|
|
|
|
|
+ $slaJson = $this->sla($this->cmIp);
|
|
|
|
+ try{
|
|
|
|
+ $sla = json_decode($slaJson,true);
|
|
|
|
+ } catch(\Exception $e) {
|
|
|
|
+ $sla = array();
|
|
|
|
+ }
|
|
|
|
+
|
|
$metrics = array('txPower' => 'cm_tx_', 'rxPower' => 'cm_rx_', 'signal' => 'cm_signal_', 'microreflection' => 'cm_microreflection_', 'unerroreds' => 'cm_unerroreds_', 'correcteds' => 'cm_correcteds_', 'uncorrectables' => 'cm_uncorrectables_');
|
|
$metrics = array('txPower' => 'cm_tx_', 'rxPower' => 'cm_rx_', 'signal' => 'cm_signal_', 'microreflection' => 'cm_microreflection_', 'unerroreds' => 'cm_unerroreds_', 'correcteds' => 'cm_correcteds_', 'uncorrectables' => 'cm_uncorrectables_');
|
|
$sendData = $data = array();
|
|
$sendData = $data = array();
|
|
|
|
|
|
@@ -103,6 +114,21 @@ class CmtsCmStatsCommand extends BaseCmCommand
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(isset($sla['latency'])) {
|
|
|
|
+ $data['latency'] = $sla['latency'];
|
|
|
|
+ $sendData["cm_latency_{$this->cmMac}"] = "{$sla['latency']}|g";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(isset($sla['jitter'])) {
|
|
|
|
+ $data['jitter'] = $sla['jitter'];
|
|
|
|
+ $sendData["cm_jitter_{$this->cmMac}"] = "{$sla['jitter']}|g";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(isset($sla['loss'])) {
|
|
|
|
+ $data['loss'] = $sla['loss'];
|
|
|
|
+ $sendData["cm_loss_{$this->cmMac}"] = "{$sla['loss']}|g";
|
|
|
|
+ }
|
|
|
|
+
|
|
$this->hset($key_cm_stats, $this->cmMac, $data, true);
|
|
$this->hset($key_cm_stats, $this->cmMac, $data, true);
|
|
|
|
|
|
//$data = $this->collector->hgetall($key_cm_stats);
|
|
//$data = $this->collector->hgetall($key_cm_stats);
|
|
@@ -124,4 +150,22 @@ class CmtsCmStatsCommand extends BaseCmCommand
|
|
$this->output->writeln("Tiempo: $time segundos");
|
|
$this->output->writeln("Tiempo: $time segundos");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function sla($ip)
|
|
|
|
+ {
|
|
|
|
+ $kernel = $this->getContainer()->get('kernel');
|
|
|
|
+
|
|
|
|
+ $application = new Application($kernel);
|
|
|
|
+ $application->setAutoExit(false);
|
|
|
|
+
|
|
|
|
+ $args = ['','ping',$ip];
|
|
|
|
+
|
|
|
|
+ $input = new ArgvInput($args);
|
|
|
|
+
|
|
|
|
+ $output = new BufferedOutput();
|
|
|
|
+
|
|
|
|
+ $application->run($input, $output);
|
|
|
|
+
|
|
|
|
+ return $output->fetch();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|