summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/ConfigController.php25
-rw-r--r--application/controllers/GraphController.php41
-rw-r--r--application/controllers/IndexController.php25
3 files changed, 91 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');
+ }
+}