From fe0d000a024bf23b4ec3fb2c8b2a6f2a214bbc66 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 8 Jul 2013 11:11:47 +0200 Subject: [PATCH] Implement enable/disable event handling for hosts/services Added action and mask for enabling/disabling event handling of hosts and services. refs #4355 --- .../controllers/CommandController.php | 34 +++++++++++++++++++ .../command/disableeventhandling.phtml | 1 + .../scripts/command/enableeventhandling.phtml | 1 + 3 files changed, 36 insertions(+) create mode 100644 modules/monitoring/application/views/scripts/command/disableeventhandling.phtml create mode 100644 modules/monitoring/application/views/scripts/command/enableeventhandling.phtml diff --git a/modules/monitoring/application/controllers/CommandController.php b/modules/monitoring/application/controllers/CommandController.php index 87cb9b232..be9936b2b 100644 --- a/modules/monitoring/application/controllers/CommandController.php +++ b/modules/monitoring/application/controllers/CommandController.php @@ -309,6 +309,40 @@ class Monitoring_CommandController extends ModuleActionController } } + public function enableeventhandlingAction() + { + $form = new SendCommand("Enable event handler?"); + if ($this->_request->isPost()) { + if ($form->isValid()) { + $targets = $this->selectCommandTargets($form->getHosts(), $form->getServices()); + $this->target->enableEventHandler($targets); + } + } else { + $form->setServices($this->getParameter("services", false)); + $form->setHosts($this->getParameter("hosts")); + $form->setAction($this->view->url()); + $form->addSubmitButton("Commit"); + $this->view->form = $form; + } + } + + public function disableeventhandlingAction() + { + $form = new SendCommand("Disable event handler?"); + if ($this->_request->isPost()) { + if ($form->isValid()) { + $targets = $this->selectCommandTargets($form->getHosts(), $form->getServices()); + $this->target->disableEventHandler($targets); + } + } else { + $form->setServices($this->getParameter("services", false)); + $form->setHosts($this->getParameter("hosts")); + $form->setAction($this->view->url()); + $form->addSubmitButton("Commit"); + $this->view->form = $form; + } + } + public function sendPassivechecks() { if ($this->getMandatoryParameter("enable")) { diff --git a/modules/monitoring/application/views/scripts/command/disableeventhandling.phtml b/modules/monitoring/application/views/scripts/command/disableeventhandling.phtml new file mode 100644 index 000000000..4bae1498a --- /dev/null +++ b/modules/monitoring/application/views/scripts/command/disableeventhandling.phtml @@ -0,0 +1 @@ +form ?> \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/command/enableeventhandling.phtml b/modules/monitoring/application/views/scripts/command/enableeventhandling.phtml new file mode 100644 index 000000000..4bae1498a --- /dev/null +++ b/modules/monitoring/application/views/scripts/command/enableeventhandling.phtml @@ -0,0 +1 @@ +form ?> \ No newline at end of file