Merge branch 'feature/service-detail-view-4181' of ssh://git.icinga.org/icinga2-web
Conflicts: library/Icinga/Application/Logger.php library/Icinga/Application/Web.php library/Icinga/Authentication/Backend/LdapUserBackend.php library/Icinga/Authentication/Credentials.php library/Icinga/Authentication/Manager.php library/Icinga/Authentication/PhpSession.php library/Icinga/Authentication/Session.php library/Icinga/Authentication/User.php library/Icinga/Authentication/UserBackend.php library/Icinga/Backend/AbstractBackend.php library/Icinga/Backend/DataView/ObjectRemappingView.php library/Icinga/Backend/Query.php library/Icinga/Backend/Statusdat/DataView/StatusdatHostView.php library/Icinga/Backend/Statusdat/HostgroupsummaryQuery.php library/Icinga/Backend/Statusdat/HostlistQuery.php library/Icinga/Backend/Statusdat/ServicegroupsummaryQuery.php library/Icinga/Backend/Statusdat/ServicelistQuery.php library/Icinga/Exception/ConfigurationError.php library/Icinga/Exception/MissingParameterException.php library/Icinga/Exception/NotImplementedError.php library/Icinga/Exception/ProgrammingError.php library/Icinga/Exception/SystemPermissionException.php library/Icinga/Protocol/AbstractQuery.php library/Icinga/Protocol/Commandpipe/Acknowledgement.php library/Icinga/Protocol/Commandpipe/CommandPipe.php library/Icinga/Protocol/Commandpipe/Comment.php library/Icinga/Protocol/Commandpipe/Downtime.php library/Icinga/Protocol/Commandpipe/Exception/InvalidCommandException.php library/Icinga/Protocol/Commandpipe/IComment.php library/Icinga/Protocol/Commandpipe/PropertyModifier.php library/Icinga/Protocol/Ldap/Connection.php library/Icinga/Protocol/Ldap/Exception.php library/Icinga/Protocol/Ldap/LdapUtils.php library/Icinga/Protocol/Ldap/Node.php library/Icinga/Protocol/Ldap/Query.php library/Icinga/Protocol/Ldap/Root.php library/Icinga/Protocol/Statusdat/Exception/ParsingException.php library/Icinga/Protocol/Statusdat/IReader.php library/Icinga/Protocol/Statusdat/ObjectContainer.php library/Icinga/Protocol/Statusdat/Parser.php library/Icinga/Protocol/Statusdat/Query.php library/Icinga/Protocol/Statusdat/Query/Expression.php library/Icinga/Protocol/Statusdat/Query/Group.php library/Icinga/Protocol/Statusdat/Query/IQueryPart.php library/Icinga/Protocol/Statusdat/Reader.php library/Icinga/Protocol/Statusdat/RuntimeStateContainer.php library/Icinga/Protocol/Statusdat/View/AccessorStrategy.php library/Icinga/Web/ActionController.php library/Icinga/Web/Form.php library/Icinga/Web/Hook/Configuration/ConfigurationTab.php library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php library/Icinga/Web/Hook/Grapher.php library/Icinga/Web/Hook/Toptray.php library/Icinga/Web/ModuleActionController.php library/Icinga/Web/Notification.php library/Icinga/Web/Paginator/Adapter/QueryAdapter.php library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php library/Icinga/Web/Widget.php modules/monitoring/application/views/helpers/MonitoringCommands.php modules/monitoring/application/views/helpers/MonitoringFlags.php modules/monitoring/application/views/helpers/MonitoringProperties.php modules/monitoring/application/views/scripts/show/components/comments.phtml modules/monitoring/application/views/scripts/show/components/downtime.phtml modules/monitoring/application/views/scripts/show/components/flags.phtml modules/monitoring/application/views/scripts/show/components/properties.phtml modules/monitoring/application/views/scripts/show/header.phtml modules/monitoring/application/views/scripts/show/host.phtml modules/monitoring/application/views/scripts/show/service.phtml modules/monitoring/library/Monitoring/Backend/AbstractBackend.php modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeQuery.php modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php modules/monitoring/library/Monitoring/Backend/Statusdat.php modules/monitoring/library/Monitoring/Backend/Statusdat/Criteria/Order.php modules/monitoring/library/Monitoring/Backend/Statusdat/DataView/StatusdatServiceView.php modules/monitoring/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php modules/monitoring/library/Monitoring/Backend/Statusdat/Query/Query.php modules/monitoring/library/Monitoring/Command/Meta.php modules/monitoring/library/Monitoring/View/DowntimeView.php modules/monitoring/test/php/application/views/helpers/MonitoringCommandsTest.php modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php modules/monitoring/test/php/library/Command/MetaTest.php
This commit is contained in:
commit
e8204f4755
|
@ -72,7 +72,7 @@ class LdapUserBackend implements UserBackend
|
|||
|
||||
/**
|
||||
* Removes the '*' characted from $string
|
||||
*
|
||||
*
|
||||
* @param String $string
|
||||
*
|
||||
* @return String
|
||||
|
@ -84,12 +84,12 @@ class LdapUserBackend implements UserBackend
|
|||
|
||||
/**
|
||||
* Tries to fetch the username given in $username from
|
||||
* the ldap connection, using the configuration parameters
|
||||
* the ldap connection, using the configuration parameters
|
||||
* given in the Authentication configuration
|
||||
*
|
||||
* @param String $username The username to select
|
||||
*
|
||||
* @return object $result
|
||||
* @return object $result
|
||||
**/
|
||||
protected function selectUsername($username)
|
||||
{
|
||||
|
|
|
@ -217,9 +217,9 @@ class Manager
|
|||
{
|
||||
$this->session->set("user", $this->user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tries to authenticate the user with the current session
|
||||
* Tries to authenticate the user with the current session
|
||||
**/
|
||||
public function authenticateFromSession()
|
||||
{
|
||||
|
@ -228,10 +228,10 @@ class Manager
|
|||
|
||||
/**
|
||||
* Returns true when the user is currently authenticated
|
||||
*
|
||||
*
|
||||
* @param Boolean $ignoreSession Set to true to prevent authentication by session
|
||||
*
|
||||
* @param Boolean
|
||||
* @param Boolean
|
||||
**/
|
||||
public function isAuthenticated($ignoreSession = false)
|
||||
{
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* 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>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* 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>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?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}}}
|
||||
|
||||
/**
|
||||
* Module action controller
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?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 Icinga\Web;
|
||||
|
||||
|
|
|
@ -1,8 +1,28 @@
|
|||
<?php
|
||||
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* Web widget class
|
||||
* 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 Icinga\Web;
|
||||
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
|
|
|
@ -44,7 +44,7 @@ class Monitoring_ShowController extends ModuleActionController
|
|||
|
||||
$this->backend = Backend::getInstance($this->_getParam('backend'));
|
||||
if ($service !== null && $service !== '*') {
|
||||
$this->view->service = $this->backend->fetchService($host, $service);
|
||||
$this->view->service = $this->backend->fetchService($host, $service, true);
|
||||
}
|
||||
if ($host !== null) {
|
||||
$this->view->host = $this->backend->fetchHost($host, true);
|
||||
|
@ -71,17 +71,30 @@ class Monitoring_ShowController extends ModuleActionController
|
|||
|
||||
if ($grapher = Hook::get('grapher')) {
|
||||
if ($grapher->hasGraph(
|
||||
$this->view->host->host_name,
|
||||
$this->view->service->host_name,
|
||||
$this->view->service->service_description
|
||||
)
|
||||
) {
|
||||
$this->view->preview_image = $grapher->getPreviewImage(
|
||||
$this->view->host->host_name,
|
||||
$this->view->service->host_name,
|
||||
$this->view->service->service_description
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->servicegroups = $this->backend->select()
|
||||
->from(
|
||||
'servicegroup',
|
||||
array(
|
||||
'servicegroup_name',
|
||||
'servicegroup_alias'
|
||||
)
|
||||
)
|
||||
->where('host_name', $this->view->host->host_name)
|
||||
->where('service_description', $this->view->service->service_description)
|
||||
|
||||
->fetchPairs();
|
||||
|
||||
$this->view->contacts = $this->backend->select()
|
||||
->from(
|
||||
'contact',
|
||||
|
@ -387,15 +400,17 @@ class Monitoring_ShowController extends ModuleActionController
|
|||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
$tabs->add(
|
||||
'services',
|
||||
array(
|
||||
'title' => 'Services',
|
||||
'icon' => 'img/classic/service.png',
|
||||
'url' => 'monitoring/show/services',
|
||||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
if (!isset($this->view->service)) {
|
||||
$tabs->add(
|
||||
'services',
|
||||
array(
|
||||
'title' => 'Services',
|
||||
'icon' => 'img/classic/service.png',
|
||||
'url' => 'monitoring/show/services',
|
||||
'urlParams' => $params,
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isset($params['service'])) {
|
||||
$tabs->add(
|
||||
'service',
|
||||
|
|
|
@ -2,6 +2,29 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{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}}}
|
||||
|
||||
/**
|
||||
* Class Zend_View_Helper_MonitoringFlags
|
||||
*
|
||||
|
|
|
@ -139,13 +139,13 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
|||
$val .= self::VALUE_NA;
|
||||
} else {
|
||||
$val .= $this->floatFormatter(
|
||||
(isset($object->latency)) ? $object->latency : 0
|
||||
(isset($object->check_latency)) ? $object->check_latency : 0
|
||||
);
|
||||
}
|
||||
|
||||
$val .= ' / '. $this->floatFormatter(
|
||||
isset($object->execution_time) ? $object->execution_time : 0
|
||||
). ' seconds';
|
||||
isset($object->check_execution_time) ? $object->check_execution_time : 0
|
||||
). ' seconds';
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
|
|||
{
|
||||
public function perfdata($perfdata, $compact = false, $float = 'right')
|
||||
{
|
||||
|
||||
if (empty($perfdata)) {
|
||||
return '';
|
||||
}
|
||||
|
@ -75,9 +76,15 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
|
|||
. '</td></tr>';
|
||||
}
|
||||
}
|
||||
if ($result == '') {
|
||||
$result = $perfdata;
|
||||
}
|
||||
if (! $compact && $result !== '') {
|
||||
$result = '<table style="width: 100%">' . $result . '</table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>' . $this->translate('Check execution time') . '</td>
|
||||
<td>' . $object->check_execution_time . '</td>
|
||||
<td>' . $object->execution_time . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>' . $this->translate('Check latency') . '</td>
|
||||
<td>' . $object->check_latency . '</td>
|
||||
<td>' . $object->latency . '</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<?php
|
||||
|
||||
if (empty($object->comments)) return;
|
||||
|
||||
<?php if (! empty($this->comments)): ?>
|
||||
<?
|
||||
$list = array();
|
||||
foreach ($object->comments as $comment) {
|
||||
if ($ticket_pattern) {
|
||||
foreach ($this->comments as $comment) {
|
||||
if ($this->ticket_pattern) {
|
||||
$text = preg_replace(
|
||||
$ticket_pattern,
|
||||
$ticket_link,
|
||||
$this->ticket_pattern,
|
||||
$this->ticket_link,
|
||||
$this->escape($comment->comment_data)
|
||||
);
|
||||
} else {
|
||||
|
@ -30,3 +29,4 @@ foreach ($object->comments as $comment) {
|
|||
<blockquote> <?= implode('<br />', $list) ?></blockquote>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
|
@ -1,4 +1,4 @@
|
|||
<?php if (!empty($this->downtimes)) { ?>
|
||||
<?php if (!empty($this->downtimes)): ?>
|
||||
<?php
|
||||
$list = array();
|
||||
foreach ($this->downtimes as $downtime) {
|
||||
|
@ -40,4 +40,4 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
|
@ -10,16 +10,16 @@
|
|||
$flags = $this->monitoringFlags($object);
|
||||
?>
|
||||
<table class="flag-container">
|
||||
<?php foreach ($flags as $name => $value) { ?>
|
||||
<?php foreach ($flags as $name => $value): ?>
|
||||
<tr>
|
||||
<th><?= $name; ?></th>
|
||||
<td>
|
||||
<?php if ($value === true) { ?>
|
||||
<?php if ($value === true): ?>
|
||||
<span class="flag flag-enabled">ENABLED</span>
|
||||
<?php } else { ?>
|
||||
<?php else: ?>
|
||||
<span class="flag flag-disabled">DISABLED</span>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
|
@ -10,10 +10,10 @@ if (isset($this->service)) {
|
|||
$properties = $this->monitoringProperties($object);
|
||||
?>
|
||||
<table>
|
||||
<?php foreach ($properties as $label => $value) { ?>
|
||||
<?php foreach ($properties as $label => $value): ?>
|
||||
<tr>
|
||||
<th><?= $label ?></th>
|
||||
<td><?= $value ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/** @var boolean $showService */
|
||||
$showService = false;
|
||||
|
||||
if (isset($this->service) && $this->tabs->getActiveName() !== 'host') {
|
||||
$showService = true;
|
||||
}
|
||||
|
@ -16,43 +17,73 @@ if (!$this->compact) {
|
|||
}
|
||||
?>
|
||||
<div class="information-container">
|
||||
<?php if ($inlineCommands === true) { ?>
|
||||
<div class="pull-right">
|
||||
<?=
|
||||
<?php if ($inlineCommands === true): ?>
|
||||
<div class="pull-right">
|
||||
<?=
|
||||
$this->monitoringCommands(
|
||||
($showService === true) ? $this->service : $this->host,
|
||||
'small'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table>
|
||||
<tr class="<?= $this->monitoringState($this->host, 'host') ?><?= $this->host->host_handled ? ' handled' : '' ?>">
|
||||
<td>
|
||||
|
||||
<?php if ($this->host->host_icon_image): ?>
|
||||
<div class="monitoring_icon">
|
||||
<img src="<?= $this->host->host_icon_image; ?>" alt="Host image" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<strong>
|
||||
<?= $this->escape($this->host->host_name); ?>
|
||||
<?php if ($this->host->host_address && $this->host->host_address !== $this->host->host_name) { ?>
|
||||
<?php if ($this->host->host_address && $this->host->host_address !== $this->host->host_name): ?>
|
||||
(<?= $this->escape($this->host->host_address); ?>)
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</strong>
|
||||
|
||||
<?php if (isset($this->host->host_alias) && $this->host->host_alias !== $this->host->host_name) { ?>
|
||||
<?php if (isset($this->host->host_alias) && $this->host->host_alias !== $this->host->host_name): ?>
|
||||
<br />
|
||||
<sup>(<?= $this->host->host_alias; ?>)</sup>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="state"<?= $showService ? '' : ' rowspan="2"'; ?>>
|
||||
<td class="state"<?= $showService ? '' : ' rowspan="2"'; ?>
|
||||
<?= $this->util()->getHostStateName($this->host->host_state); ?>
|
||||
since <?= $this->timeSince($this->host->host_last_state_change); ?>
|
||||
<?php if ($this->host->host_acknowledged === '1') { ?>
|
||||
(Has been acknowledged)
|
||||
<?php } ?>
|
||||
<?php if ($this->host->host_acknowledged === '1'): ?>
|
||||
(Has been acknowledged)
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ($showService === true) { ?>
|
||||
|
||||
<?php if ($this->host->host_action_url || $this->host->host_notes_url): ?>
|
||||
<tr>
|
||||
<td class="urls" rowspan="2">
|
||||
<?php if ($this->host->host_action_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->host->host_notes_url ?>'>Host actions </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->host->host_notes_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->host->host_notes_url ?>'>Host notes </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if ($showService === true): ?>
|
||||
<tr class="<?= $this->monitoringState($this->service, 'service'); ?><?= $this->service->service_handled ? ' handled' : '' ?>">
|
||||
<td>
|
||||
<?php if ($this->service->service_icon_image): ?>
|
||||
<div class="monitoring_icon">
|
||||
<img src="<?= $this->service->service_icon_image; ?>" alt="Host image" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<strong>
|
||||
Service: <?= $this->escape($this->service->service_description); ?>
|
||||
</strong>
|
||||
|
@ -60,15 +91,32 @@ if (!$this->compact) {
|
|||
<td class="state">
|
||||
<?= $this->util()->getServiceStateName($this->service->service_state); ?>
|
||||
since <?= $this->timeSince($this->service->service_last_state_change); ?>
|
||||
<?php if ($this->host->service_acknowledged === '1') { ?>
|
||||
<?php if ($this->service->service_acknowledged === '1'): ?>
|
||||
(Has been acknowledged)
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<?php // BYPASS ?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
|
||||
<?php if ($this->service->service_action_url || $this->service->service_notes_url): ?>
|
||||
<tr>
|
||||
<td class="urls" rowspan="2">
|
||||
<?php if ($this->service->service_action_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->service->service_notes_url ?>'>Service actions </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->service->service_notes_url): ?>
|
||||
<span class="url">
|
||||
<a href='<?= $this->service->service_notes_url ?>'>Service notes </a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,32 +1,31 @@
|
|||
<?php
|
||||
$hostgroupLinkList = array();
|
||||
if (!empty($this->hostgroups)) {
|
||||
foreach ($this->hostgroups as $name => $alias) {
|
||||
$hostgroupLinkList[] = $this->qlink(
|
||||
$alias,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'hostgroups' => $name
|
||||
)
|
||||
);
|
||||
}
|
||||
$hostgroupLinkList = array();
|
||||
if (!empty($this->hostgroups)) {
|
||||
foreach ($this->hostgroups as $name => $alias) {
|
||||
$hostgroupLinkList[] = $this->qlink(
|
||||
$alias,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'hostgroups' => $name
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$checkCommandParts = explode('!', $this->host->host_check_command, 2);
|
||||
}
|
||||
?>
|
||||
<?=
|
||||
$this->partial(
|
||||
'show/header.phtml',
|
||||
array(
|
||||
'host' => $this->host,
|
||||
'service' => $this->service,
|
||||
'tabs' => $this->tabs,
|
||||
'compact' => $this->compact
|
||||
)
|
||||
);
|
||||
$this->partial(
|
||||
'show/header.phtml',
|
||||
array(
|
||||
'host' => $this->host,
|
||||
'service' => $this->service,
|
||||
'tabs' => $this->tabs,
|
||||
'compact' => $this->compact
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<?= $this->preview_image ?>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Plugin output</span>
|
||||
|
@ -44,7 +43,10 @@
|
|||
|
||||
<div>
|
||||
<strong>Command:</strong>
|
||||
<?= array_shift($checkCommandParts); ?>
|
||||
<?php
|
||||
$explodedCommand = explode('!', $this->host->host_check_command, 2);
|
||||
array_shift($explodedCommand);
|
||||
?>
|
||||
<?= $this->commandArguments($this->host->host_check_command); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,10 +55,10 @@
|
|||
<div class="head">
|
||||
<span>Groups and Contacts</span>
|
||||
</div>
|
||||
<?php if (count($hostgroupLinkList)) { ?>
|
||||
<?php if (count($hostgroupLinkList)): ?>
|
||||
<strong>Hostgroups:</strong>
|
||||
<?= implode(' ', $hostgroupLinkList); ?>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->render('show/components/contacts.phtml') ?>
|
||||
</div>
|
||||
|
@ -98,33 +100,9 @@
|
|||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Groups and Contacts</span>
|
||||
</div>
|
||||
<?php if (count($hostgroupLinkList)) { ?>
|
||||
<strong>Hostgroups:</strong>
|
||||
<?= implode(' ', $hostgroupLinkList); ?>
|
||||
<?php } ?>
|
||||
|
||||
<?= $this->render('show/components/contacts.phtml') ?>
|
||||
</div>
|
||||
|
||||
<?= $this->render('show/components/comments.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/customvars.phtml'); ?>
|
||||
|
||||
<?php if ($this->host->host_perfdata): ?>
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Perfdata</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->perfdata($this->host->host_perfdata); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<span>Commands</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->monitoringCommands($this->host, 'full'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -77,11 +77,11 @@ if (!$perfData && $this->service->service_perfdata)
|
|||
</tr>
|
||||
<tr>
|
||||
<td><?= $this->translate('Check execution time') ?></td>
|
||||
<td><?= $this->service->service_check_execution_time ?></td>
|
||||
<td><?= $this->service->service_execution_time ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?= $this->translate('Check latency') ?></td>
|
||||
<td><?=$this->service->service_check_latency ?></td>
|
||||
<td><?=$this->service->service_latency ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -91,7 +91,7 @@ if (!$perfData && $this->service->service_perfdata)
|
|||
<?php if (isset($this->service->service_comments) && is_array($this->service->service_comments)): ?>
|
||||
<div class="expandable" >
|
||||
<div class="expand-title">
|
||||
<b><?= $this->translate('Comments') ?></b>
|
||||
<b><?= $this->translate('Comments') ?></b>+
|
||||
</div>
|
||||
<div class="expand-content" style="padding: 0px">
|
||||
<table class="subTable icinga-widget" type="icinga/subTable" maxItems="10" style="width:100%">
|
||||
|
|
|
@ -1,10 +1,110 @@
|
|||
<?= $this->render('show/components/header.phtml') ?>
|
||||
<?= $this->render('show/components/output.phtml') ?>
|
||||
<?= $this->render('show/components/servicegroups.phtml') ?>
|
||||
<?= $this->render('show/components/contacts.phtml') ?>
|
||||
<?= $this->render('show/components/comments.phtml') ?>
|
||||
<?= $this->render('show/components/customvars.phtml') ?>
|
||||
<?= $this->render('show/components/perfdata.phtml') ?>
|
||||
<?= $this->render('show/components/checkstatistics.phtml') ?>
|
||||
<?= $this->render('show/components/command.phtml') ?>
|
||||
<?php
|
||||
|
||||
$servicegroupLinkList = array();
|
||||
if (!empty($this->servicegroups)) {
|
||||
foreach ($this->servicegroups as $name => $alias) {
|
||||
$servicegroupLinkList[] = $this->qlink(
|
||||
$alias,
|
||||
'monitoring/list/services',
|
||||
array(
|
||||
'servicegroups' => $name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?=
|
||||
$this->partial(
|
||||
'show/header.phtml',
|
||||
array(
|
||||
'host' => $this->host,
|
||||
'service' => $this->service,
|
||||
'tabs' => $this->tabs,
|
||||
'compact' => $this->compact
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<?= $this->preview_image ?>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Plugin output</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->pluginOutput($this->service->service_output); ?>
|
||||
<?= $this->pluginOutput($this->service->service_long_output); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Command</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong>Command:</strong>
|
||||
<?php
|
||||
$explodedCommand = explode('!', $this->service->service_check_command, 2);
|
||||
echo array_shift($explodedCommand);
|
||||
?>
|
||||
<?= $this->commandArguments($this->service->service_check_command); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Groups and Contacts</span>
|
||||
</div>
|
||||
<?php if (count($servicegroupLinkList)) { ?>
|
||||
<strong>Servicegroups:</strong>
|
||||
<?= implode(' ', $servicegroupLinkList); ?>
|
||||
<?php } ?>
|
||||
|
||||
<?= $this->render('show/components/contacts.phtml') ?>
|
||||
</div>
|
||||
|
||||
<?= $this->render('show/components/comments.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/downtime.phtml'); ?>
|
||||
|
||||
<?= $this->render('show/components/customvars.phtml'); ?>
|
||||
|
||||
<?php if ($this->service->service_perfdata): ?>
|
||||
<div class="information-container">
|
||||
|
||||
<div class="head">
|
||||
<span>Perfdata</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->perfdata($this->service->service_perfdata); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Flags</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->render('show/components/flags.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Properties</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->render('show/components/properties.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="information-container">
|
||||
<div class="head">
|
||||
<span>Commands</span>
|
||||
</div>
|
||||
<div>
|
||||
<?= $this->monitoringCommands($this->service, 'full'); ?>
|
||||
</div>
|
||||
</div>
|
|
@ -93,6 +93,7 @@ class AbstractBackend implements DatasourceInterface
|
|||
* @param bool $fetchAll
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
public function fetchHost($host, $fetchAll = false)
|
||||
{
|
||||
$fields = array(
|
||||
|
@ -100,15 +101,17 @@ class AbstractBackend implements DatasourceInterface
|
|||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'host_icon_image',
|
||||
'host_in_downtime',
|
||||
'host_acknowledged',
|
||||
'host_check_command',
|
||||
'host_check_command',
|
||||
'host_last_state_change',
|
||||
'host_alias',
|
||||
'host_output',
|
||||
'host_long_output',
|
||||
'host_perfdata'
|
||||
'host_perfdata',
|
||||
'host_notes_url',
|
||||
'host_action_url'
|
||||
);
|
||||
|
||||
if ($fetchAll === true) {
|
||||
|
@ -167,74 +170,84 @@ class AbstractBackend implements DatasourceInterface
|
|||
}
|
||||
|
||||
// UGLY temporary service fetch
|
||||
public function fetchService($host, $service)
|
||||
public function fetchService($host, $service, $fetchAll = false)
|
||||
{
|
||||
Benchmark::measure('Preparing service select');
|
||||
$select = $this->select()
|
||||
->from(
|
||||
'status',
|
||||
array(
|
||||
$fields = array(
|
||||
'service_description',
|
||||
'host_name',
|
||||
'host_address',
|
||||
'host_state',
|
||||
'host_handled',
|
||||
'host_icon_image',
|
||||
'service_state',
|
||||
'service_handled',
|
||||
'service_in_downtime',
|
||||
'service_acknowledged',
|
||||
'service_check_command',
|
||||
'service_last_state_change',
|
||||
'service_display_name',
|
||||
'service_output',
|
||||
'service_long_output',
|
||||
'service_perfdata',
|
||||
'service_action_url',
|
||||
'service_notes_url',
|
||||
'service_icon_image'
|
||||
);
|
||||
|
||||
'host_name',
|
||||
'host_state',
|
||||
'host_check_command',
|
||||
'host_last_state_change',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_acknowledged',
|
||||
'service_handled',
|
||||
'service_output',
|
||||
'service_long_output',
|
||||
'service_perfdata',
|
||||
// '_host_satellite',
|
||||
'service_check_command',
|
||||
'service_last_state_change',
|
||||
if ($fetchAll === true) {
|
||||
$fields = array_merge(
|
||||
$fields,
|
||||
array(
|
||||
'service_current_check_attempt',
|
||||
'service_max_check_attempts',
|
||||
'service_attempt',
|
||||
'service_last_check',
|
||||
'service_next_check',
|
||||
'service_check_execution_time',
|
||||
'service_check_type',
|
||||
'service_last_state_change',
|
||||
'service_last_hard_state_change',
|
||||
'service_last_hard_state',
|
||||
'service_last_time_ok',
|
||||
'service_last_time_warning',
|
||||
'service_last_time_unknown',
|
||||
'service_last_time_critical',
|
||||
'service_state_type',
|
||||
'service_last_notification',
|
||||
'service_next_notification',
|
||||
'service_no_more_notifications',
|
||||
'service_notifications_enabled',
|
||||
'service_problem_has_been_acknowledged',
|
||||
'service_acknowledgement_type',
|
||||
'service_current_notification_number',
|
||||
'service_passive_checks_enabled',
|
||||
'service_active_checks_enabled',
|
||||
'service_event_handler_enabled',
|
||||
'service_flap_detection_enabled',
|
||||
'service_is_flapping',
|
||||
'service_percent_state_change',
|
||||
'service_check_latency',
|
||||
// 'service_
|
||||
'service_check_execution_time',
|
||||
'service_scheduled_downtime_depth',
|
||||
'service_failure_prediction_enabled',
|
||||
'service_process_performance_data',
|
||||
'service_obsess_over_service',
|
||||
'service_modified_service_attributes',
|
||||
'service_event_handler',
|
||||
'service_check_command',
|
||||
'service_normal_check_interval',
|
||||
'service_retry_check_interval',
|
||||
'service_check_timeperiod_object_id',
|
||||
'service_status_update_time'
|
||||
)
|
||||
)
|
||||
->where('host_name', $host)
|
||||
->where('service_description', $service);
|
||||
// Benchmark::measure((string) $select->getQuery());
|
||||
Benchmark::measure('Prepared service select');
|
||||
);
|
||||
}
|
||||
|
||||
$select = $this->select()
|
||||
->from('status', $fields)
|
||||
->where('service_description', $service)
|
||||
->where('host_name', $host);
|
||||
return $select->fetchRow();
|
||||
$object = \Icinga\Objects\Service::fromBackend(
|
||||
$this->select()
|
||||
->from(
|
||||
'status',
|
||||
array(
|
||||
|
||||
'host_name',
|
||||
'host_state',
|
||||
'host_check_command',
|
||||
'host_last_state_change',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_acknowledged',
|
||||
'service_handled',
|
||||
'service_output',
|
||||
'service_long_output',
|
||||
'service_perfdata',
|
||||
// '_host_satellite',
|
||||
'service_check_command',
|
||||
'service_last_state_change',
|
||||
'service_last_check',
|
||||
'service_next_check',
|
||||
'service_check_execution_time',
|
||||
'service_check_latency',
|
||||
// 'service_
|
||||
)
|
||||
)
|
||||
->where('host_name', $host)
|
||||
->where('service_description', $service)
|
||||
->fetchRow()
|
||||
);
|
||||
// $object->customvars = $this->fetchCustomvars($host, $service);
|
||||
return $object;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
|
||||
namespace Monitoring\Backend\Ido\Query;
|
||||
|
||||
|
||||
/**
|
||||
* Class DowntimeQuery
|
||||
* Handling downtime queries
|
||||
*/
|
||||
class DowntimeQuery extends AbstractQuery
|
||||
{
|
||||
|
|
|
@ -118,32 +118,56 @@ class StatusQuery extends AbstractQuery
|
|||
|
||||
),
|
||||
'servicestatus' => array(
|
||||
'current_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END',
|
||||
'service_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE ss.current_state END',
|
||||
'service_hard_state' => 'CASE WHEN ss.has_been_checked = 0 OR ss.has_been_checked IS NULL THEN 99 ELSE CASE WHEN ss.state_type = 1 THEN ss.current_state ELSE ss.last_hard_state END END',
|
||||
'service_state_type' => 'ss.state_type',
|
||||
'service_output' => 'ss.output',
|
||||
'service_long_output' => 'ss.long_output',
|
||||
'service_perfdata' => 'ss.perfdata',
|
||||
'service_is_flapping' => 'ss.is_flapping',
|
||||
'service_acknowledged' => 'ss.problem_has_been_acknowledged',
|
||||
'service_in_downtime' => 'CASE WHEN (ss.scheduled_downtime_depth = 0) THEN 0 ELSE 1 END',
|
||||
'service_handled' => 'CASE WHEN (COALESCE(ss.current_state, 0) * ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 1 ELSE 0 END',
|
||||
'service_handled' => 'CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth) > 0 THEN 1 ELSE 0 END',
|
||||
'service_does_active_checks' => 'ss.active_checks_enabled',
|
||||
'service_accepts_passive_checks' => 'ss.passive_checks_enabled',
|
||||
'service_last_state_change' => 'UNIX_TIMESTAMP(ss.last_state_change)',
|
||||
'service_last_hard_state' => 'ss.last_hard_state',
|
||||
'service_last_hard_state_change' => 'UNIX_TIMESTAMP(ss.last_hard_state_change)',
|
||||
'service_check_command' => 'ss.check_command',
|
||||
'service_last_check' => 'UNIX_TIMESTAMP(ss.last_check)',
|
||||
'service_next_check' => 'CASE WHEN ss.should_be_scheduled = 1 THEN UNIX_TIMESTAMP(ss.next_check) ELSE NULL END',
|
||||
'service_check_execution_time' => 'ss.execution_time',
|
||||
'service_check_latency' => 'ss.latency',
|
||||
'service_notifications_enabled' => 'ss.notifications_enabled',
|
||||
'service_last_time_ok' => 'ss.last_time_ok',
|
||||
'service_last_time_warning' => 'ss.last_time_warning',
|
||||
'service_last_time_critical' => 'ss.last_time_critical',
|
||||
'service_last_time_unknown' => 'ss.last_time_unknown',
|
||||
'service_last_state_change' => 'UNIX_TIMESTAMP(ss.last_state_change)',
|
||||
'service_check_command' => 'ss.check_command',
|
||||
'service_last_time_ok' => 'ss.last_time_ok',
|
||||
'service_last_time_warning' => 'ss.last_time_warning',
|
||||
'service_last_time_critical' => 'ss.last_time_critical',
|
||||
'service_last_time_unknown' => 'ss.last_time_unknown',
|
||||
'service_current_check_attempt' => 'ss.current_check_attempt',
|
||||
'service_max_check_attempts' => 'ss.max_check_attempts',
|
||||
'service_attempt' => 'CONCAT(ss.current_check_attempt, \'/\', ss.max_check_attempts)',
|
||||
'service_last_check' => 'ss.last_check',
|
||||
'service_next_check' => 'ss.next_check',
|
||||
'service_check_type' => 'ss.check_type',
|
||||
'service_last_hard_state_change' => 'ss.last_hard_state_change',
|
||||
'service_last_hard_state' => 'ss.last_hard_state',
|
||||
'service_state_type' => 'ss.state_type',
|
||||
'service_last_notification' => 'ss.last_notification',
|
||||
'service_next_notification' => 'ss.next_notification',
|
||||
'service_no_more_notifications' => 'ss.no_more_notifications',
|
||||
'service_notifications_enabled' => 'ss.notifications_enabled',
|
||||
'service_problem_has_been_acknowledged' => 'ss.problem_has_been_acknowledged',
|
||||
'service_acknowledgement_type' => 'ss.acknowledgement_type',
|
||||
'service_current_notification_number' => 'ss.current_notification_number',
|
||||
'service_passive_checks_enabled' => 'ss.passive_checks_enabled',
|
||||
'service_active_checks_enabled' => 'ss.active_checks_enabled',
|
||||
'service_event_handler_enabled' => 'ss.event_handler_enabled',
|
||||
'service_flap_detection_enabled' => 'ss.flap_detection_enabled',
|
||||
'service_is_flapping' => 'ss.is_flapping',
|
||||
'service_percent_state_change' => 'ss.percent_state_change',
|
||||
'service_check_latency' => 'ss.latency',
|
||||
'service_check_execution_time' => 'ss.execution_time',
|
||||
'service_scheduled_downtime_depth' => 'ss.scheduled_downtime_depth',
|
||||
'service_failure_prediction_enabled' => 'ss.failure_prediction_enabled',
|
||||
'service_process_performance_data' => 'ss.process_performance_data',
|
||||
'service_obsess_over_service' => 'ss.obsess_over_service',
|
||||
'service_modified_service_attributes' => 'ss.modified_service_attributes',
|
||||
'service_event_handler' => 'ss.event_handler',
|
||||
'service_check_command' => 'ss.check_command',
|
||||
'service_normal_check_interval' => 'ss.normal_check_interval',
|
||||
'service_retry_check_interval' => 'ss.retry_check_interval',
|
||||
'service_check_timeperiod_object_id' => 'ss.check_timeperiod_object_id',
|
||||
'service_status_update_time' => 'ss.status_update_time'
|
||||
),
|
||||
'serviceproblemsummary' => array(
|
||||
'host_unhandled_service_count' => 'sps.unhandled_service_count'
|
||||
|
@ -214,14 +238,14 @@ class StatusQuery extends AbstractQuery
|
|||
array('ho' => $this->prefix . 'objects'),
|
||||
array()
|
||||
)->join(
|
||||
array('hs' => $this->prefix . 'hoststatus'),
|
||||
'ho.object_id = hs.host_object_id AND ho.is_active = 1 AND ho.objecttype_id = 1',
|
||||
array()
|
||||
)->join(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'hs.host_object_id = h.host_object_id',
|
||||
array()
|
||||
);
|
||||
array('hs' => $this->prefix . 'hoststatus'),
|
||||
'ho.object_id = hs.host_object_id AND ho.is_active = 1 AND ho.objecttype_id = 1',
|
||||
array()
|
||||
)->join(
|
||||
array('h' => $this->prefix . 'hosts'),
|
||||
'hs.host_object_id = h.host_object_id',
|
||||
array()
|
||||
);
|
||||
$this->joinedVirtualTables = array(
|
||||
'hosts' => true,
|
||||
'hoststatus' => true,
|
||||
|
@ -309,15 +333,15 @@ class StatusQuery extends AbstractQuery
|
|||
array()
|
||||
)->join(
|
||||
|
||||
array('sg' => $this->prefix . 'servicegroups'),
|
||||
'sgm.servicegroup_id = sg.' . $this->servicegroup_id,
|
||||
array()
|
||||
)->join(
|
||||
array('sgo' => $this->prefix . 'objects'),
|
||||
'sgo.' . $this->object_id. ' = sg.servicegroup_object_id'
|
||||
. ' AND sgo.is_active = 1',
|
||||
array()
|
||||
);
|
||||
array('sg' => $this->prefix . 'servicegroups'),
|
||||
'sgm.servicegroup_id = sg.' . $this->servicegroup_id,
|
||||
array()
|
||||
)->join(
|
||||
array('sgo' => $this->prefix . 'objects'),
|
||||
'sgo.' . $this->object_id. ' = sg.servicegroup_object_id'
|
||||
. ' AND sgo.is_active = 1',
|
||||
array()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -327,10 +351,10 @@ class StatusQuery extends AbstractQuery
|
|||
$this->baseQuery->joinleft(
|
||||
array ('sps' => new \Zend_Db_Expr(
|
||||
'(SELECT COUNT(s.service_object_id) as unhandled_service_count, s.host_object_id as host_object_id '.
|
||||
'FROM icinga_services s INNER JOIN icinga_servicestatus ss ON ss.current_state != 0 AND '.
|
||||
'ss.problem_has_been_acknowledged = 0 AND ss.scheduled_downtime_depth = 0 AND '.
|
||||
'ss.service_object_id = s.service_object_id '.
|
||||
'GROUP BY s.host_object_id'.
|
||||
'FROM icinga_services s INNER JOIN icinga_servicestatus ss ON ss.current_state != 0 AND '.
|
||||
'ss.problem_has_been_acknowledged = 0 AND ss.scheduled_downtime_depth = 0 AND '.
|
||||
'ss.service_object_id = s.service_object_id '.
|
||||
'GROUP BY s.host_object_id'.
|
||||
')')),
|
||||
'sps.host_object_id = hs.host_object_id',
|
||||
array()
|
||||
|
|
|
@ -92,7 +92,7 @@ class Statusdat extends AbstractBackend
|
|||
* @param $service
|
||||
* @return MonitoringObjectList|null
|
||||
*/
|
||||
public function fetchService($host, $service)
|
||||
public function fetchService($host, $service, $fetchAll = false)
|
||||
{
|
||||
$idxName = $host . ";" . $service;
|
||||
$objs = & $this->reader->getObjects();
|
||||
|
|
|
@ -729,8 +729,8 @@ class Meta
|
|||
} else {
|
||||
unset($commands[self::CMD_START_ACCEPTING_PASSIVE_CHECKS]);
|
||||
}
|
||||
|
||||
if ($object->obsess_over_host === '1') {
|
||||
$obsess = 'obsess_over_'.$type;
|
||||
if ($object->$obsess === '1') {
|
||||
unset($commands[self::CMD_START_OBSESSING]);
|
||||
} else {
|
||||
unset($commands[self::CMD_STOP_OBSESSING]);
|
||||
|
|
|
@ -45,8 +45,8 @@ class HostStruct4Properties extends \stdClass
|
|||
public $host_flap_detection_enabled = '1';
|
||||
public $host_is_flapping = '0';
|
||||
public $host_percent_state_change = '12.36842';
|
||||
public $host_latency = '0.12041';
|
||||
public $host_execution_time = '0';
|
||||
public $host_check_latency = '0.12041';
|
||||
public $host_check_execution_time = '0';
|
||||
public $host_scheduled_downtime_depth = '1';
|
||||
public $host_failure_prediction_enabled = '1';
|
||||
public $host_process_performance_data = '1';
|
||||
|
|
|
@ -79,7 +79,7 @@ class PDOInsertionStrategy
|
|||
*/
|
||||
private function insertHosts()
|
||||
{
|
||||
$hosts = &$this->fixture->getHosts();
|
||||
$hosts = $this->fixture->getHosts();
|
||||
|
||||
$insertObjectQuery = $this->connection->prepare(
|
||||
'INSERT INTO icinga_objects (object_id, objecttype_id, name1, is_active) VALUES (?, 1, ?, 1);'
|
||||
|
@ -207,7 +207,7 @@ class PDOInsertionStrategy
|
|||
$insertContactQuery = $this->connection->prepare(
|
||||
'INSERT INTO icinga_contacts (contact_object_id, alias) VALUES (?, ?);'
|
||||
);
|
||||
$contacts = &$this->fixture->getContacts();
|
||||
$contacts = $this->fixture->getContacts();
|
||||
foreach($contacts as &$contact) {
|
||||
$insertObjectQuery->execute($this->objectId, $contact["alias"]);
|
||||
$insertContactQuery->execute($this->objectId, $contact["alias"]);
|
||||
|
@ -228,7 +228,7 @@ class PDOInsertionStrategy
|
|||
'INSERT INTO icinga_comments (object_id, comment_type, internal_comment_id, author_name, comment_data)'.
|
||||
' VALUES (?, ?, ?, ?, ?);'
|
||||
);
|
||||
$comments = &$this->fixture->getComments();
|
||||
$comments = $this->fixture->getComments();
|
||||
foreach ($comments as $comment) {
|
||||
if (isset($comment["host"])) {
|
||||
$type = 1;
|
||||
|
@ -260,7 +260,7 @@ class PDOInsertionStrategy
|
|||
$insertHostgroupMemberQuery = $this->connection->prepare(
|
||||
'INSERT INTO icinga_hostgroup_members (hostgroup_id, host_object_id) VALUES (?, ?)'
|
||||
);
|
||||
$hostgroups = &$this->fixture->getHostgroups();
|
||||
$hostgroups = $this->fixture->getHostgroups();
|
||||
|
||||
foreach ($hostgroups as &$hostgroup) {
|
||||
$insertObjectQuery->execute(array($this->objectId, $hostgroup["name"]));
|
||||
|
@ -289,7 +289,7 @@ class PDOInsertionStrategy
|
|||
$insertServicegroupMemberQuery = $this->connection->prepare(
|
||||
'INSERT INTO icinga_servicegroup_members (servicegroup_id, service_object_id) VALUES (?, ?)'
|
||||
);
|
||||
$servicegroups = &$this->fixture->getServicegroups();
|
||||
$servicegroups = $this->fixture->getServicegroups();
|
||||
|
||||
foreach ($servicegroups as &$servicegroup) {
|
||||
$insertObjectQuery->execute(array($this->objectId, $servicegroup["name"]));
|
||||
|
|
|
@ -146,22 +146,9 @@ define servicegroup {
|
|||
*/
|
||||
public function testRuntimeParsingForBigFile()
|
||||
{
|
||||
$this->markTestSkipped('Skipped slow tests');
|
||||
$objects = fopen("res/status/objects.cache","r");
|
||||
$status = fopen("res/status/status.big.dat","r");
|
||||
$testParser = new Parser($objects);
|
||||
$testParser->parseObjectsFile();
|
||||
$testParser->parseRuntimeState($status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert no errors occuring
|
||||
*/
|
||||
public function testRuntimeParsingForIcinga2()
|
||||
{
|
||||
$this->markTestSkipped('Skipped slow tests');
|
||||
$objects = fopen("res/status/objects.icinga2.cache","r");
|
||||
$status = fopen("res/status/status.icinga2.dat","r");
|
||||
//$this->markTestSkipped('Skipped slow tests');
|
||||
$objects = fopen("./res/status/icinga.objects.cache","r");
|
||||
$status = fopen("./res/status/icinga.status.dat","r");
|
||||
$testParser = new Parser($objects);
|
||||
$testParser->parseObjectsFile();
|
||||
$testParser->parseRuntimeState($status);
|
||||
|
|
Loading…
Reference in New Issue