Implement enable/disable flap detection for hosts/services

Added action and mask for enabling/disabling flap detection
for hosts and services.

refs #4355
This commit is contained in:
Johannes Meyer 2013-07-08 11:16:23 +02:00 committed by Marius Hein
parent fe0d000a02
commit 1138afd5fb
3 changed files with 36 additions and 9 deletions

View File

@ -343,6 +343,40 @@ class Monitoring_CommandController extends ModuleActionController
}
}
public function enableflapdetectionAction()
{
$form = new SendCommand("Enable flap detection?");
if ($this->_request->isPost()) {
if ($form->isValid()) {
$targets = $this->selectCommandTargets($form->getHosts(), $form->getServices());
$this->target->enableFlappingDetection($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 disableflapdetectionAction()
{
$form = new SendCommand("Disable flap detection?");
if ($this->_request->isPost()) {
if ($form->isValid()) {
$targets = $this->selectCommandTargets($form->getHosts(), $form->getServices());
$this->target->disableFlappingDetection($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")) {
@ -352,15 +386,6 @@ class Monitoring_CommandController extends ModuleActionController
}
}
public function sendFlappingdetection()
{
if ($this->getMandatoryParameter("enable")) {
$this->target->enableFlappingDetection($this->selectCommandTargets());
} else {
$this->target->disableFlappingDetection($this->selectCommandTargets());
}
}
public function sendComment()
{
$author = "AUTHOR"; //@TODO: get from auth backend

View File

@ -0,0 +1 @@
<?= $this->form ?>

View File

@ -0,0 +1 @@
<?= $this->form ?>