Merge branch 'master' into feature/more-intuitive-module-installation-8191
This commit is contained in:
commit
afd58d52bf
|
@ -4,7 +4,6 @@
|
|||
VAGRANTFILE_API_VERSION = "2"
|
||||
VAGRANT_REQUIRED_VERSION = "1.5.0"
|
||||
|
||||
# Require 1.2.x at least
|
||||
if ! defined? Vagrant.require_version
|
||||
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
|
||||
puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
|
||||
|
|
|
@ -48,7 +48,7 @@ class LdapDiscoveryForm extends Form
|
|||
array(
|
||||
'required' => false,
|
||||
'label' => $this->translate('Host'),
|
||||
'description' => $this->translate('IP or host name to search.'),
|
||||
'description' => $this->translate('IP or hostname to search.'),
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<?= $this->form ?>
|
||||
<div class="footer">Icinga Web 2 © 2013-2014<br><a href="https://www.icinga.org">The Icinga Project</a></div>
|
||||
<div class="footer">Icinga Web 2 © 2013-2015<br><a href="https://www.icinga.org">The Icinga Project</a></div>
|
||||
<?php if ($requiresSetup): ?>
|
||||
<div class="config-note"><?= sprintf(
|
||||
t(
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
## Requirements
|
||||
|
||||
* Vagrant >= version 1.4
|
||||
* Vagrant >= version 1.5
|
||||
* VirtualBox or Parallels
|
||||
|
||||
> **Note:** The deployment of the virtual machine is tested against Vagrant starting with version 1.4.
|
||||
> **Note:** The deployment of the virtual machine is tested against Vagrant starting with version 1.5.
|
||||
> Unfortunately older versions will not work.
|
||||
|
||||
## General
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Module\Monitoring\Backend;
|
||||
|
@ -12,13 +10,9 @@ use Icinga\Web\Widget\Tabextension\DashboardAction;
|
|||
use Icinga\Web\Widget\Tabextension\OutputFormat;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
use Icinga\Web\Widget\SortBox;
|
||||
use Icinga\Web\Widget\FilterBox;
|
||||
use Icinga\Web\Widget\Chart\HistoryColorGrid;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Web\Widget;
|
||||
use Icinga\Module\Monitoring\Web\Widget\SelectBox;
|
||||
use Icinga\Module\Monitoring\Forms\StatehistoryForm;
|
||||
use Icinga\Module\Monitoring\Forms\EventOverviewForm;
|
||||
|
||||
class Monitoring_ListController extends Controller
|
||||
{
|
||||
|
@ -97,12 +91,10 @@ class Monitoring_ListController extends Controller
|
|||
}
|
||||
|
||||
// Handle soft and hard states
|
||||
$stateType = $this->params->shift('stateType', 'soft');
|
||||
if ($stateType == 'hard') {
|
||||
if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') {
|
||||
$stateColumn = 'host_hard_state';
|
||||
$stateChangeColumn = 'host_last_hard_state_change';
|
||||
} else {
|
||||
$stateType = 'soft';
|
||||
$stateColumn = 'host_state';
|
||||
$stateChangeColumn = 'host_last_state_change';
|
||||
}
|
||||
|
@ -112,6 +104,7 @@ class Monitoring_ListController extends Controller
|
|||
$query = $this->backend->select()->from('hostStatus', array_merge(array(
|
||||
'host_icon_image',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_state' => $stateColumn,
|
||||
'host_address',
|
||||
'host_acknowledged',
|
||||
|
@ -139,12 +132,11 @@ class Monitoring_ListController extends Controller
|
|||
$this->filterQuery($query);
|
||||
|
||||
$this->setupSortControl(array(
|
||||
'host_last_check' => $this->translate('Last Check'),
|
||||
'host_severity' => $this->translate('Severity'),
|
||||
'host_name' => $this->translate('Hostname'),
|
||||
'host_address' => $this->translate('Address'),
|
||||
'host_state' => $this->translate('Current State'),
|
||||
'host_state' => $this->translate('Hard State')
|
||||
'host_display_name' => $this->translate('Hostname'),
|
||||
'host_address' => $this->translate('Address'),
|
||||
'host_last_check' => $this->translate('Last Check')
|
||||
));
|
||||
$this->view->hosts = $query->paginate();
|
||||
|
||||
|
@ -171,14 +163,12 @@ class Monitoring_ListController extends Controller
|
|||
}
|
||||
|
||||
// Handle soft and hard states
|
||||
$stateType = $this->params->shift('stateType', 'soft');
|
||||
if ($stateType == 'hard') {
|
||||
if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') {
|
||||
$stateColumn = 'service_hard_state';
|
||||
$stateChangeColumn = 'service_last_hard_state_change';
|
||||
} else {
|
||||
$stateColumn = 'service_state';
|
||||
$stateChangeColumn = 'service_last_state_change';
|
||||
$stateType = 'soft';
|
||||
}
|
||||
|
||||
$this->addTitleTab('services', $this->translate('Services'));
|
||||
|
@ -192,6 +182,7 @@ class Monitoring_ListController extends Controller
|
|||
|
||||
$columns = array_merge(array(
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_state',
|
||||
'host_state_type',
|
||||
'host_last_state_change',
|
||||
|
@ -228,14 +219,13 @@ class Monitoring_ListController extends Controller
|
|||
|
||||
$this->filterQuery($query);
|
||||
$this->setupSortControl(array(
|
||||
'service_last_check' => $this->translate('Last Service Check'),
|
||||
'service_severity' => $this->translate('Severity'),
|
||||
'service_severity' => $this->translate('Service Severity'),
|
||||
'service_state' => $this->translate('Current Service State'),
|
||||
'service_description' => $this->translate('Service Name'),
|
||||
'service_state_type' => $this->translate('Hard State'),
|
||||
'service_display_name' => $this->translate('Service Name'),
|
||||
'service_last_check' => $this->translate('Last Service Check'),
|
||||
'host_severity' => $this->translate('Host Severity'),
|
||||
'host_state' => $this->translate('Current Host State'),
|
||||
'host_name' => $this->translate('Host Name'),
|
||||
'host_display_name' => $this->translate('Hostname'),
|
||||
'host_address' => $this->translate('Host Address'),
|
||||
'host_last_check' => $this->translate('Last Host Check')
|
||||
));
|
||||
|
@ -295,22 +285,24 @@ class Monitoring_ListController extends Controller
|
|||
'host' => 'downtime_host',
|
||||
'service' => 'downtime_service',
|
||||
'host_state' => 'downtime_host_state',
|
||||
'service_state' => 'downtime_service_state'
|
||||
))->order('downtime_is_in_effect', 'DESC')
|
||||
->order('downtime_scheduled_start', 'DESC');
|
||||
'service_state' => 'downtime_service_state',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
));
|
||||
|
||||
$this->filterQuery($query);
|
||||
|
||||
$this->setupSortControl(array(
|
||||
'downtime_is_in_effect' => $this->translate('Is In Effect'),
|
||||
'downtime_host' => $this->translate('Host / Service'),
|
||||
'downtime_entry_time' => $this->translate('Entry Time'),
|
||||
'downtime_author' => $this->translate('Author'),
|
||||
'downtime_start' => $this->translate('Start Time'),
|
||||
'downtime_start' => $this->translate('End Time'),
|
||||
'downtime_scheduled_start' => $this->translate('Scheduled Start'),
|
||||
'downtime_scheduled_end' => $this->translate('Scheduled End'),
|
||||
'downtime_duration' => $this->translate('Duration'),
|
||||
'downtime_is_in_effect' => $this->translate('Is In Effect'),
|
||||
'host_display_name' => $this->translate('Host'),
|
||||
'service_display_name' => $this->translate('Service'),
|
||||
'downtime_entry_time' => $this->translate('Entry Time'),
|
||||
'downtime_author' => $this->translate('Author'),
|
||||
'downtime_start' => $this->translate('Start Time'),
|
||||
'downtime_end' => $this->translate('End Time'),
|
||||
'downtime_scheduled_start' => $this->translate('Scheduled Start'),
|
||||
'downtime_scheduled_end' => $this->translate('Scheduled End'),
|
||||
'downtime_duration' => $this->translate('Duration')
|
||||
));
|
||||
|
||||
$this->view->downtimes = $query->paginate();
|
||||
|
@ -333,7 +325,9 @@ class Monitoring_ListController extends Controller
|
|||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
'notification_state',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
));
|
||||
$this->filterQuery($query);
|
||||
$this->view->notifications = $query->paginate();
|
||||
|
@ -471,17 +465,20 @@ class Monitoring_ListController extends Controller
|
|||
'persistent' => 'comment_is_persistent',
|
||||
'expiration' => 'comment_expiration',
|
||||
'host' => 'comment_host',
|
||||
'service' => 'comment_service'
|
||||
'service' => 'comment_service',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
));
|
||||
$this->filterQuery($query);
|
||||
$this->view->comments = $query->paginate();
|
||||
|
||||
$this->setupSortControl(
|
||||
array(
|
||||
'comment_timestamp' => $this->translate('Comment Timestamp'),
|
||||
'comment_host' => $this->translate('Host / Service'),
|
||||
'comment_type' => $this->translate('Comment Type'),
|
||||
'comment_expiration' => $this->translate('Expiration'),
|
||||
'comment_timestamp' => $this->translate('Comment Timestamp'),
|
||||
'host_display_name' => $this->translate('Host'),
|
||||
'service_display_name' => $this->translate('Service'),
|
||||
'comment_type' => $this->translate('Comment Type'),
|
||||
'comment_expiration' => $this->translate('Expiration')
|
||||
)
|
||||
);
|
||||
$this->view->delCommentForm = new DeleteCommentCommandForm();
|
||||
|
@ -590,7 +587,9 @@ class Monitoring_ListController extends Controller
|
|||
|
||||
$query = $this->backend->select()->from('eventHistory', array(
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'object_type',
|
||||
'timestamp',
|
||||
'state',
|
||||
|
|
|
@ -165,8 +165,10 @@ class Monitoring_ShowController extends Controller
|
|||
'notification_output',
|
||||
'notification_contact',
|
||||
'notification_start_time',
|
||||
'notification_state'
|
||||
))->order('notification_start_time');
|
||||
'notification_state',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
));
|
||||
|
||||
$notifications->where('contact_object_id', $contact->contact_object_id);
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Helper for generating frequently used jump links
|
||||
*
|
||||
* Most of the monitoring overviews link to detail information, e.g. the full information of the involved monitored
|
||||
* object. Instead of reintroducing link generation and translation in those views, this helper contains most
|
||||
* frequently used jump links.
|
||||
*/
|
||||
class Zend_View_Helper_Link extends Zend_View_Helper_Abstract
|
||||
{
|
||||
/**
|
||||
* Helper entry point
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function link()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a host link
|
||||
*
|
||||
* @param string $host Hostname
|
||||
* @param string $linkText Link text, e.g. the host's display name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function host($host, $linkText)
|
||||
{
|
||||
return $this->view->qlink(
|
||||
$linkText,
|
||||
$this->view->href('monitoring/host/show', array('host' => $host))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a service link
|
||||
*
|
||||
* @param string $service Service name
|
||||
* @param string $serviceLinkText Text for the service link, e.g. the service's display name
|
||||
* @param string $host Hostname
|
||||
* @param string $hostLinkText Text for the host link, e.g. the host's display name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function service($service, $serviceLinkText, $host, $hostLinkText)
|
||||
{
|
||||
return sprintf(
|
||||
$this->view->translate('%s on %s', 'Service running on host'),
|
||||
$this->view->qlink(
|
||||
$serviceLinkText,
|
||||
$this->view->href('monitoring/service/show', array('host' => $host, 'service' => $service))
|
||||
),
|
||||
$this->host($host, $hostLinkText)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -50,21 +50,13 @@
|
|||
</td>
|
||||
<td>
|
||||
<?php if ($comment->objecttype === 'service'): ?>
|
||||
<?= $this->icon('conf'); ?> <a href="<?= $this->href('monitoring/service/show', array(
|
||||
'host' => $comment->host,
|
||||
'service' => $comment->service,
|
||||
)); ?>">
|
||||
<?= $comment->service; ?>
|
||||
</a>
|
||||
<small>
|
||||
<?= $this->translate('on') . ' ' . $comment->host; ?>
|
||||
</small>
|
||||
<?= $this->icon('service') ?>
|
||||
<?= $this->link()->service(
|
||||
$comment->service, $comment->service_display_name, $comment->host, $comment->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host'); ?> <a href="<?= $this->href('monitoring/host/show', array(
|
||||
'host' => $comment->host
|
||||
)); ?>">
|
||||
<?= $comment->host; ?>
|
||||
</a>
|
||||
<?= $this->icon('host') ?>
|
||||
<?= $this->link()->host($comment->host, $comment->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->icon('comment'); ?> <?= isset($comment->author)
|
||||
|
|
|
@ -31,8 +31,10 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php foreach ($downtimes as $downtime): ?>
|
||||
<?php
|
||||
if (isset($downtime->service)) {
|
||||
$isService = true;
|
||||
$stateName = Service::getStateText($downtime->service_state);
|
||||
} else {
|
||||
$isService = false;
|
||||
$stateName = Host::getStateText($downtime->host_state);
|
||||
}
|
||||
?>
|
||||
|
@ -52,25 +54,17 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (isset($downtime->service)): ?>
|
||||
<?= $this->icon('service'); ?> <a href="<?= $this->href('monitoring/service/show', array(
|
||||
'host' => $downtime->host,
|
||||
'service' => $downtime->service
|
||||
)); ?>">
|
||||
<?= $downtime->service; ?>
|
||||
</a>
|
||||
<small>
|
||||
<?= $this->translate('on'); ?> <?= $downtime->host; ?>
|
||||
</small>
|
||||
<?php if ($isService): ?>
|
||||
<?= $this->icon('service') ?>
|
||||
<?= $this->link()->service(
|
||||
$downtime->service, $downtime->service_display_name, $downtime->host, $downtime->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host'); ?> <a href="<?= $this->href('monitoring/host/show', array(
|
||||
'host' => $downtime->host
|
||||
)); ?>">
|
||||
<?= $downtime->host; ?>
|
||||
</a>
|
||||
<?= $this->icon('host') ?>
|
||||
<?= $this->link()->host($downtime->host, $downtime->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->icon('comment'); ?> [<?= $downtime->author; ?>] <?= $downtime->comment; ?>
|
||||
<?= $this->icon('comment') ?> [<?= $this->escape($downtime->author) ?>] <?= $this->escape($downtime->comment) ?>
|
||||
<br>
|
||||
<small>
|
||||
<?php if ($downtime->is_flexible): ?>
|
||||
|
|
|
@ -106,25 +106,15 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
</td>
|
||||
<td>
|
||||
<?php if ($isService): ?>
|
||||
<a href="<?= $this->href('monitoring/show/service', array(
|
||||
'host' => $event->host,
|
||||
'service' => $event->service
|
||||
)); ?>">
|
||||
<?= $event->service; ?>
|
||||
</a>
|
||||
<small>
|
||||
<?= $this->translate('on') . ' ' . $event->host; ?>
|
||||
</small>
|
||||
<?= $this->link()->service(
|
||||
$event->service, $event->service_display_name, $event->host, $event->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<a href="<?= $this->href('monitoring/show/host', array(
|
||||
'host' => $event->host
|
||||
)); ?>">
|
||||
<?= $event->host; ?>
|
||||
</a>
|
||||
<?= $this->link()->host($event->host, $event->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<div>
|
||||
<?= $this->icon($icon, $title); ?> <?= empty($msg) ? '' : $msg; ?>
|
||||
<?= $this->icon($icon, $title); ?> <?= empty($msg) ? '' : $this->escape($msg) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -98,7 +98,7 @@ if ($hosts->count() === 0) {
|
|||
<?= $this->icon($this->resolveMacros($host->host_icon_image, $host)) ?>
|
||||
<?php endif ?>
|
||||
<?= implode(' ', $icons) ?>
|
||||
<a href="<?= $hostLink ?>"><?= $host->host_name ?></a>
|
||||
<a href="<?= $hostLink ?>"><?= $this->escape($host->host_display_name) ?></a>
|
||||
<?php if (isset($host->host_unhandled_services) && $host->host_unhandled_services > 0): ?>
|
||||
<span title="<?=
|
||||
$host->host_unhandled_services
|
||||
|
|
|
@ -25,20 +25,13 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<tbody>
|
||||
<?php foreach ($notifications as $notification):
|
||||
if (isset($notification->service)) {
|
||||
$isService = true;
|
||||
$href = $this->href('monitoring/show/service', array(
|
||||
'host' => $notification->host,
|
||||
'service' => $notification->service
|
||||
));
|
||||
$stateName = Service::getStateText($notification->notification_state);
|
||||
$isService = true;
|
||||
$stateName = Service::getStateText($notification->notification_state);
|
||||
} else {
|
||||
$isService = false;
|
||||
$href = $this->href('monitoring/show/host', array(
|
||||
'host' => $notification->host
|
||||
));
|
||||
$stateName = Host::getStateText($notification->notification_state);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<tr class="state <?= $stateName ?>">
|
||||
<td class="state">
|
||||
<?= $this->dateTimeRenderer($notification->notification_start_time)->render(
|
||||
|
@ -49,15 +42,19 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
</td>
|
||||
<td style="font-size: 0.8em">
|
||||
<?php if ($isService): ?>
|
||||
<?= sprintf(
|
||||
$this->translate('%s on %s'),
|
||||
$this->qlink($notification->service, $href), $notification->host
|
||||
<?= $this->icon('service') ?>
|
||||
<?= $this->link()->service(
|
||||
$notification->service,
|
||||
$notification->service_display_name,
|
||||
$notification->host,
|
||||
$notification->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->qlink($notification->host, $href) ?>
|
||||
<?= $this->icon('host') ?>
|
||||
<?= $this->link()->host($notification->host, $notification->host_display_name) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->escape(substr(strip_tags($notification->notification_output), 0, 10000)); ?>
|
||||
<?= $this->escape($this->ellipsis($notification->notification_output, 10000)) ?>
|
||||
<br>
|
||||
<?php if (! $this->contact): ?>
|
||||
<small>
|
||||
|
|
|
@ -107,7 +107,7 @@ foreach ($services as $service):
|
|||
<?php if ($service->service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?>
|
||||
<?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
|
||||
<?php endif ?>
|
||||
<a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a><?php if ($this->showHost): ?> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?>
|
||||
<a href="<?= $serviceLink ?>"><?= $this->escape($service->service_display_name) ?></a><?php if ($this->showHost): ?> on <a href="<?= $hostLink ?>"><?= $this->escape($service->host_display_name) ?>
|
||||
<?php if ($service->host_state != 0): ?>
|
||||
(<?= strtoupper(Host::getStateText($service->host_state, true)); ?>)
|
||||
<?php endif ?>
|
||||
|
|
|
@ -3,37 +3,44 @@
|
|||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
$showService = $object->getType() === $object::TYPE_SERVICE;
|
||||
$isService = $object->getType() === $object::TYPE_SERVICE;
|
||||
|
||||
?>
|
||||
<?php if (!$this->compact): ?>
|
||||
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $tabs ?>
|
||||
<?php endif ?>
|
||||
|
||||
<table class="objectstate">
|
||||
<tr class="state <?= Host::getStateText($object->host_state); ?><?= $object->host_handled ? ' handled' : '' ?>">
|
||||
<td class="state"<?= $showService ? '' : ' rowspan="2"' ?>>
|
||||
<strong><?= strtoupper(Host::getStateText($object->host_state, true)); ?></strong><br />
|
||||
<?= $this->prefixedTimeSince($object->host_last_state_change, true) ?>
|
||||
</td>
|
||||
<td><b><?= $this->escape($object->host_name) ?></b><?php
|
||||
if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||
<br><?= $this->escape($object->host_address) ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td class="state"<?= $isService ? '' : ' rowspan="2"' ?>>
|
||||
<strong><?= strtoupper(Host::getStateText($object->host_state, true)); ?></strong><br>
|
||||
<?= $this->prefixedTimeSince($object->host_last_state_change, true) ?>
|
||||
</td>
|
||||
<td>
|
||||
<b><?= $this->escape($object->host_display_name) ?></b>
|
||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||
<small>(<?= $this->escape($object->host_name) ?>)</small>
|
||||
<?php endif ?>
|
||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||
<br>
|
||||
<?= $this->escape($object->host_address) ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($isService): ?>
|
||||
<tr class="state <?= Service::getStateText($object->service_state); ?><?= $object->service_handled ? ' handled' : '' ?>">
|
||||
<td class="state">
|
||||
<strong><?= strtoupper(Service::getStateText($object->service_state, true)); ?></strong><br>
|
||||
<?= $this->prefixedTimeSince($object->service_last_state_change, true) ?>
|
||||
</td>
|
||||
<td>
|
||||
<b><?= $this->translate('Service') ?>: <?= $this->escape($object->service_display_name) ?></b>
|
||||
<?php if ($object->service_display_name !== $object->service_description): ?>
|
||||
<small>(<?= $this->escape($object->service_description) ?>)</small>
|
||||
<?php endif ?>
|
||||
<?= $this->render('show/components/statusIcons.phtml') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($showService): ?>
|
||||
<tr class="state <?= Service::getStateText($object->service_state); ?><?= $object->service_handled ? ' handled' : '' ?>">
|
||||
<td class="state">
|
||||
<strong><?= strtoupper(Service::getStateText($object->service_state, true)); ?></strong><br />
|
||||
<?= $this->prefixedTimeSince($object->service_last_state_change, true) ?>
|
||||
</td>
|
||||
<td><b><?= $this->translate('Service') ?>: <?= $this->escape($object->service_description) ?></b>
|
||||
|
||||
<?= $this->render('show/components/statusIcons.phtml') ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<tr><td><!--<b>Host state</b>--> </td></tr>
|
||||
<?php endif ?>
|
||||
</table>
|
||||
|
|
|
@ -136,19 +136,24 @@ $output = $this->tickets ? preg_replace_callback(
|
|||
|
||||
?>
|
||||
<?php if ($isService): ?>
|
||||
<?= $hostContext ? $this->qlink(
|
||||
$this->escape($event->service_description),
|
||||
'monitoring/show/service',
|
||||
array(
|
||||
'host' => $event->host_name,
|
||||
'service' => $event->service_description)
|
||||
) : $this->escape($event->service_description); ?> <?= $this->translate('on') . ' ' . $this->escape($event->host_name); ?>
|
||||
<?= sprintf(
|
||||
$this->translate('%s on %s', 'Service running on host'),
|
||||
$hostContext ? $this->qlink(
|
||||
$this->escape($event->service_display_name),
|
||||
'monitoring/show/service',
|
||||
array(
|
||||
'host' => $event->host_name,
|
||||
'service' => $event->service_description
|
||||
)
|
||||
) : $this->escape($event->service_display_name),
|
||||
$event->host_display_name
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->escape($event->host_name); ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<div>
|
||||
<?= $this->icon($icon, $title); ?> <?= empty($msg) ? '' : $msg; ?>
|
||||
<?= $this->icon($icon, $title); ?> <?= empty($msg) ? '' : $this->escape($msg) ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -23,6 +23,12 @@ class CommentQuery extends IdoQuery
|
|||
'comment_service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279
|
||||
'comment_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
|
||||
),
|
||||
'hosts' => array(
|
||||
'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END'
|
||||
),
|
||||
'services' => array(
|
||||
'service_display_name' => 's.display_name'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -44,4 +50,29 @@ class CommentQuery extends IdoQuery
|
|||
);
|
||||
$this->joinedVirtualTables = array('comments' => true);
|
||||
}
|
||||
|
||||
protected function joinHosts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'h.host_object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinServices()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('s' => $this->prefix . 'services'),
|
||||
's.service_object_id = so.object_id',
|
||||
array()
|
||||
);
|
||||
$this->select->joinLeft(
|
||||
array('sh' => $this->prefix . 'hosts'),
|
||||
'sh.host_object_id = s.host_object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +1,41 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
/**
|
||||
* Handling downtime queries
|
||||
*/
|
||||
class DowntimeQuery extends IdoQuery
|
||||
{
|
||||
/**
|
||||
* Column map
|
||||
* @var array
|
||||
*/
|
||||
protected $columnMap = array(
|
||||
'downtime' => array(
|
||||
'downtime_author' => 'sd.author_name',
|
||||
'author' => 'sd.author_name',
|
||||
'downtime_comment' => 'sd.comment_data',
|
||||
'downtime_entry_time' => 'UNIX_TIMESTAMP(sd.entry_time)',
|
||||
'downtime_is_fixed' => 'sd.is_fixed',
|
||||
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
|
||||
'downtime_triggered_by_id' => 'sd.triggered_by_id',
|
||||
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
|
||||
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
|
||||
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)",
|
||||
'downtime_end' => 'CASE WHEN sd.is_fixed > 0 THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END',
|
||||
'downtime_duration' => 'sd.duration',
|
||||
'downtime_is_in_effect' => 'sd.is_in_effect',
|
||||
'downtime_internal_id' => 'sd.internal_downtime_id',
|
||||
'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279
|
||||
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
||||
'downtime_service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279
|
||||
'downtime_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
|
||||
'downtime_host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END',
|
||||
'downtime_service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END'
|
||||
'downtime_author' => 'sd.author_name',
|
||||
'author' => 'sd.author_name',
|
||||
'downtime_comment' => 'sd.comment_data',
|
||||
'downtime_entry_time' => 'UNIX_TIMESTAMP(sd.entry_time)',
|
||||
'downtime_is_fixed' => 'sd.is_fixed',
|
||||
'downtime_is_flexible' => 'CASE WHEN sd.is_fixed = 0 THEN 1 ELSE 0 END',
|
||||
'downtime_triggered_by_id' => 'sd.triggered_by_id',
|
||||
'downtime_scheduled_start' => 'UNIX_TIMESTAMP(sd.scheduled_start_time)',
|
||||
'downtime_scheduled_end' => 'UNIX_TIMESTAMP(sd.scheduled_end_time)',
|
||||
'downtime_start' => "UNIX_TIMESTAMP(CASE WHEN UNIX_TIMESTAMP(sd.trigger_time) > 0 then sd.trigger_time ELSE sd.scheduled_start_time END)",
|
||||
'downtime_end' => 'CASE WHEN sd.is_fixed > 0 THEN UNIX_TIMESTAMP(sd.scheduled_end_time) ELSE UNIX_TIMESTAMP(sd.trigger_time) + sd.duration END',
|
||||
'downtime_duration' => 'sd.duration',
|
||||
'downtime_is_in_effect' => 'sd.is_in_effect',
|
||||
'downtime_internal_id' => 'sd.internal_downtime_id',
|
||||
'downtime_host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci', // #7278, #7279
|
||||
'host' => 'CASE WHEN ho.name1 IS NULL THEN so.name1 ELSE ho.name1 END COLLATE latin1_general_ci',
|
||||
'downtime_service' => 'so.name2 COLLATE latin1_general_ci',
|
||||
'service' => 'so.name2 COLLATE latin1_general_ci', // #7278, #7279
|
||||
'downtime_objecttype' => "CASE WHEN ho.object_id IS NOT NULL THEN 'host' ELSE CASE WHEN so.object_id IS NOT NULL THEN 'service' ELSE NULL END END",
|
||||
'downtime_host_state' => 'CASE WHEN hs.has_been_checked = 0 OR hs.has_been_checked IS NULL THEN 99 ELSE hs.current_state END',
|
||||
'downtime_service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END'
|
||||
),
|
||||
'hosts' => array(
|
||||
'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END'
|
||||
),
|
||||
'services' => array(
|
||||
'service_display_name' => 's.display_name'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Join with scheduleddowntime
|
||||
*/
|
||||
protected function joinBaseTables()
|
||||
{
|
||||
$this->select->from(
|
||||
|
@ -70,4 +64,29 @@ class DowntimeQuery extends IdoQuery
|
|||
);
|
||||
$this->joinedVirtualTables = array('downtime' => true);
|
||||
}
|
||||
|
||||
protected function joinHosts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'h.host_object_id = ho.object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinServices()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('s' => $this->prefix . 'services'),
|
||||
's.service_object_id = so.object_id',
|
||||
array()
|
||||
);
|
||||
$this->select->joinLeft(
|
||||
array('sh' => $this->prefix . 'hosts'),
|
||||
'sh.host_object_id = s.host_object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Zend_Db_Select;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
|
||||
class EventHistoryQuery extends IdoQuery
|
||||
{
|
||||
|
@ -13,28 +11,33 @@ class EventHistoryQuery extends IdoQuery
|
|||
|
||||
protected $columnMap = array(
|
||||
'eventhistory' => array(
|
||||
'cnt_notification' => "SUM(CASE eh.type WHEN 'notify' THEN 1 ELSE 0 END)",
|
||||
'cnt_hard_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)",
|
||||
'cnt_soft_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)",
|
||||
'cnt_downtime_start' => "SUM(CASE eh.type WHEN 'dt_start' THEN 1 ELSE 0 END)",
|
||||
'cnt_downtime_end' => "SUM(CASE eh.type WHEN 'dt_end' THEN 1 ELSE 0 END)",
|
||||
'host' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'eho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'eho.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => 'eh.object_type',
|
||||
'timestamp' => 'eh.timestamp',
|
||||
'state' => 'eh.state',
|
||||
'attempt' => 'eh.attempt',
|
||||
'max_attempts' => 'eh.max_attempts',
|
||||
'output' => 'eh.output', // we do not want long_output
|
||||
'type' => 'eh.type',
|
||||
'service_host_name' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'eho.name2 COLLATE latin1_general_ci'
|
||||
'cnt_notification' => "SUM(CASE eh.type WHEN 'notify' THEN 1 ELSE 0 END)",
|
||||
'cnt_hard_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)",
|
||||
'cnt_soft_state' => "SUM(CASE eh.type WHEN 'hard_state' THEN 1 ELSE 0 END)",
|
||||
'cnt_downtime_start' => "SUM(CASE eh.type WHEN 'dt_start' THEN 1 ELSE 0 END)",
|
||||
'cnt_downtime_end' => "SUM(CASE eh.type WHEN 'dt_end' THEN 1 ELSE 0 END)",
|
||||
'host' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'eho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'eho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'eho.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => 'eh.object_type',
|
||||
'timestamp' => 'eh.timestamp',
|
||||
'state' => 'eh.state',
|
||||
'attempt' => 'eh.attempt',
|
||||
'max_attempts' => 'eh.max_attempts',
|
||||
'output' => 'eh.output', // we do not want long_output
|
||||
'type' => 'eh.type',
|
||||
'service_host_name' => 'eho.name1 COLLATE latin1_general_ci'
|
||||
),
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
),
|
||||
'hosts' => array(
|
||||
'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END'
|
||||
),
|
||||
'services' => array(
|
||||
'service_display_name' => 's.display_name'
|
||||
)
|
||||
);
|
||||
|
||||
protected $useSubqueryCount = true;
|
||||
|
@ -84,20 +87,20 @@ class EventHistoryQuery extends IdoQuery
|
|||
|
||||
public function addFilter(Filter $filter)
|
||||
{
|
||||
foreach ($this->subQueries as $sub) {
|
||||
$sub->applyFilter(clone $filter);
|
||||
}
|
||||
return $this;
|
||||
foreach ($this->subQueries as $sub) {
|
||||
$sub->applyFilter(clone $filter);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function where($condition, $value = null)
|
||||
{
|
||||
$this->requireColumn($condition);
|
||||
foreach ($this->subQueries as $sub) {
|
||||
$sub->where($condition, $value);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
public function where($condition, $value = null)
|
||||
{
|
||||
$this->requireColumn($condition);
|
||||
foreach ($this->subQueries as $sub) {
|
||||
$sub->where($condition, $value);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinHostgroups()
|
||||
{
|
||||
|
@ -117,4 +120,28 @@ class EventHistoryQuery extends IdoQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function joinHosts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'h.host_object_id = eho.object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinServices()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('s' => $this->prefix . 'services'),
|
||||
's.service_object_id = eho.object_id',
|
||||
array()
|
||||
);
|
||||
$this->select->joinLeft(
|
||||
array('sh' => $this->prefix . 'hosts'),
|
||||
'sh.host_object_id = s.host_object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,37 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
/**
|
||||
* Notification query
|
||||
*/
|
||||
class NotificationQuery extends IdoQuery
|
||||
{
|
||||
/**
|
||||
* Column map
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $columnMap = array(
|
||||
'notification' => array(
|
||||
'notification_output' => 'n.output',
|
||||
'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)',
|
||||
'notification_state' => 'n.state',
|
||||
'notification_object_id' => 'n.object_id'
|
||||
'notification_output' => 'n.output',
|
||||
'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)',
|
||||
'notification_state' => 'n.state',
|
||||
'notification_object_id' => 'n.object_id'
|
||||
),
|
||||
'objects' => array(
|
||||
'host' => 'o.name1',
|
||||
'service' => 'o.name2'
|
||||
'host' => 'o.name1',
|
||||
'service' => 'o.name2'
|
||||
),
|
||||
'contact' => array(
|
||||
'notification_contact' => 'c_o.name1',
|
||||
'contact_object_id' => 'c_o.object_id'
|
||||
'notification_contact' => 'c_o.name1',
|
||||
'contact_object_id' => 'c_o.object_id'
|
||||
),
|
||||
'command' => array(
|
||||
'notification_command' => 'cmd_o.name1'
|
||||
'notification_command' => 'cmd_o.name1'
|
||||
),
|
||||
'acknowledgement' => array(
|
||||
'acknowledgement_entry_time' => 'UNIX_TIMESTAMP(a.entry_time)',
|
||||
'acknowledgement_author_name' => 'a.author_name',
|
||||
'acknowledgement_comment_data' => 'a.comment_data'
|
||||
),
|
||||
'hosts' => array(
|
||||
'host_display_name' => 'CASE WHEN sh.display_name IS NOT NULL THEN sh.display_name ELSE h.display_name END'
|
||||
),
|
||||
'services' => array(
|
||||
'service_display_name' => 's.display_name'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -110,4 +106,29 @@ class NotificationQuery extends IdoQuery
|
|||
array()
|
||||
);
|
||||
}
|
||||
|
||||
protected function joinHosts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'h.host_object_id = o.object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function joinServices()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
array('s' => $this->prefix . 'services'),
|
||||
's.service_object_id = o.object_id',
|
||||
array()
|
||||
);
|
||||
$this->select->joinLeft(
|
||||
array('sh' => $this->prefix . 'hosts'),
|
||||
'sh.host_object_id = s.host_object_id',
|
||||
array()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||
|
||||
|
@ -8,29 +6,27 @@ class StatehistoryQuery extends IdoQuery
|
|||
{
|
||||
protected $types = array(
|
||||
'soft_state' => 0,
|
||||
'hard_state' => 1,
|
||||
'hard_state' => 1
|
||||
);
|
||||
|
||||
protected $columnMap = array(
|
||||
'statehistory' => array(
|
||||
'raw_timestamp' => 'sh.state_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)',
|
||||
'state_time' => 'sh.state_time',
|
||||
'object_id' => 'sho.object_id',
|
||||
'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)",
|
||||
'state' => 'sh.state',
|
||||
'state_type' => 'sh.state_type',
|
||||
'output' => 'sh.output',
|
||||
'attempt' => 'sh.current_check_attempt',
|
||||
'max_attempts' => 'sh.max_check_attempts',
|
||||
|
||||
'host' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service_description' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN sho.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
'raw_timestamp' => 'sh.state_time',
|
||||
'timestamp' => 'UNIX_TIMESTAMP(sh.state_time)',
|
||||
'state_time' => 'sh.state_time',
|
||||
'object_id' => 'sho.object_id',
|
||||
'type' => "(CASE WHEN sh.state_type = 1 THEN 'hard_state' ELSE 'soft_state' END)",
|
||||
'state' => 'sh.state',
|
||||
'state_type' => 'sh.state_type',
|
||||
'output' => 'sh.output',
|
||||
'attempt' => 'sh.current_check_attempt',
|
||||
'max_attempts' => 'sh.max_check_attempts',
|
||||
'host' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'service' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'service_description' => 'sho.name2 COLLATE latin1_general_ci',
|
||||
'service_host_name' => 'sho.name1 COLLATE latin1_general_ci',
|
||||
'object_type' => "CASE WHEN sho.objecttype_id = 1 THEN 'host' ELSE 'service' END"
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ class Comment extends DataView
|
|||
'comment_service',
|
||||
'host',
|
||||
'service',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -43,13 +45,20 @@ class Comment extends DataView
|
|||
'comment_timestamp' => array(
|
||||
'order' => self::SORT_DESC
|
||||
),
|
||||
'comment_host' => array(
|
||||
'host_display_name' => array(
|
||||
'columns' => array(
|
||||
'comment_host',
|
||||
'comment_service'
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'service_display_name' => array(
|
||||
'columns' => array(
|
||||
'service_display_name',
|
||||
'host_display_name'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ abstract class DataView implements Browsable, Countable, Filterable, Sortable
|
|||
|
||||
public function dump()
|
||||
{
|
||||
$this->order();
|
||||
return $this->query->dump();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ class Downtime extends DataView
|
|||
'downtime_host',
|
||||
'downtime_service',
|
||||
'downtime_host_state',
|
||||
'downtime_service_state'
|
||||
'downtime_service_state',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -40,18 +42,29 @@ class Downtime extends DataView
|
|||
{
|
||||
return array(
|
||||
'downtime_is_in_effect' => array(
|
||||
'columns' => array(
|
||||
'downtime_is_in_effect',
|
||||
'downtime_scheduled_start'
|
||||
),
|
||||
'order' => self::SORT_DESC
|
||||
),
|
||||
'downtime_start' => array(
|
||||
'order' => self::SORT_DESC
|
||||
),
|
||||
'downtime_host' => array(
|
||||
'host_display_name' => array(
|
||||
'columns' => array(
|
||||
'downtime_host',
|
||||
'downtime_service'
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'service_display_name' => array(
|
||||
'columns' => array(
|
||||
'service_display_name',
|
||||
'host_display_name'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\DataView;
|
||||
|
||||
|
@ -20,7 +18,9 @@ class EventHistory extends DataView
|
|||
'cnt_downtime_start',
|
||||
'cnt_downtime_end',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'object_type',
|
||||
'timestamp',
|
||||
'state',
|
||||
|
@ -38,8 +38,8 @@ class EventHistory extends DataView
|
|||
{
|
||||
return array(
|
||||
'timestamp' => array(
|
||||
'columns' => array('timestamp'),
|
||||
'order' => 'DESC'
|
||||
'columns' => array('timestamp'),
|
||||
'order' => 'DESC'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ class HostStatus extends DataView
|
|||
return array(
|
||||
'host',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_state',
|
||||
|
@ -90,7 +91,7 @@ class HostStatus extends DataView
|
|||
public function getSortRules()
|
||||
{
|
||||
return array(
|
||||
'host_name' => array(
|
||||
'host_display_name' => array(
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'host_address' => array(
|
||||
|
|
|
@ -20,7 +20,9 @@ class Notification extends DataView
|
|||
'notification_start_time',
|
||||
'notification_contact',
|
||||
'notification_output',
|
||||
'notification_command'
|
||||
'notification_command',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class ServiceStatus extends DataView
|
|||
{
|
||||
return array(
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_state',
|
||||
'host_state_type',
|
||||
'host_last_state_change',
|
||||
|
@ -123,22 +124,12 @@ class ServiceStatus extends DataView
|
|||
public function getSortRules()
|
||||
{
|
||||
return array(
|
||||
'host_name' => array(
|
||||
'service_severity' => array(
|
||||
'columns' => array(
|
||||
'service_host_name',
|
||||
'service_description'
|
||||
'service_severity',
|
||||
'service_last_state_change'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'host_address' => array(
|
||||
'columns' => array(
|
||||
'host_ipv4',
|
||||
'service_description'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'host_last_state_change' => array(
|
||||
'order' => self::SORT_ASC
|
||||
'order' => self::SORT_DESC
|
||||
),
|
||||
'host_severity' => array(
|
||||
'columns' => array(
|
||||
|
@ -147,12 +138,19 @@ class ServiceStatus extends DataView
|
|||
),
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'service_severity' => array(
|
||||
'host_display_name' => array(
|
||||
'columns' => array(
|
||||
'service_severity',
|
||||
'service_last_state_change',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
),
|
||||
'order' => self::SORT_DESC
|
||||
'order' => self::SORT_ASC
|
||||
),
|
||||
'host_address' => array(
|
||||
'columns' => array(
|
||||
'host_ipv4',
|
||||
'service_display_name'
|
||||
),
|
||||
'order' => self::SORT_ASC
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class Host extends MonitoredObject
|
|||
public $prefix = 'host_';
|
||||
|
||||
/**
|
||||
* Host name
|
||||
* Hostname
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -63,8 +63,8 @@ class Host extends MonitoredObject
|
|||
/**
|
||||
* Create a new host
|
||||
*
|
||||
* @param MonitoringBackend $backend Backend to fetch host information from
|
||||
* @param string $host Host name
|
||||
* @param MonitoringBackend $backend Backend to fetch host information from
|
||||
* @param string $host Hostname
|
||||
*/
|
||||
public function __construct(MonitoringBackend $backend, $host)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ class Host extends MonitoredObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the host name
|
||||
* Get the hostname
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -91,6 +91,7 @@ class Host extends MonitoredObject
|
|||
{
|
||||
$columns = array(
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_state',
|
||||
|
|
|
@ -408,7 +408,9 @@ abstract class MonitoredObject
|
|||
$eventHistory = $this->backend->select()->from('eventHistory', array(
|
||||
'object_type',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'timestamp',
|
||||
'state',
|
||||
'attempt',
|
||||
|
|
|
@ -68,9 +68,9 @@ class Service extends MonitoredObject
|
|||
/**
|
||||
* Create a new service
|
||||
*
|
||||
* @param MonitoringBackend $backend Backend to fetch service information from
|
||||
* @param string $host Host name the service is running on
|
||||
* @param string $service Service name
|
||||
* @param MonitoringBackend $backend Backend to fetch service information from
|
||||
* @param string $host Hostname the service is running on
|
||||
* @param string $service Service name
|
||||
*/
|
||||
public function __construct(MonitoringBackend $backend, $host, $service)
|
||||
{
|
||||
|
@ -108,6 +108,7 @@ class Service extends MonitoredObject
|
|||
{
|
||||
return $this->backend->select()->from('serviceStatus', array(
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'host_state',
|
||||
'host_state_type',
|
||||
'host_last_state_change',
|
||||
|
|
Loading…
Reference in New Issue