From 101a1f093f80b35486238e87ece9c2ea5183b776 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 8 Jul 2013 16:35:00 +0200 Subject: [PATCH] Implement command to submit passive check results Added command and mask to submit passive check results for hosts/services. refs #4355 --- .../controllers/CommandController.php | 23 +++++++++++++++++++ .../scripts/command/submitcheckresult.phtml | 1 + 2 files changed, 24 insertions(+) create mode 100644 modules/monitoring/application/views/scripts/command/submitcheckresult.phtml diff --git a/modules/monitoring/application/controllers/CommandController.php b/modules/monitoring/application/controllers/CommandController.php index 67edc32db..f01eca038 100644 --- a/modules/monitoring/application/controllers/CommandController.php +++ b/modules/monitoring/application/controllers/CommandController.php @@ -487,6 +487,29 @@ class Monitoring_CommandController extends ModuleActionController } } + public function submitcheckresultAction() + { + // @TODO: How should the "perfdata" be handled? (The interface function does not accept it) + $form = new SendCommand("Submit passive check result"); + $form->addChoice("state", "Check result:", array("UP", "DOWN", "UNREACHABLE")); + $form->addTextBox("output", "Check output:", "", false, true); + $form->addTextBox("perfdata", "Performance data:", "", false, true); + + if ($this->_request->isPost()) { + if ($form->isValid()) { + $targets = $this->selectCommandTargets($form->getHosts(), $form->getServices()); + $this->target->submitCheckResult($targets, $form->getChoice("state"), + $form->getText("output")); + } + } 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 sendComment() { $author = "AUTHOR"; //@TODO: get from auth backend diff --git a/modules/monitoring/application/views/scripts/command/submitcheckresult.phtml b/modules/monitoring/application/views/scripts/command/submitcheckresult.phtml new file mode 100644 index 000000000..4bae1498a --- /dev/null +++ b/modules/monitoring/application/views/scripts/command/submitcheckresult.phtml @@ -0,0 +1 @@ +form ?> \ No newline at end of file