commit
26402f1c0a
|
@ -10,4 +10,5 @@ _1 = 1
|
||||||
Hosts = "/monitoring/list/hosts"
|
Hosts = "/monitoring/list/hosts"
|
||||||
Services = "/monitoring/list/services"
|
Services = "/monitoring/list/services"
|
||||||
Downtimes = "/monitoring/list/downtimes"
|
Downtimes = "/monitoring/list/downtimes"
|
||||||
|
Notifications = "/monitoring/list/notifications"
|
||||||
Summaries = "/monitoring/summary/group/by/hostgroup"
|
Summaries = "/monitoring/summary/group/by/hostgroup"
|
||||||
|
|
|
@ -215,13 +215,30 @@ class Monitoring_ListController extends ModuleActionController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a query for the given view
|
* Display notification overview
|
||||||
*
|
|
||||||
* @param string $view An string identifying view to query
|
|
||||||
* @param array $columns An array with the column names to display
|
|
||||||
*
|
|
||||||
* @return \Icinga\Data\Db\Query
|
|
||||||
*/
|
*/
|
||||||
|
public function notificationsAction()
|
||||||
|
{
|
||||||
|
$this->view->notifications = $this->query(
|
||||||
|
'notification',
|
||||||
|
array(
|
||||||
|
'host_name',
|
||||||
|
'service_description',
|
||||||
|
'notification_type',
|
||||||
|
'notification_reason',
|
||||||
|
'notification_start_time',
|
||||||
|
'notification_contact',
|
||||||
|
'notification_information',
|
||||||
|
'notification_command'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (!$this->_getParam('sort')) {
|
||||||
|
$this->view->notifications->order('notification_start_time DESC');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->inheritCurrentSortColumn();
|
||||||
|
}
|
||||||
|
|
||||||
protected function query($view, $columns)
|
protected function query($view, $columns)
|
||||||
{
|
{
|
||||||
$extra = preg_split(
|
$extra = preg_split(
|
||||||
|
@ -299,8 +316,11 @@ class Monitoring_ListController extends ModuleActionController
|
||||||
'icon' => 'img/classic/downtime.gif',
|
'icon' => 'img/classic/downtime.gif',
|
||||||
'url' => 'monitoring/list/downtimes',
|
'url' => 'monitoring/list/downtimes',
|
||||||
));
|
));
|
||||||
|
$tabs->add('notifications', array(
|
||||||
|
'title' => 'Notifications',
|
||||||
|
'icon' => 'img/classic/alarm-clock.png',
|
||||||
|
'url' => 'monitoring/list/notifications'
|
||||||
|
));
|
||||||
/*
|
/*
|
||||||
$tabs->add('hostgroups', array(
|
$tabs->add('hostgroups', array(
|
||||||
'title' => 'Hostgroups',
|
'title' => 'Hostgroups',
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Zend_View_Helper_MonitoringProperties
|
* Class Zend_View_Helper_MonitoringProperties
|
||||||
*/
|
*/
|
||||||
|
@ -57,12 +59,25 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
'status_update_time' => 'Last update'
|
'status_update_time' => 'Last update'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static $notificationReasons = array(
|
||||||
|
0 => 'NORMAL',
|
||||||
|
1 => 'ACKNOWLEDGEMENT',
|
||||||
|
2 => 'FLAPPING START',
|
||||||
|
3 => 'FLAPPING STOP',
|
||||||
|
4 => 'FLAPPING DISABLED',
|
||||||
|
5 => 'DOWNTIME START',
|
||||||
|
6 => 'DOWNTIME END',
|
||||||
|
7 => 'DOWNTIME CANCELLED',
|
||||||
|
8 => 'CUSTOM',
|
||||||
|
9 => 'STALKING'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the object type
|
* Return the object type
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function getObjectType(\stdClass $object)
|
private function getObjectType(stdClass $object)
|
||||||
{
|
{
|
||||||
$keys = array_keys(get_object_vars($object));
|
$keys = array_keys(get_object_vars($object));
|
||||||
$keyParts = explode('_', array_shift($keys), 2);
|
$keyParts = explode('_', array_shift($keys), 2);
|
||||||
|
@ -75,7 +90,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param $type
|
* @param $type
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
private function dropObjectType(\stdClass $object, $type)
|
private function dropObjectType(stdClass $object, $type)
|
||||||
{
|
{
|
||||||
$vars = get_object_vars($object);
|
$vars = get_object_vars($object);
|
||||||
$out = array();
|
$out = array();
|
||||||
|
@ -91,7 +106,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildAttempt(\stdClass $object)
|
private function buildAttempt(stdClass $object)
|
||||||
{
|
{
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'%s/%s (%s state)',
|
'%s/%s (%s state)',
|
||||||
|
@ -116,7 +131,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildCheckType(\stdClass $object)
|
private function buildCheckType(stdClass $object)
|
||||||
{
|
{
|
||||||
if ($object->passive_checks_enabled === '1' && $object->active_checks_enabled === '0') {
|
if ($object->passive_checks_enabled === '1' && $object->active_checks_enabled === '0') {
|
||||||
return self::CHECK_PASSIVE;
|
return self::CHECK_PASSIVE;
|
||||||
|
@ -132,7 +147,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildLatency(\stdClass $object)
|
private function buildLatency(stdClass $object)
|
||||||
{
|
{
|
||||||
$val = '';
|
$val = '';
|
||||||
if ($this->buildCheckType($object) === self::CHECK_PASSIVE) {
|
if ($this->buildCheckType($object) === self::CHECK_PASSIVE) {
|
||||||
|
@ -144,8 +159,8 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$val .= ' / '. $this->floatFormatter(
|
$val .= ' / '. $this->floatFormatter(
|
||||||
isset($object->check_execution_time) ? $object->check_execution_time : 0
|
isset($object->check_execution_time) ? $object->check_execution_time : 0
|
||||||
). ' seconds';
|
). ' seconds';
|
||||||
|
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +170,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildNextCheck(\stdClass $object)
|
private function buildNextCheck(stdClass $object)
|
||||||
{
|
{
|
||||||
if ($this->buildCheckType($object) === self::CHECK_PASSIVE) {
|
if ($this->buildCheckType($object) === self::CHECK_PASSIVE) {
|
||||||
return self::VALUE_NA;
|
return self::VALUE_NA;
|
||||||
|
@ -169,7 +184,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildLastStateChange(\stdClass $object)
|
private function buildLastStateChange(stdClass $object)
|
||||||
{
|
{
|
||||||
return strftime('%Y-%m-%d %H:%M:%S', $object->last_state_change);
|
return strftime('%Y-%m-%d %H:%M:%S', $object->last_state_change);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +194,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildLastNotification(\stdClass $object)
|
private function buildLastNotification(stdClass $object)
|
||||||
{
|
{
|
||||||
$val = '';
|
$val = '';
|
||||||
|
|
||||||
|
@ -199,7 +214,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildFlapping(\stdClass $object)
|
private function buildFlapping(stdClass $object)
|
||||||
{
|
{
|
||||||
$val = '';
|
$val = '';
|
||||||
|
|
||||||
|
@ -219,7 +234,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function buildScheduledDowntime(\stdClass $object)
|
private function buildScheduledDowntime(stdClass $object)
|
||||||
{
|
{
|
||||||
if ($object->in_downtime === '1') {
|
if ($object->in_downtime === '1') {
|
||||||
return self::VALUE_YES;
|
return self::VALUE_YES;
|
||||||
|
@ -234,7 +249,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
* @param stdClass $object
|
* @param stdClass $object
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function monitoringProperties(\stdClass $object)
|
public function monitoringProperties(stdClass $object)
|
||||||
{
|
{
|
||||||
$type = $this->getObjectType($object);
|
$type = $this->getObjectType($object);
|
||||||
$object = $this->dropObjectType($object, $type);
|
$object = $this->dropObjectType($object, $type);
|
||||||
|
@ -252,4 +267,22 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNotificationType(stdClass $notification)
|
||||||
|
{
|
||||||
|
$reason = intval($notification->notification_reason);
|
||||||
|
if (!isset(self::$notificationReasons[$reason])) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
$type = self::$notificationReasons[$reason];
|
||||||
|
if ($reason === 8) {
|
||||||
|
if (intval($notification->notification_type) === 0) {
|
||||||
|
$type .= '(UP)';
|
||||||
|
} else {
|
||||||
|
$type .= '(OK)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreStop
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?= $this->tabs->render($this); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
|
$formatter = $this->getHelper('MonitoringProperties');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form method="get" action="<?=
|
||||||
|
Url::fromPath(
|
||||||
|
'monitoring/list/notifications',
|
||||||
|
$this->notifications->getAppliedFilter()->toParams()
|
||||||
|
)->getAbsoluteUrl();
|
||||||
|
?>">
|
||||||
|
Sort by <?= $this->formSelect(
|
||||||
|
'sort',
|
||||||
|
$this->sort,
|
||||||
|
array(
|
||||||
|
'class' => 'autosubmit'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'notification_start_time' => 'Time'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<input type="search" name="filter" placeholder="Type to filter" />
|
||||||
|
<button class="btn btn-small"><i class="icon-refresh"></i></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$notifications = $this->notifications->paginate();
|
||||||
|
echo $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table class="statustable action table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Host</th>
|
||||||
|
<th>Service</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Contact</th>
|
||||||
|
<th>Notification command</th>
|
||||||
|
<th>Information</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($notifications as $notification): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?= $notification->host_name ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= empty($notification->service_description) ? '' : $notification->service_description; ?>
|
||||||
|
</td>
|
||||||
|
<td><?= $formatter->getNotificationType($notification); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $notification->notification_start_time ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $notification->notification_contact ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $notification->notification_command ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $this->escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if (intval($notification->notification_type) === 0): ?>
|
||||||
|
<a href="<?=
|
||||||
|
Url::fromPath(
|
||||||
|
'monitoring/show/host',
|
||||||
|
array('host' => $notification->host_name)
|
||||||
|
)->getAbsoluteUrl();
|
||||||
|
?>" class="row-action"> </a>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="<?=
|
||||||
|
Url::fromPath('monitoring/show/service',
|
||||||
|
array(
|
||||||
|
'host' => $notification->host_name,
|
||||||
|
'service' => $notification->service_description
|
||||||
|
)
|
||||||
|
)->getAbsoluteUrl(); ?>" class="row-action"></a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -0,0 +1,133 @@
|
||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring frontends
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Monitoring\Backend\Ido\Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification query
|
||||||
|
*/
|
||||||
|
class NotificationQuery extends AbstractQuery
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Column map
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $columnMap = array(
|
||||||
|
'notification' => array(
|
||||||
|
'notification_type' => 'n.notification_type',
|
||||||
|
'notification_reason' => 'n.notification_reason',
|
||||||
|
'notification_start_time' => 'n.start_time',
|
||||||
|
'notification_information' => 'n.output'
|
||||||
|
),
|
||||||
|
'objects' => array(
|
||||||
|
'host_name' => 'o.name1',
|
||||||
|
'service_description' => 'o.name2'
|
||||||
|
),
|
||||||
|
'contact' => array(
|
||||||
|
'notification_contact' => 'c_o.name1'
|
||||||
|
),
|
||||||
|
'command' => array(
|
||||||
|
'notification_command' => 'cmd_o.name1'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch basic information about notifications
|
||||||
|
*/
|
||||||
|
protected function joinBaseTables()
|
||||||
|
{
|
||||||
|
$this->baseQuery = $this->db->select()->from(
|
||||||
|
array(
|
||||||
|
'n' => $this->prefix . 'notifications'
|
||||||
|
),
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
$this->joinedVirtualTables = array('notification' => true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch description of each affected host/service
|
||||||
|
*/
|
||||||
|
protected function joinObjects()
|
||||||
|
{
|
||||||
|
$this->baseQuery->join(
|
||||||
|
array(
|
||||||
|
'o' => $this->prefix . 'objects'
|
||||||
|
),
|
||||||
|
'n.object_id = o.object_id AND o.is_active = 1 AND o.objecttype_id IN (1, 2)',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch name of involved contacts and/or contact groups
|
||||||
|
*/
|
||||||
|
protected function joinContact()
|
||||||
|
{
|
||||||
|
$this->baseQuery->join(
|
||||||
|
array(
|
||||||
|
'c' => $this->prefix . 'contactnotifications'
|
||||||
|
),
|
||||||
|
'n.notification_id = c.notification_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
$this->baseQuery->join(
|
||||||
|
array(
|
||||||
|
'c_o' => $this->prefix . 'objects'
|
||||||
|
),
|
||||||
|
'c.contact_object_id = c_o.object_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch name of the command which was used to send out a notification
|
||||||
|
*/
|
||||||
|
protected function joinCommand()
|
||||||
|
{
|
||||||
|
$this->baseQuery->join(
|
||||||
|
array(
|
||||||
|
'cmd_c' => $this->prefix . 'contactnotifications'
|
||||||
|
),
|
||||||
|
'n.notification_id = cmd_c.notification_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
$this->baseQuery->join(
|
||||||
|
array(
|
||||||
|
'cmd_m' => $this->prefix . 'contactnotificationmethods'
|
||||||
|
),
|
||||||
|
'cmd_c.notification_id = cmd_m.contactnotification_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
$this->baseQuery->join(
|
||||||
|
array(
|
||||||
|
'cmd_o' => $this->prefix . 'objects'
|
||||||
|
),
|
||||||
|
'cmd_m.command_object_id = cmd_o.object_id',
|
||||||
|
array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Monitoring\Backend\Ido\Query;
|
namespace Monitoring\Backend\Ido\Query;
|
||||||
|
|
||||||
|
@ -32,7 +35,7 @@ class StatusQuery extends AbstractQuery
|
||||||
'host_check_command' => 'hs.check_command',
|
'host_check_command' => 'hs.check_command',
|
||||||
'host_current_check_attempt' => 'hs.current_check_attempt',
|
'host_current_check_attempt' => 'hs.current_check_attempt',
|
||||||
'host_max_check_attempts' => 'hs.max_check_attempts',
|
'host_max_check_attempts' => 'hs.max_check_attempts',
|
||||||
'host_attempt' => 'CONCAT(hs.current_check_attempt, \'/\', hs.max_check_attempts)',
|
'host_attempt' => 'hs.current_check_attempt || \'/\' || hs.max_check_attempts',
|
||||||
'host_last_check' => 'hs.last_check',
|
'host_last_check' => 'hs.last_check',
|
||||||
'host_next_check' => 'hs.next_check',
|
'host_next_check' => 'hs.next_check',
|
||||||
'host_check_type' => 'hs.check_type',
|
'host_check_type' => 'hs.check_type',
|
||||||
|
@ -135,7 +138,7 @@ class StatusQuery extends AbstractQuery
|
||||||
'service_last_time_unknown' => 'ss.last_time_unknown',
|
'service_last_time_unknown' => 'ss.last_time_unknown',
|
||||||
'service_current_check_attempt' => 'ss.current_check_attempt',
|
'service_current_check_attempt' => 'ss.current_check_attempt',
|
||||||
'service_max_check_attempts' => 'ss.max_check_attempts',
|
'service_max_check_attempts' => 'ss.max_check_attempts',
|
||||||
'service_attempt' => 'CONCAT(ss.current_check_attempt, \'/\', ss.max_check_attempts)',
|
'service_attempt' => 'ss.current_check_attempt || \'/\' || ss.max_check_attempts',
|
||||||
'service_last_check' => 'ss.last_check',
|
'service_last_check' => 'ss.last_check',
|
||||||
'service_next_check' => 'ss.next_check',
|
'service_next_check' => 'ss.next_check',
|
||||||
'service_check_type' => 'ss.check_type',
|
'service_check_type' => 'ss.check_type',
|
||||||
|
@ -238,13 +241,13 @@ class StatusQuery extends AbstractQuery
|
||||||
array('ho' => $this->prefix . 'objects'),
|
array('ho' => $this->prefix . 'objects'),
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('hs' => $this->prefix . 'hoststatus'),
|
array('hs' => $this->prefix . 'hoststatus'),
|
||||||
'ho.object_id = hs.host_object_id AND ho.is_active = 1 AND ho.objecttype_id = 1',
|
'ho.object_id = hs.host_object_id AND ho.is_active = 1 AND ho.objecttype_id = 1',
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('h' => $this->prefix . 'hosts'),
|
array('h' => $this->prefix . 'hosts'),
|
||||||
'hs.host_object_id = h.host_object_id',
|
'hs.host_object_id = h.host_object_id',
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
$this->joinedVirtualTables = array(
|
$this->joinedVirtualTables = array(
|
||||||
'hosts' => true,
|
'hosts' => true,
|
||||||
|
@ -269,14 +272,14 @@ class StatusQuery extends AbstractQuery
|
||||||
's.host_object_id = h.host_object_id',
|
's.host_object_id = h.host_object_id',
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('so' => $this->prefix . 'objects'),
|
array('so' => $this->prefix . 'objects'),
|
||||||
'so.'.$this->object_id.' = s.service_object_id AND so.is_active = 1',
|
'so.'.$this->object_id.' = s.service_object_id AND so.is_active = 1',
|
||||||
array()
|
array()
|
||||||
)->joinLeft(
|
)->joinLeft(
|
||||||
array('ss' => $this->prefix . 'servicestatus'),
|
array('ss' => $this->prefix . 'servicestatus'),
|
||||||
'so.'.$this->object_id.' = ss.service_object_id',
|
'so.'.$this->object_id.' = ss.service_object_id',
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Test this one, doesn't seem to work right now
|
// TODO: Test this one, doesn't seem to work right now
|
||||||
|
@ -296,10 +299,10 @@ class StatusQuery extends AbstractQuery
|
||||||
'hgm.host_object_id = h.host_object_id',
|
'hgm.host_object_id = h.host_object_id',
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('hg' => $this->prefix . 'hostgroups'),
|
array('hg' => $this->prefix . 'hostgroups'),
|
||||||
'hgm.hostgroup_id = hg'.$this->hostgroup_id,
|
'hgm.hostgroup_id = hg'.$this->hostgroup_id,
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -311,15 +314,15 @@ class StatusQuery extends AbstractQuery
|
||||||
'hgm.host_object_id = s.host_object_id',
|
'hgm.host_object_id = s.host_object_id',
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('hg' => $this->prefix . 'hostgroups'),
|
array('hg' => $this->prefix . 'hostgroups'),
|
||||||
'hgm.hostgroup_id = hg.' . $this->hostgroup_id,
|
'hgm.hostgroup_id = hg.' . $this->hostgroup_id,
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('hgo' => $this->prefix . 'objects'),
|
array('hgo' => $this->prefix . 'objects'),
|
||||||
'hgo.' . $this->object_id . ' = hg.hostgroup_object_id'
|
'hgo.' . $this->object_id . ' = hg.hostgroup_object_id'
|
||||||
. ' AND hgo.is_active = 1',
|
. ' AND hgo.is_active = 1',
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -332,16 +335,15 @@ class StatusQuery extends AbstractQuery
|
||||||
'sgm.service_object_id = s.service_object_id',
|
'sgm.service_object_id = s.service_object_id',
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
|
array('sg' => $this->prefix . 'servicegroups'),
|
||||||
array('sg' => $this->prefix . 'servicegroups'),
|
'sgm.servicegroup_id = sg.' . $this->servicegroup_id,
|
||||||
'sgm.servicegroup_id = sg.' . $this->servicegroup_id,
|
array()
|
||||||
array()
|
)->join(
|
||||||
)->join(
|
array('sgo' => $this->prefix . 'objects'),
|
||||||
array('sgo' => $this->prefix . 'objects'),
|
'sgo.' . $this->object_id. ' = sg.servicegroup_object_id'
|
||||||
'sgo.' . $this->object_id. ' = sg.servicegroup_object_id'
|
. ' AND sgo.is_active = 1',
|
||||||
. ' AND sgo.is_active = 1',
|
array()
|
||||||
array()
|
);
|
||||||
);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -385,3 +387,4 @@ class StatusQuery extends AbstractQuery
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// @codingStandardsIgnoreStop
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring frontends
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Monitoring\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NotificationView
|
||||||
|
*/
|
||||||
|
class NotificationView extends MonitoringView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Available columns provided by this view
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $availableColumns = array(
|
||||||
|
'host_name',
|
||||||
|
'service_description',
|
||||||
|
'notification_type',
|
||||||
|
'notification_reason',
|
||||||
|
'notification_start_time',
|
||||||
|
'notification_contact',
|
||||||
|
'notification_information',
|
||||||
|
'notification_command'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default sorting rules
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $sortDefaults = array(
|
||||||
|
'notification_start_time' => array(
|
||||||
|
'default_dir' => self::SORT_DESC
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue