public function getActionsForService(Service $service)
 {
     if ($service->check_command == "logstash_events") {
         // TODO: add icon when Icingaweb2 supports it
         // <i class="icon-doc-text"></i>
         return array(mt('logstash', 'Logstash events') => Url::fromPath('elasticsearch/event/list', array('host' => $service->getHost()->getName(), 'service' => $service->getName())));
     } else {
         return array();
     }
 }
 public function getServiceData()
 {
     $columns = array('host_name', 'host_display_name', 'host_in_downtime', 'host_acknowledged', 'host_state', 'service_description', 'service_display_name', 'service_state', 'service_in_downtime', 'service_acknowledged', 'service_output', 'host_last_state_change', 'service_attempt', 'service_last_state_change', 'service_is_flapping', 'service_state_type', 'service_last_check', 'service_last_comment', 'current_check_attempt' => 'service_current_check_attempt', 'max_check_attempts' => 'service_max_check_attempts');
     $query = $this->backend->select()->from('serviceStatus', $columns);
     $query->order('host_name', 'desc');
     $this->view->services = $query->getQuery()->fetchAll();
     foreach ($this->view->services as $service) {
         #Loop through and make sure there's a field that says "OK" so we can grab the right css class
         $service->{'service_state_text'} = Service::getStateText($service->{'service_state'});
         $service->{'host_state_text'} = Service::getStateText($service->{'host_state'});
     }
 }
示例#3
0
 /**
  * Display the detail view for a downtime
  */
 public function showAction()
 {
     $this->view->downtime = $this->downtime;
     $this->view->isService = $this->isService;
     $this->view->stateName = isset($this->downtime->service_description) ? Service::getStateText($this->downtime->service_state) : Host::getStateText($this->downtime->host_state);
     $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes');
     $this->view->showHostLink = Url::fromPath('monitoring/host/show')->setParam('host', $this->downtime->host_name);
     $this->view->showServiceLink = Url::fromPath('monitoring/service/show')->setParam('host', $this->downtime->host_name)->setParam('service', $this->downtime->service_description);
     if ($this->hasPermission('monitoring/command/downtime/delete')) {
         $this->view->delDowntimeForm = $this->createDelDowntimeForm();
         $this->view->delDowntimeForm->populate(array('redirect' => Url::fromPath('monitoring/list/downtimes'), 'downtime_id' => $this->downtime->id, 'downtime_is_service' => $this->isService));
     }
 }
示例#4
0
 /**
  * Fetch all downtimes matching the current filter and add tabs
  *
  * @throws Zend_Controller_Action_Exception
  */
 public function init()
 {
     $this->filter = Filter::fromQueryString(str_replace('downtime_id', 'downtime_internal_id', (string) $this->params));
     $query = $this->backend->select()->from('downtime', array('id' => 'downtime_internal_id', 'objecttype' => 'object_type', 'comment' => 'downtime_comment', 'author_name' => 'downtime_author_name', 'start' => 'downtime_start', 'scheduled_start' => 'downtime_scheduled_start', 'scheduled_end' => 'downtime_scheduled_end', 'end' => 'downtime_end', 'duration' => 'downtime_duration', 'is_flexible' => 'downtime_is_flexible', 'is_fixed' => 'downtime_is_fixed', 'is_in_effect' => 'downtime_is_in_effect', 'entry_time' => 'downtime_entry_time', 'host_state', 'service_state', 'host_name', 'service_description', 'host_display_name', 'service_display_name'))->addFilter($this->filter);
     $this->applyRestriction('monitoring/filter/objects', $query);
     $this->downtimes = $query->getQuery()->fetchAll();
     if (false === $this->downtimes) {
         throw new Zend_Controller_Action_Exception($this->translate('Downtime not found'));
     }
     $this->getTabs()->add('downtimes', array('title' => $this->translate('Display detailed information about multiple downtimes.'), 'icon' => 'plug', 'label' => $this->translate('Downtimes') . sprintf(' (%d)', count($this->downtimes)), 'url' => 'monitoring/downtimes/show'))->activate('downtimes');
     foreach ($this->downtimes as $downtime) {
         if (isset($downtime->service_description)) {
             $downtime->isService = true;
         } else {
             $downtime->isService = false;
         }
         if ($downtime->isService) {
             $downtime->stateText = Service::getStateText($downtime->service_state);
         } else {
             $downtime->stateText = Host::getStateText($downtime->host_state);
         }
     }
 }
示例#5
0
 /**
  * Return an empty array with all possible host state names
  *
  * @return array    An array containing all possible host states as keys and 0 as values.
  */
 public static function getServiceStatesSummaryEmpty()
 {
     return String::cartesianProduct(array(array('services'), array(Service::getStateText(Service::STATE_OK), Service::getStateText(Service::STATE_WARNING), Service::getStateText(Service::STATE_CRITICAL), Service::getStateText(Service::STATE_UNKNOWN), Service::getStateText(Service::STATE_PENDING)), array(null, 'handled', 'unhandled')), '_');
 }