summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/controllers/ConfigController.php25
-rw-r--r--application/controllers/GraphController.php41
-rw-r--r--application/controllers/IndexController.php25
-rw-r--r--application/forms/Config/GeneralConfigForm.php62
-rw-r--r--application/locale/de_DE/LC_MESSAGES/pnp.mobin0 -> 1237 bytes
-rw-r--r--application/locale/de_DE/LC_MESSAGES/pnp.po77
-rw-r--r--application/locale/it_IT/LC_MESSAGES/pnp.mobin0 -> 1238 bytes
-rw-r--r--application/locale/it_IT/LC_MESSAGES/pnp.po67
-rw-r--r--application/views/scripts/config/index.phtml6
-rw-r--r--application/views/scripts/index/iframe.phtml4
10 files changed, 307 insertions, 0 deletions
diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php
new file mode 100644
index 0000000..f6a0dcd
--- /dev/null
+++ b/application/controllers/ConfigController.php
@@ -0,0 +1,25 @@
+<?php
+/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
+
+namespace Icinga\Module\Pnp\Controllers;
+
+use Icinga\Web\Controller;
+use Icinga\Module\Pnp\Forms\Config\GeneralConfigForm;
+
+class ConfigController extends Controller
+{
+ /**
+ * General configuration
+ */
+ public function indexAction()
+ {
+ $this->assertPermission('config/modules');
+
+ $form = new GeneralConfigForm();
+ $form->setIniConfig($this->Config());
+ $form->handleRequest();
+
+ $this->view->form = $form;
+ $this->view->tabs = $this->Module()->getConfigTabs()->activate('config');
+ }
+}
diff --git a/application/controllers/GraphController.php b/application/controllers/GraphController.php
new file mode 100644
index 0000000..312b802
--- /dev/null
+++ b/application/controllers/GraphController.php
@@ -0,0 +1,41 @@
+<?php
+/* Icinga Web 2 | (c) 2013-2017 Icinga Development Team | GPLv2+ */
+
+namespace Icinga\Module\Pnp\Controllers;
+
+use Icinga\Module\Pnp\Web\Controller;
+
+class GraphController extends Controller
+{
+ public function indexAction()
+ {
+ $url = $this->getRequest()->getUrl();
+ $queryString = $url->getQueryString();
+
+ $this->view->url = sprintf(
+ '%s/graph?%s',
+ $this->getBaseUrl(),
+ $queryString
+ );
+
+ $host = $this->getParam('host');
+ $service = $this->getParam('srv');
+
+ $serviceTitle = '';
+ if ($service && $service !== '_HOST_') {
+ $serviceTitle = sprintf(' | %s: %s', $this->translate('Service'), $service);
+ }
+ $this->view->title = $title = sprintf('%s: %s%s',
+ $this->translate('Host'),
+ $host,
+ $serviceTitle
+ );
+
+ $this->getTabs()->add('graph', array(
+ 'label' => $title,
+ 'url' => $url,
+ ))->activate('graph');
+
+ $this->setViewScript('index/iframe');
+ }
+}
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
new file mode 100644
index 0000000..7725268
--- /dev/null
+++ b/application/controllers/IndexController.php
@@ -0,0 +1,25 @@
+<?php
+/* Icinga Web 2 | (c) 2013-2017 Icinga Development Team | GPLv2+ */
+
+namespace Icinga\Module\Pnp\Controllers;
+
+use Icinga\Module\Pnp\Web\Controller;
+
+class IndexController extends Controller
+{
+ public function indexAction()
+ {
+ $this->getTabs()->activate('pnp');
+
+ $defaultQuery = $this->Config()->get('pnp4nagios', 'default_query', 'host=.pnp-internal&srv=runtime');
+
+ $this->view->title = 'PNP';
+ $this->view->url = sprintf(
+ '%s/graph?%s',
+ $this->getBaseUrl(),
+ $defaultQuery
+ );
+
+ $this->setViewScript('index/iframe');
+ }
+}
diff --git a/application/forms/Config/GeneralConfigForm.php b/application/forms/Config/GeneralConfigForm.php
new file mode 100644
index 0000000..d751055
--- /dev/null
+++ b/application/forms/Config/GeneralConfigForm.php
@@ -0,0 +1,62 @@
+<?php
+/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
+
+namespace Icinga\Module\Pnp\Forms\Config;
+
+use Icinga\Forms\ConfigForm;
+
+class GeneralConfigForm extends ConfigForm
+{
+ /**
+ * Initialize this form
+ */
+ public function init()
+ {
+ $this->setName('form_config_pnp4nagios_general');
+ $this->setSubmitLabel($this->translate('Save Changes'));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function createElements(array $formData)
+ {
+ $this->addElement(
+ 'text',
+ 'pnp4nagios_config_dir',
+ array(
+ 'value' => '/etc/pnp4nagios',
+ 'label' => $this->translate('PNP4Nagios configuration'),
+ 'description' => $this->translate('PNP4Nagios configuration path name (e.g. /etc/pnp4nagios)')
+ )
+ );
+ $this->addElement(
+ 'text',
+ 'pnp4nagios_base_url',
+ array(
+ 'value' => '/pnp4nagios',
+ 'label' => $this->translate('PNP4Nagios url'),
+ 'description' => $this->translate('The base URL of your PNP4Nagios installation (e.g. /pnp4nagios)')
+ )
+ );
+
+ $this->addElement(
+ 'checkbox',
+ 'pnp4nagios_menu_disabled',
+ array(
+ 'label' => $this->translate('Disable menu entry'),
+ 'description' => $this->translate('Hide PNP from main menu')
+ )
+ );
+
+ $this->addElement(
+ 'text',
+ 'pnp4nagios_default_query',
+ array(
+ 'value' => 'host=.pnp-internal&srv=runtime',
+ 'label' => $this->translate('Index query'),
+ 'description' => $this->translate('Default URL query for the index view: /pnp4nagios/graph?{query}')
+ )
+ );
+ }
+}
diff --git a/application/locale/de_DE/LC_MESSAGES/pnp.mo b/application/locale/de_DE/LC_MESSAGES/pnp.mo
new file mode 100644
index 0000000..b7076cf
--- /dev/null
+++ b/application/locale/de_DE/LC_MESSAGES/pnp.mo
Binary files differ
diff --git a/application/locale/de_DE/LC_MESSAGES/pnp.po b/application/locale/de_DE/LC_MESSAGES/pnp.po
new file mode 100644
index 0000000..8cd9a5c
--- /dev/null
+++ b/application/locale/de_DE/LC_MESSAGES/pnp.po
@@ -0,0 +1,77 @@
+# Icinga Web 2 - Head for multiple monitoring backends.
+# Copyright (C) 2015 Icinga Development Team
+# This file is distributed under the same license as Pnp Module.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Pnp Module (1.0.0)\n"
+"Report-Msgid-Bugs-To: dev@icinga.org\n"
+"POT-Creation-Date: 2015-11-17 11:56+0100\n"
+"PO-Revision-Date: 2015-11-17 12:01+0100\n"
+"Last-Translator: Thomas Gelf <thomas@gelf.net>\n"
+"Language: de_DE\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:224
+msgid "25 Hours"
+msgstr "25 Stunden"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:223
+msgid "4 Hours"
+msgstr "4 Stunden"
+
+#: /usr/local/icingaweb-modules/pnp/configuration.php:8
+msgid "Config"
+msgstr "Konfiguration"
+
+#: /usr/local/icingaweb-modules/pnp/configuration.php:7
+msgid "Configure this module"
+msgstr "Dieses Modul konfigurieren"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:226
+msgid "One Month"
+msgstr "Ein Monat"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:225
+msgid "One Week"
+msgstr "Eine Woche"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:227
+msgid "One Year"
+msgstr "Ein Jahr"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:29
+msgid "PNP4Nagios configuration"
+msgstr "PNP4Nagios Konfiguration"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:30
+msgid "PNP4Nagios configuration path name (e.g. /etc/pnp4nagios)"
+msgstr "PNP4Nagios Konfigurationspfad (z.b. /etc/pnp4nagios)"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:38
+msgid "PNP4Nagios url"
+msgstr "PNP4Nagios URL"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:16
+msgid "Save Changes"
+msgstr "Ă„nderungen speichern"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:39
+msgid "The base URL of your PNP4Nagios installation (e.g. /pnp4nagios)"
+msgstr "Basis-URL deiner PNP4Nagios installation (z.B. /pnp4nagios)"
+
+#~ msgid ""
+#~ "Configuration form is still missing in this prototype. In case your "
+#~ "PNP4Nagios config path is not %s or your base PNP4Nagios web url differs "
+#~ "from %s please create a config file in %s following this example:"
+#~ msgstr ""
+#~ "Dieser Prototyp stellt noch kein Konfigurationsformular bereit. Sollte "
+#~ "dein PNP4Nagios Konfigurationspfad nicht %s sein oder deine PNP4Nagios "
+#~ "URL sich von %s unterscheiden erstelle bitte unter %s eine dem folgenden "
+#~ "Beispiel entprechende Konfigurationsdatei:"
diff --git a/application/locale/it_IT/LC_MESSAGES/pnp.mo b/application/locale/it_IT/LC_MESSAGES/pnp.mo
new file mode 100644
index 0000000..0a72826
--- /dev/null
+++ b/application/locale/it_IT/LC_MESSAGES/pnp.mo
Binary files differ
diff --git a/application/locale/it_IT/LC_MESSAGES/pnp.po b/application/locale/it_IT/LC_MESSAGES/pnp.po
new file mode 100644
index 0000000..629b067
--- /dev/null
+++ b/application/locale/it_IT/LC_MESSAGES/pnp.po
@@ -0,0 +1,67 @@
+# Icinga Web 2 - Head for multiple monitoring backends.
+# Copyright (C) 2015 Icinga Development Team
+# This file is distributed under the same license as Pnp Module.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Pnp Module (1.0.0)\n"
+"Report-Msgid-Bugs-To: dev@icinga.org\n"
+"POT-Creation-Date: 2015-11-17 11:57+0100\n"
+"PO-Revision-Date: 2015-11-17 11:59+0100\n"
+"Last-Translator: Thomas Gelf <thomas@gelf.net>\n"
+"Language: it_IT\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:224
+msgid "25 Hours"
+msgstr "25 ore"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:223
+msgid "4 Hours"
+msgstr "4 ore"
+
+#: /usr/local/icingaweb-modules/pnp/configuration.php:8
+msgid "Config"
+msgstr "Configurazione"
+
+#: /usr/local/icingaweb-modules/pnp/configuration.php:7
+msgid "Configure this module"
+msgstr "Configura questo modulo"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:226
+msgid "One Month"
+msgstr "Un mese"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:225
+msgid "One Week"
+msgstr "Una settimana"
+
+#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:227
+msgid "One Year"
+msgstr "Un anno"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:29
+msgid "PNP4Nagios configuration"
+msgstr "Configurazione PNP4Nagios"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:30
+msgid "PNP4Nagios configuration path name (e.g. /etc/pnp4nagios)"
+msgstr "Directory della configurazione PNP4Nagios (es. /etc/pnp4nagios)"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:38
+msgid "PNP4Nagios url"
+msgstr "URL PNP4Nagios"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:16
+msgid "Save Changes"
+msgstr "Salva modifiche"
+
+#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:39
+msgid "The base URL of your PNP4Nagios installation (e.g. /pnp4nagios)"
+msgstr "URL di base della tua installazione PNP4Nagios (es. /pnp4nagios)"
diff --git a/application/views/scripts/config/index.phtml b/application/views/scripts/config/index.phtml
new file mode 100644
index 0000000..4ca5e68
--- /dev/null
+++ b/application/views/scripts/config/index.phtml
@@ -0,0 +1,6 @@
+<div class="controls">
+ <?= $tabs; ?>
+</div>
+<div class="content">
+ <?= $form; ?>
+</div> \ No newline at end of file
diff --git a/application/views/scripts/index/iframe.phtml b/application/views/scripts/index/iframe.phtml
new file mode 100644
index 0000000..be0c35a
--- /dev/null
+++ b/application/views/scripts/index/iframe.phtml
@@ -0,0 +1,4 @@
+<div class="controls">
+ <?= $tabs ?>
+</div>
+<iframe src="<?= $this->url ?>" style="height: 99%; width:100%" frameborder="no"></iframe>