|
@@ -122,9 +122,8 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$timeOltOctets = $data['timeOltOctets'];
|
|
|
|
|
|
$params = "--olt-ip={$deviceIp} --olt-community={$snmpCommunity} --olt-snmp-library={$library} --olt-device-id={$deviceId} --olt-server-id={$serverId}";
|
|
|
- if ($amqp) {
|
|
|
+ if ($amqp)
|
|
|
$params = "--args=--olt-ip:{$deviceIp} --args=--olt-community:{$snmpCommunity} --args=--olt-snmp-library:{$library} --args=--olt-device-id:{$deviceId} --args=--olt-server-id:{$serverId}";
|
|
|
- }
|
|
|
|
|
|
$commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:pon:scan {$params}";
|
|
|
$commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:onu:scan {$params}";
|
|
@@ -138,15 +137,14 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:onu:stats {$params}";
|
|
|
$commands[] = "*/{$timePonStats} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:pon:stats {$params}";
|
|
|
|
|
|
- if($mark == "huawei") {
|
|
|
+ if($mark == "huawei")
|
|
|
$commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:onu:octets {$params}";
|
|
|
- }
|
|
|
+
|
|
|
$commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$amqpRemote} {$routing_key} {$mark}:pon:octets {$params}";
|
|
|
|
|
|
$params = "--olt-device-id={$deviceId} --olt-server-id={$serverId}";
|
|
|
- if ($amqp) {
|
|
|
- $params = "--args=--olt-device-id:{$deviceId} --args=--olt-server-id:{$serverId}";
|
|
|
- }
|
|
|
+ if ($amqp) $params = "--args=--olt-device-id:{$deviceId} --args=--olt-server-id:{$serverId}";
|
|
|
+
|
|
|
$commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$amqpRemote} {$routing_key} stats:onu {$params}";
|
|
|
$commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$amqpRemote} {$routing_key} stats:ponport {$params}";
|
|
|
|
|
@@ -159,9 +157,7 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$content .= PHP_EOL . PHP_EOL . "# MAPAS" . PHP_EOL;
|
|
|
|
|
|
$params = "--olt-server-id={$serverId}";
|
|
|
- if ($amqp) {
|
|
|
- $params = "--args=--olt-server-id:{$serverId}";
|
|
|
- }
|
|
|
+ if ($amqp) $params = "--args=--olt-server-id:{$serverId}";
|
|
|
|
|
|
$commands = array();
|
|
|
$commands[] = "*/5 * * * * {$pathConsole} {$amqpRemote} {$routing_key} stats:onu:geo {$params}";
|
|
@@ -171,6 +167,7 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$content .= PHP_EOL;
|
|
|
}
|
|
|
|
|
|
+ // APARTADO NAS
|
|
|
$nasDevices = $doctrine->getRepository('\StatsBundle\Entity\Device')->findBy(array('deviceType' => 'RadiusBundle\Entity\NAS', 'deviceServer' => $server));
|
|
|
|
|
|
foreach ($nasDevices as $device) {
|
|
@@ -198,9 +195,8 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$deviceIp = $device->getIp();
|
|
|
|
|
|
$params = "--nas-ip={$deviceIp} --nas-community={$snmpCommunity} --nas-snmp-library={$library} --nas-device-id={$deviceId} --nas-server-id={$serverId} --save-historic=1";
|
|
|
- if ($amqp) {
|
|
|
+ if ($amqp)
|
|
|
$params = "--args=--nas-ip:{$deviceIp} --args=--nas-community:{$snmpCommunity} --args=--nas-snmp-library:{$library} --args=--nas-device-id:{$deviceId} --args=--nas-server-id:{$serverId} --args=--save-historic:1";
|
|
|
- }
|
|
|
|
|
|
$commands[] = "*/10 * * * * {$pathConsole} {$amqpRemote} {$routing_key} nas:onu:octets {$params}";
|
|
|
$content .= PHP_EOL . "# NAS {$description} ({$deviceIp})" . PHP_EOL;
|
|
@@ -208,6 +204,57 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$content .= implode(PHP_EOL, $commands) . PHP_EOL.PHP_EOL;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // APARTADO CMTS
|
|
|
+ $cmtsDevices = $doctrine->getRepository('\StatsBundle\Entity\Device')->findBy(array('deviceType' => 'CablemodemBundle\Entity\CMTS', 'deviceServer' => $server));
|
|
|
+
|
|
|
+ foreach ($cmtsDevices as $device) {
|
|
|
+ $commands = array();
|
|
|
+ $data = $device->jsonExtraData();
|
|
|
+ $deviceId = $device->getDeviceId();
|
|
|
+
|
|
|
+ if (is_null($data['snmpCommunity']) || empty($data['snmpCommunity'])){
|
|
|
+ $content .= PHP_EOL . PHP_EOL . "# Device(CMTS) {$deviceId} skiped, snmpCommunity is null or empty" . PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!in_array($data['library'], array('OIDSBase'))){
|
|
|
+ $content .= PHP_EOL . PHP_EOL . "# Device(CMTS) {$deviceId} skiped, library not exist" . PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$data['executeSnmp']){
|
|
|
+ $content .= PHP_EOL . PHP_EOL . "# Device(CMTS) {$deviceId} skiped, because executeSnmp is 0". PHP_EOL;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $library = $data['library'];
|
|
|
+ $snmpCommunity = $data['snmpCommunity'];
|
|
|
+ $description = $data['name'];
|
|
|
+ $deviceIp = $device->getIp();
|
|
|
+ $timeScan = $data['timeScan'];
|
|
|
+
|
|
|
+ $params = "--cmts-ip={$deviceIp} --cmts-community={$snmpCommunity} --cmts-snmp-library={$library} --cmts-device-id={$deviceId} --cmts-server-id={$serverId}";
|
|
|
+ if ($amqp)
|
|
|
+ $params = "--args=--cmts-ip:{$deviceIp} --args=--cmts-community:{$snmpCommunity} --args=--cmts-snmp-library:{$library} --args=--cmts-device-id:{$deviceId} --args=--cmts-server-id:{$serverId}";
|
|
|
+
|
|
|
+ $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} cmts:cm:scan {$params}";
|
|
|
+ $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} cmts:interface:scan {$params}";
|
|
|
+
|
|
|
+ $params .= " --save-historic={$saveHistoric}";
|
|
|
+ if ($amqp) $params .= " --args=--save-historic:{$saveHistoric}";
|
|
|
+
|
|
|
+ $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} cmts:interface:stats {$params}";
|
|
|
+
|
|
|
+ $params = "--cmts-device-id={$deviceId} --cmts-server-id={$serverId}";
|
|
|
+ if ($amqp) $params = "--args=--cmts-device-id:{$deviceId} --args=--cmts-server-id:{$serverId}";
|
|
|
+
|
|
|
+ $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$routing_key} stats:interface {$params}";
|
|
|
+
|
|
|
+ $content .= PHP_EOL . "# CMTS {$description} ({$deviceIp})" . PHP_EOL;
|
|
|
+
|
|
|
+ $content .= implode(PHP_EOL, $commands) . PHP_EOL.PHP_EOL;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
file_put_contents($fileCrontab, $content);
|
|
|
|