/**
  * Show a host or service
  */
 public function showAction()
 {
     $this->setAutorefreshInterval(10);
     $auth = $this->Auth();
     if ($auth->hasPermission('monitoring/command/schedule-check')) {
         $checkNowForm = new CheckNowCommandForm();
         $checkNowForm->setObjects($this->object)->handleRequest();
         $this->view->checkNowForm = $checkNowForm;
     }
     if (!in_array((int) $this->object->state, array(0, 99))) {
         if ((bool) $this->object->acknowledged) {
             if ($auth->hasPermission('monitoring/command/remove-acknowledgement')) {
                 $removeAckForm = new RemoveAcknowledgementCommandForm();
                 $removeAckForm->setObjects($this->object)->handleRequest();
                 $this->view->removeAckForm = $removeAckForm;
             }
         }
     }
     $this->object->populate();
     $toggleFeaturesForm = new ToggleObjectFeaturesCommandForm();
     $toggleFeaturesForm->setBackend($this->backend)->load($this->object)->setObjects($this->object)->handleRequest();
     $this->view->toggleFeaturesForm = $toggleFeaturesForm;
     if (!empty($this->object->comments) && $auth->hasPermission('monitoring/command/comment/delete')) {
         $delCommentForm = new DeleteCommentCommandForm();
         $delCommentForm->handleRequest();
         $this->view->delCommentForm = $delCommentForm;
     }
     if (!empty($this->object->downtimes) && $auth->hasPermission('monitoring/command/downtime/delete')) {
         $delDowntimeForm = new DeleteDowntimeCommandForm();
         $delDowntimeForm->handleRequest();
         $this->view->delDowntimeForm = $delDowntimeForm;
     }
     $this->view->showInstance = $this->backend->select()->from('instance')->count() > 1;
     $this->view->object = $this->object;
 }
示例#2
0
 public function showAction()
 {
     $this->setAutorefreshInterval(15);
     if ($this->Auth()->hasPermission('monitoring/command/schedule-check')) {
         $checkNowForm = new CheckNowCommandForm();
         $checkNowForm->setObjects($this->hostList)->handleRequest();
         $this->view->checkNowForm = $checkNowForm;
     }
     $acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
     if (!empty($acknowledgedObjects)) {
         $removeAckForm = new RemoveAcknowledgementCommandForm();
         $removeAckForm->setObjects($acknowledgedObjects)->handleRequest();
         $this->view->removeAckForm = $removeAckForm;
     }
     $featureStatus = $this->hostList->getFeatureStatus();
     $toggleFeaturesForm = new ToggleObjectFeaturesCommandForm(array('backend' => $this->backend, 'objects' => $this->hostList));
     $toggleFeaturesForm->load((object) $featureStatus)->handleRequest();
     $this->view->toggleFeaturesForm = $toggleFeaturesForm;
     $hostStates = $this->hostList->getStateSummary();
     $this->setAutorefreshInterval(15);
     $this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check');
     $this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime');
     $this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
     $this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
     $this->view->stats = $hostStates;
     $this->view->objects = $this->hostList;
     $this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
     $this->view->problemObjects = $this->hostList->getProblemObjects();
     $this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem')->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
     $this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
     $this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')->setQueryString($this->hostList->getProblemObjects()->objectsFilter()->toQueryString());
     $this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
     $this->view->acknowledgeLink = Url::fromPath('monitoring/hosts/acknowledge-problem')->setQueryString($this->hostList->getUnacknowledgedObjects()->objectsFilter()->toQueryString());
     $this->view->unacknowledgedObjects = $this->hostList->getUnacknowledgedObjects();
     $this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
     $this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts')->setQueryString($this->hostList->getObjectsInDowntime()->objectsFilter()->toQueryString());
     $this->view->showDowntimesLink = Url::fromPath('monitoring/list/downtimes')->setQueryString($this->hostList->objectsFilter()->andFilter(FilterEqual::where('object_type', 'host'))->toQueryString());
     $this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
     $this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification');
 }