mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
parent
102ed40378
commit
c834e66b9a
@ -111,16 +111,16 @@ class CommandTransport implements CommandTransportInterface
|
|||||||
*/
|
*/
|
||||||
public function send(IcingaCommand $command, $now = null)
|
public function send(IcingaCommand $command, $now = null)
|
||||||
{
|
{
|
||||||
$tries = 0;
|
$errors = array();
|
||||||
foreach (static::getConfig() as $transportConfig) {
|
|
||||||
$transport = static::createTransport($transportConfig);
|
|
||||||
|
|
||||||
|
foreach (static::getConfig() as $name => $transportConfig) {
|
||||||
|
$transport = static::createTransport($transportConfig);
|
||||||
if ($this->transferPossible($command, $transport)) {
|
if ($this->transferPossible($command, $transport)) {
|
||||||
try {
|
try {
|
||||||
$transport->send($command, $now);
|
$transport->send($command, $now);
|
||||||
} catch (CommandTransportException $e) {
|
} catch (CommandTransportException $e) {
|
||||||
Logger::error($e);
|
Logger::error($e);
|
||||||
$tries += 1;
|
$errors[] = sprintf('%s: %s.', $name, rtrim($e->getMessage(), '.'));
|
||||||
continue; // Try the next transport
|
continue; // Try the next transport
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,14 +128,8 @@ class CommandTransport implements CommandTransportInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tries > 0) {
|
if (! empty($errors)) {
|
||||||
throw new CommandTransportException(
|
throw new CommandTransportException(implode("\n", $errors));
|
||||||
mt(
|
|
||||||
'monitoring',
|
|
||||||
'Failed to send external Icinga command. None of the configured transports'
|
|
||||||
. ' was able to transfer the command. Please see the log for more details.'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new CommandTransportException(
|
throw new CommandTransportException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user