Setup: show monitoring config summary even with Icinga 2 API as command transport

fixes #13459
This commit is contained in:
Alexander A. Klimov 2016-12-07 17:08:13 +01:00
parent 5797ce52d7
commit 0665ca387b
3 changed files with 90 additions and 44 deletions

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: Monitoring Module (2.1.2)\n"
"Report-Msgid-Bugs-To: dev@icinga.org\n"
"POT-Creation-Date: 2016-02-29 14:40+0000\n"
"PO-Revision-Date: 2016-04-26 12:08+0200\n"
"PO-Revision-Date: 2016-12-07 17:02+0100\n"
"Last-Translator: Thomas Gelf <thomas@gelf.net>\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
@ -16,7 +16,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language-Team: \n"
"X-Generator: Poedit 1.8.7.1\n"
"X-Generator: Poedit 1.8.11\n"
#: /vagrant/modules/monitoring/application/controllers/ChartController.php:375
msgid " Down Hosts (Handled)"
@ -1816,7 +1816,16 @@ msgstr ""
"Backend mit dem Namen “%s” und die weiter unten spezifizierte Ressourcen "
"abrufen:"
#: /vagrant/modules/monitoring/library/Monitoring/TransportStep.php:76
#: /vagrant/modules/monitoring/library/Monitoring/TransportStep.php:87
msgid ""
"Icinga Web 2 will use the Icinga 2 API to send commands to your monitoring "
"instance by using the connection details listed below:"
msgstr ""
"Icinga Web 2 wird die Icinga 2 API verwenden, um Kommandos an Ihre "
"Monitoringinstanz zu senden. Dazu werden die folgenden "
"Verbindungseinstellungen verwendet:"
#: /vagrant/modules/monitoring/library/Monitoring/TransportStep.php:49
#, php-format
msgid ""
"Icinga Web 2 will use the named pipe located at \"%s\" to send commands to "
@ -1919,8 +1928,8 @@ msgstr ""
#: /vagrant/modules/monitoring/application/forms/Command/Object/SendCustomNotificationCommandForm.php:45
msgid ""
"If you work with other administrators, you may find it useful to share "
"information about the host or service that is having problems. Make sure "
"you enter a brief description of what you are doing."
"information about the host or service that is having problems. Make sure you "
"enter a brief description of what you are doing."
msgstr ""
"Wenn Sie mit anderen Administratoren zusammenarbeiten, werden Sie es "
"nützlich finden, Informationen zu Hosts oder Services mit Problemen "

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Exception\ProgrammingError;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
use Icinga\Exception\IcingaException;
@ -40,47 +41,83 @@ class TransportStep extends Step
public function getSummary()
{
$pageTitle = '<h2>' . mt('monitoring', 'Command Transport', 'setup.page.title') . '</h2>';
if (isset($this->data['transportConfig']['host'])) {
$pipeHtml = '<p>' . sprintf(
mt(
'monitoring',
'Icinga Web 2 will use the named pipe located on a remote machine at "%s" to send commands'
. ' to your monitoring instance by using the connection details listed below:'
),
$this->data['transportConfig']['path']
) . '</p>';
$pipeHtml .= ''
. '<table>'
. '<tbody>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Remote Host') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['host'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Remote SSH Port') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['port'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Remote SSH User') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['user'] . '</td>'
. '</tr>'
. '</tbody>'
. '</table>';
} else {
$pipeHtml = '<p>' . sprintf(
mt(
'monitoring',
'Icinga Web 2 will use the named pipe located at "%s"'
. ' to send commands to your monitoring instance.'
),
$this->data['transportConfig']['path']
) . '</p>';
switch ($this->data['transportConfig']['transport']) {
case 'local':
$details = '<p>' . sprintf(
mt(
'monitoring',
'Icinga Web 2 will use the named pipe located at "%s"'
. ' to send commands to your monitoring instance.'
),
$this->data['transportConfig']['path']
) . '</p>';
break;
case 'remote':
$details = '<p>'
. sprintf(
mt(
'monitoring',
'Icinga Web 2 will use the named pipe located on a remote machine at "%s" to send commands'
. ' to your monitoring instance by using the connection details listed below:'
),
$this->data['transportConfig']['path']
)
. '</p>'
. '<table>'
. '<tbody>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Remote Host') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['host'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Remote SSH Port') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['port'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Remote SSH User') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['user'] . '</td>'
. '</tr>'
. '</tbody>'
. '</table>';
break;
case 'api':
$details = '<p>'
. mt(
'monitoring',
'Icinga Web 2 will use the Icinga 2 API to send commands'
. ' to your monitoring instance by using the connection details listed below:'
)
. '</p>'
. '<table>'
. '<tbody>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Host') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['host'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Port') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['port'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Username') . '</strong></td>'
. '<td>' . $this->data['transportConfig']['username'] . '</td>'
. '</tr>'
. '<tr>'
. '<td><strong>' . mt('monitoring', 'Password') . '</strong></td>'
. '<td>' . str_repeat('*', strlen($this->data['transportConfig']['password'])) . '</td>'
. '</tr>'
. '</tbody>'
. '</table>';
break;
default:
throw new ProgrammingError(
'Unknown command transport type: %s',
$this->data['transportConfig']['transport']
);
}
return $pageTitle . '<div class="topic">' . $pipeHtml . '</div>';
return '<h2>' . mt('monitoring', 'Command Transport', 'setup.page.title') . '</h2>'
. '<div class="topic">' . $details . '</div>';
}
public function getReport()