|
@@ -20,6 +20,7 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
new InputOption('file-crontab', false, InputOption::VALUE_OPTIONAL, "File Crontab","/etc/cron.d/fd3_stats"),
|
|
|
new InputOption('path-app', false, InputOption::VALUE_OPTIONAL, "Path App"),
|
|
|
new InputOption('url', false, InputOption::VALUE_OPTIONAL, "Crontab webservice url"),
|
|
|
+ new InputOption('amqp', false, InputOption::VALUE_OPTIONAL, "Execute the commands via amqp", true),
|
|
|
))
|
|
|
;
|
|
|
}
|
|
@@ -61,7 +62,12 @@ class GenerateRemoteCrontabCommand extends ContainerAwareCommand
|
|
|
$oltMarks = array('FiberHome','FiberLink','Huawei');
|
|
|
$oltLibraries = array('OIDSFiberHomeV1','OIDSHuaweiV1');
|
|
|
|
|
|
- $content .= "*/5 * * * * {$pathConsole} generate:crontab".PHP_EOL;
|
|
|
+ $amqp = $input->getOption('amqp');
|
|
|
+ $amqpRemote = '';
|
|
|
+ if ($amqp) {
|
|
|
+ $amqpRemote = 'amqp:remote';
|
|
|
+ }
|
|
|
+ $content .= "*/5 * * * * {$pathConsole} {$amqpRemote} generate:crontab".PHP_EOL;
|
|
|
|
|
|
foreach($serverDevices as $server) {
|
|
|
|
|
@@ -95,30 +101,42 @@ 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}";
|
|
|
- $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$mark}:pon:scan {$params}";
|
|
|
- $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$mark}:onu:scan {$params}";
|
|
|
+ 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} {$mark}:pon:scan {$params}";
|
|
|
+ $commands[] = "*/{$timeScan} * * * * {$pathConsole} {$amqpRemote} {$mark}:onu:scan {$params}";
|
|
|
|
|
|
- $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$mark}:onu:stats {$params}";
|
|
|
- $commands[] = "*/{$timePonStats} * * * * {$pathConsole} {$mark}:pon:stats {$params}";
|
|
|
- $commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$mark}:pon:octets {$params}";
|
|
|
+ $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$amqpRemote} {$mark}:onu:stats {$params}";
|
|
|
+ $commands[] = "*/{$timePonStats} * * * * {$pathConsole} {$amqpRemote} {$mark}:pon:stats {$params}";
|
|
|
+ $commands[] = "*/{$timeOltOctets} * * * * {$pathConsole} {$amqpRemote} {$mark}:pon:octets {$params}";
|
|
|
|
|
|
- $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} stats:onu --olt-device-id={$deviceId} --olt-server-id={$serverId}";
|
|
|
- $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} stats:ponport --olt-device-id={$deviceId} --olt-server-id={$serverId}";
|
|
|
+ $params = '--olt-device-id={$deviceId} --olt-server-id={$serverId}';
|
|
|
+ if ($amqp) {
|
|
|
+ $params = '--args=--olt-device-id:{$deviceId} --args=--olt-server-id:{$serverId}';
|
|
|
+ }
|
|
|
+ $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$amqpRemote} stats:onu {$params}";
|
|
|
+ $commands[] = "*/{$timeOnuStats} * * * * {$pathConsole} {$amqpRemote} stats:ponport {$params}";
|
|
|
|
|
|
$content .= PHP_EOL."# OLT {$oltName} ({$deviceIp})".PHP_EOL;
|
|
|
|
|
|
- $content .= implode(PHP_EOL,$commands);
|
|
|
+ $content .= implode(PHP_EOL, $commands);
|
|
|
}
|
|
|
|
|
|
if($this->getContainer()->getParameter('geoserver_service')) {
|
|
|
$content .= PHP_EOL.PHP_EOL."# MAPAS".PHP_EOL;
|
|
|
|
|
|
- $commands = array();
|
|
|
- $commands[] = "*/5 * * * * {$pathConsole} stats:onu:geo --olt-server-id={$serverId}";
|
|
|
- $commands[] = "*/10 * * * * {$pathConsole} stats:ponport:geo --olt-server-id={$serverId}";
|
|
|
+ $params = '--olt-server-id={$serverId}';
|
|
|
+ if ($amqp) {
|
|
|
+ $params = '--args=--olt-server-id:{$serverId}';
|
|
|
+ }
|
|
|
|
|
|
- $content .= implode(PHP_EOL,$commands);
|
|
|
+ $commands = array();
|
|
|
+ $commands[] = "*/5 * * * * {$pathConsole} {$amqpRemote} stats:onu:geo {$params}";
|
|
|
+ $commands[] = "*/10 * * * * {$pathConsole} {$amqpRemote} stats:ponport:geo {$params}";
|
|
|
|
|
|
+ $content .= implode(PHP_EOL, $commands);
|
|
|
$content .= PHP_EOL;
|
|
|
}
|
|
|
}
|