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:
Jannis Mosshammer 2013-07-23 14:32:00 +00:00 committed by Jannis Moßhammer
commit e8204f4755
28 changed files with 526 additions and 264 deletions

View File

@ -72,7 +72,7 @@ class LdapUserBackend implements UserBackend
/** /**
* Removes the '*' characted from $string * Removes the '*' characted from $string
* *
* @param String $string * @param String $string
* *
* @return String * @return String
@ -84,12 +84,12 @@ class LdapUserBackend implements UserBackend
/** /**
* Tries to fetch the username given in $username from * 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 * given in the Authentication configuration
* *
* @param String $username The username to select * @param String $username The username to select
* *
* @return object $result * @return object $result
**/ **/
protected function selectUsername($username) protected function selectUsername($username)
{ {

View File

@ -217,9 +217,9 @@ class Manager
{ {
$this->session->set("user", $this->user); $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() public function authenticateFromSession()
{ {
@ -228,10 +228,10 @@ class Manager
/** /**
* Returns true when the user is currently authenticated * Returns true when the user is currently authenticated
* *
* @param Boolean $ignoreSession Set to true to prevent authentication by session * @param Boolean $ignoreSession Set to true to prevent authentication by session
* *
* @param Boolean * @param Boolean
**/ **/
public function isAuthenticated($ignoreSession = false) public function isAuthenticated($ignoreSession = false)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>

View File

@ -1,4 +1,27 @@
<?php <?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 * Module action controller

View File

@ -1,4 +1,27 @@
<?php <?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; namespace Icinga\Web;

View File

@ -1,8 +1,28 @@
<?php <?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; namespace Icinga\Web;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;

View File

@ -44,7 +44,7 @@ class Monitoring_ShowController extends ModuleActionController
$this->backend = Backend::getInstance($this->_getParam('backend')); $this->backend = Backend::getInstance($this->_getParam('backend'));
if ($service !== null && $service !== '*') { if ($service !== null && $service !== '*') {
$this->view->service = $this->backend->fetchService($host, $service); $this->view->service = $this->backend->fetchService($host, $service, true);
} }
if ($host !== null) { if ($host !== null) {
$this->view->host = $this->backend->fetchHost($host, true); $this->view->host = $this->backend->fetchHost($host, true);
@ -71,17 +71,30 @@ class Monitoring_ShowController extends ModuleActionController
if ($grapher = Hook::get('grapher')) { if ($grapher = Hook::get('grapher')) {
if ($grapher->hasGraph( if ($grapher->hasGraph(
$this->view->host->host_name, $this->view->service->host_name,
$this->view->service->service_description $this->view->service->service_description
) )
) { ) {
$this->view->preview_image = $grapher->getPreviewImage( $this->view->preview_image = $grapher->getPreviewImage(
$this->view->host->host_name, $this->view->service->host_name,
$this->view->service->service_description $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() $this->view->contacts = $this->backend->select()
->from( ->from(
'contact', 'contact',
@ -387,15 +400,17 @@ class Monitoring_ShowController extends ModuleActionController
'urlParams' => $params, 'urlParams' => $params,
) )
); );
$tabs->add( if (!isset($this->view->service)) {
'services', $tabs->add(
array( 'services',
'title' => 'Services', array(
'icon' => 'img/classic/service.png', 'title' => 'Services',
'url' => 'monitoring/show/services', 'icon' => 'img/classic/service.png',
'urlParams' => $params, 'url' => 'monitoring/show/services',
) 'urlParams' => $params,
); )
);
}
if (isset($params['service'])) { if (isset($params['service'])) {
$tabs->add( $tabs->add(
'service', 'service',

View File

@ -2,6 +2,29 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{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 * Class Zend_View_Helper_MonitoringFlags
* *

View File

@ -139,13 +139,13 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
$val .= self::VALUE_NA; $val .= self::VALUE_NA;
} else { } else {
$val .= $this->floatFormatter( $val .= $this->floatFormatter(
(isset($object->latency)) ? $object->latency : 0 (isset($object->check_latency)) ? $object->check_latency : 0
); );
} }
$val .= ' / '. $this->floatFormatter( $val .= ' / '. $this->floatFormatter(
isset($object->execution_time) ? $object->execution_time : 0 isset($object->check_execution_time) ? $object->check_execution_time : 0
). ' seconds'; ). ' seconds';
return $val; return $val;
} }

View File

@ -6,6 +6,7 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
{ {
public function perfdata($perfdata, $compact = false, $float = 'right') public function perfdata($perfdata, $compact = false, $float = 'right')
{ {
if (empty($perfdata)) { if (empty($perfdata)) {
return ''; return '';
} }
@ -75,9 +76,15 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
. '</td></tr>'; . '</td></tr>';
} }
} }
if ($result == '') {
$result = $perfdata;
}
if (! $compact && $result !== '') { if (! $compact && $result !== '') {
$result = '<table style="width: 100%">' . $result . '</table>'; $result = '<table style="width: 100%">' . $result . '</table>';
} }
return $result; return $result;
} }
} }

View File

@ -16,11 +16,11 @@
</tr> </tr>
<tr> <tr>
<td>' . $this->translate('Check execution time') . '</td> <td>' . $this->translate('Check execution time') . '</td>
<td>' . $object->check_execution_time . '</td> <td>' . $object->execution_time . '</td>
</tr> </tr>
<tr> <tr>
<td>' . $this->translate('Check latency') . '</td> <td>' . $this->translate('Check latency') . '</td>
<td>' . $object->check_latency . '</td> <td>' . $object->latency . '</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -1,13 +1,12 @@
<?php
if (empty($object->comments)) return;
<?php if (! empty($this->comments)): ?>
<?
$list = array(); $list = array();
foreach ($object->comments as $comment) { foreach ($this->comments as $comment) {
if ($ticket_pattern) { if ($this->ticket_pattern) {
$text = preg_replace( $text = preg_replace(
$ticket_pattern, $this->ticket_pattern,
$ticket_link, $this->ticket_link,
$this->escape($comment->comment_data) $this->escape($comment->comment_data)
); );
} else { } else {
@ -30,3 +29,4 @@ foreach ($object->comments as $comment) {
<blockquote> <?= implode('<br />', $list) ?></blockquote> <blockquote> <?= implode('<br />', $list) ?></blockquote>
</div> </div>
<?php endif; ?>

View File

@ -1,4 +1,4 @@
<?php if (!empty($this->downtimes)) { ?> <?php if (!empty($this->downtimes)): ?>
<?php <?php
$list = array(); $list = array();
foreach ($this->downtimes as $downtime) { foreach ($this->downtimes as $downtime) {
@ -40,4 +40,4 @@
</table> </table>
</div> </div>
</div> </div>
<?php } ?> <?php endif; ?>

View File

@ -10,16 +10,16 @@
$flags = $this->monitoringFlags($object); $flags = $this->monitoringFlags($object);
?> ?>
<table class="flag-container"> <table class="flag-container">
<?php foreach ($flags as $name => $value) { ?> <?php foreach ($flags as $name => $value): ?>
<tr> <tr>
<th><?= $name; ?></th> <th><?= $name; ?></th>
<td> <td>
<?php if ($value === true) { ?> <?php if ($value === true): ?>
<span class="flag flag-enabled">ENABLED</span> <span class="flag flag-enabled">ENABLED</span>
<?php } else { ?> <?php else: ?>
<span class="flag flag-disabled">DISABLED</span> <span class="flag flag-disabled">DISABLED</span>
<?php } ?> <?php endif; ?>
</td> </td>
</tr> </tr>
<?php } ?> <?php endforeach; ?>
</table> </table>

View File

@ -10,10 +10,10 @@ if (isset($this->service)) {
$properties = $this->monitoringProperties($object); $properties = $this->monitoringProperties($object);
?> ?>
<table> <table>
<?php foreach ($properties as $label => $value) { ?> <?php foreach ($properties as $label => $value): ?>
<tr> <tr>
<th><?= $label ?></th> <th><?= $label ?></th>
<td><?= $value ?></td> <td><?= $value ?></td>
</tr> </tr>
<?php } ?> <?php endforeach; ?>
</table> </table>

View File

@ -1,6 +1,7 @@
<?php <?php
/** @var boolean $showService */ /** @var boolean $showService */
$showService = false; $showService = false;
if (isset($this->service) && $this->tabs->getActiveName() !== 'host') { if (isset($this->service) && $this->tabs->getActiveName() !== 'host') {
$showService = true; $showService = true;
} }
@ -16,43 +17,73 @@ if (!$this->compact) {
} }
?> ?>
<div class="information-container"> <div class="information-container">
<?php if ($inlineCommands === true) { ?> <?php if ($inlineCommands === true): ?>
<div class="pull-right"> <div class="pull-right">
<?= <?=
$this->monitoringCommands( $this->monitoringCommands(
($showService === true) ? $this->service : $this->host, ($showService === true) ? $this->service : $this->host,
'small' 'small'
); );
?> ?>
</div> </div>
<?php } ?> <?php endif; ?>
<table> <table>
<tr class="<?= $this->monitoringState($this->host, 'host') ?><?= $this->host->host_handled ? ' handled' : '' ?>"> <tr class="<?= $this->monitoringState($this->host, 'host') ?><?= $this->host->host_handled ? ' handled' : '' ?>">
<td> <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> <strong>
<?= $this->escape($this->host->host_name); ?> <?= $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); ?>) (<?= $this->escape($this->host->host_address); ?>)
<?php } ?> <?php endif; ?>
</strong> </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 /> <br />
<sup>(<?= $this->host->host_alias; ?>)</sup> <sup>(<?= $this->host->host_alias; ?>)</sup>
<?php } ?> <?php endif; ?>
</td> </td>
<td class="state"<?= $showService ? '' : ' rowspan="2"'; ?>> <td class="state"<?= $showService ? '' : ' rowspan="2"'; ?>
<?= $this->util()->getHostStateName($this->host->host_state); ?> <?= $this->util()->getHostStateName($this->host->host_state); ?>
since <?= $this->timeSince($this->host->host_last_state_change); ?> since <?= $this->timeSince($this->host->host_last_state_change); ?>
<?php if ($this->host->host_acknowledged === '1') { ?> <?php if ($this->host->host_acknowledged === '1'): ?>
(Has been acknowledged) (Has been acknowledged)
<?php } ?> <?php endif; ?>
</td> </td>
</tr> </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' : '' ?>"> <tr class="<?= $this->monitoringState($this->service, 'service'); ?><?= $this->service->service_handled ? ' handled' : '' ?>">
<td> <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> <strong>
Service: <?= $this->escape($this->service->service_description); ?> Service: <?= $this->escape($this->service->service_description); ?>
</strong> </strong>
@ -60,15 +91,32 @@ if (!$this->compact) {
<td class="state"> <td class="state">
<?= $this->util()->getServiceStateName($this->service->service_state); ?> <?= $this->util()->getServiceStateName($this->service->service_state); ?>
since <?= $this->timeSince($this->service->service_last_state_change); ?> 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) (Has been acknowledged)
<?php } ?> <?php endif; ?>
</td> </td>
</tr> </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 class="clearfix"></div>
</div> </div>

View File

@ -1,32 +1,31 @@
<?php <?php
$hostgroupLinkList = array(); $hostgroupLinkList = array();
if (!empty($this->hostgroups)) { if (!empty($this->hostgroups)) {
foreach ($this->hostgroups as $name => $alias) { foreach ($this->hostgroups as $name => $alias) {
$hostgroupLinkList[] = $this->qlink( $hostgroupLinkList[] = $this->qlink(
$alias, $alias,
'monitoring/list/services', 'monitoring/list/services',
array( array(
'hostgroups' => $name 'hostgroups' => $name
) )
); );
}
} }
}
$checkCommandParts = explode('!', $this->host->host_check_command, 2);
?> ?>
<?= <?=
$this->partial( $this->partial(
'show/header.phtml', 'show/header.phtml',
array( array(
'host' => $this->host, 'host' => $this->host,
'service' => $this->service, 'service' => $this->service,
'tabs' => $this->tabs, 'tabs' => $this->tabs,
'compact' => $this->compact 'compact' => $this->compact
) )
); );
?> ?>
<?= $this->preview_image ?> <?= $this->preview_image ?>
<div class="information-container"> <div class="information-container">
<div class="head"> <div class="head">
<span>Plugin output</span> <span>Plugin output</span>
@ -44,7 +43,10 @@
<div> <div>
<strong>Command:</strong> <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); ?> <?= $this->commandArguments($this->host->host_check_command); ?>
</div> </div>
</div> </div>
@ -53,10 +55,10 @@
<div class="head"> <div class="head">
<span>Groups and Contacts</span> <span>Groups and Contacts</span>
</div> </div>
<?php if (count($hostgroupLinkList)) { ?> <?php if (count($hostgroupLinkList)): ?>
<strong>Hostgroups:</strong> <strong>Hostgroups:</strong>
<?= implode(' ', $hostgroupLinkList); ?> <?= implode(' ', $hostgroupLinkList); ?>
<?php } ?> <?php endif; ?>
<?= $this->render('show/components/contacts.phtml') ?> <?= $this->render('show/components/contacts.phtml') ?>
</div> </div>
@ -98,33 +100,9 @@
<div class="information-container"> <div class="information-container">
<div class="head"> <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> <span>Commands</span>
</div> </div>
<div> <div>
<?= $this->monitoringCommands($this->host, 'full'); ?> <?= $this->monitoringCommands($this->host, 'full'); ?>
</div> </div>
</div> </div>

View File

@ -77,11 +77,11 @@ if (!$perfData && $this->service->service_perfdata)
</tr> </tr>
<tr> <tr>
<td><?= $this->translate('Check execution time') ?></td> <td><?= $this->translate('Check execution time') ?></td>
<td><?= $this->service->service_check_execution_time ?></td> <td><?= $this->service->service_execution_time ?></td>
</tr> </tr>
<tr> <tr>
<td><?= $this->translate('Check latency') ?></td> <td><?= $this->translate('Check latency') ?></td>
<td><?=$this->service->service_check_latency ?></td> <td><?=$this->service->service_latency ?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -91,7 +91,7 @@ if (!$perfData && $this->service->service_perfdata)
<?php if (isset($this->service->service_comments) && is_array($this->service->service_comments)): ?> <?php if (isset($this->service->service_comments) && is_array($this->service->service_comments)): ?>
<div class="expandable" > <div class="expandable" >
<div class="expand-title"> <div class="expand-title">
<b><?= $this->translate('Comments') ?></b> <b><?= $this->translate('Comments') ?></b>+
</div> </div>
<div class="expand-content" style="padding: 0px"> <div class="expand-content" style="padding: 0px">
<table class="subTable icinga-widget" type="icinga/subTable" maxItems="10" style="width:100%"> <table class="subTable icinga-widget" type="icinga/subTable" maxItems="10" style="width:100%">

View File

@ -1,10 +1,110 @@
<?= $this->render('show/components/header.phtml') ?> <?php
<?= $this->render('show/components/output.phtml') ?>
<?= $this->render('show/components/servicegroups.phtml') ?> $servicegroupLinkList = array();
<?= $this->render('show/components/contacts.phtml') ?> if (!empty($this->servicegroups)) {
<?= $this->render('show/components/comments.phtml') ?> foreach ($this->servicegroups as $name => $alias) {
<?= $this->render('show/components/customvars.phtml') ?> $servicegroupLinkList[] = $this->qlink(
<?= $this->render('show/components/perfdata.phtml') ?> $alias,
<?= $this->render('show/components/checkstatistics.phtml') ?> 'monitoring/list/services',
<?= $this->render('show/components/command.phtml') ?> array(
'servicegroups' => $name
)
);
}
}
?>
<?=
$this->partial(
'show/header.phtml',
array(
'host' => $this->host,
'service' => $this->service,
'tabs' => $this->tabs,
'compact' => $this->compact
)
);
?>
<?= $this->preview_image ?> <?= $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>

View File

@ -93,6 +93,7 @@ class AbstractBackend implements DatasourceInterface
* @param bool $fetchAll * @param bool $fetchAll
* @return mixed * @return mixed
*/ */
public function fetchHost($host, $fetchAll = false) public function fetchHost($host, $fetchAll = false)
{ {
$fields = array( $fields = array(
@ -100,15 +101,17 @@ class AbstractBackend implements DatasourceInterface
'host_address', 'host_address',
'host_state', 'host_state',
'host_handled', 'host_handled',
'host_icon_image',
'host_in_downtime', 'host_in_downtime',
'host_acknowledged', 'host_acknowledged',
'host_check_command', 'host_check_command',
'host_check_command',
'host_last_state_change', 'host_last_state_change',
'host_alias', 'host_alias',
'host_output', 'host_output',
'host_long_output', 'host_long_output',
'host_perfdata' 'host_perfdata',
'host_notes_url',
'host_action_url'
); );
if ($fetchAll === true) { if ($fetchAll === true) {
@ -167,74 +170,84 @@ class AbstractBackend implements DatasourceInterface
} }
// UGLY temporary service fetch // UGLY temporary service fetch
public function fetchService($host, $service) public function fetchService($host, $service, $fetchAll = false)
{ {
Benchmark::measure('Preparing service select'); $fields = array(
$select = $this->select() 'service_description',
->from( 'host_name',
'status', 'host_address',
array( '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', if ($fetchAll === true) {
'host_state', $fields = array_merge(
'host_check_command', $fields,
'host_last_state_change', array(
'service_description', 'service_current_check_attempt',
'service_state', 'service_max_check_attempts',
'service_acknowledged', 'service_attempt',
'service_handled',
'service_output',
'service_long_output',
'service_perfdata',
// '_host_satellite',
'service_check_command',
'service_last_state_change',
'service_last_check', 'service_last_check',
'service_next_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_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(); 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;
} }

View File

@ -25,8 +25,9 @@
namespace Monitoring\Backend\Ido\Query; namespace Monitoring\Backend\Ido\Query;
/** /**
* Class DowntimeQuery * Handling downtime queries
*/ */
class DowntimeQuery extends AbstractQuery class DowntimeQuery extends AbstractQuery
{ {

View File

@ -118,32 +118,56 @@ class StatusQuery extends AbstractQuery
), ),
'servicestatus' => array( '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_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_output' => 'ss.output',
'service_long_output' => 'ss.long_output', 'service_long_output' => 'ss.long_output',
'service_perfdata' => 'ss.perfdata', 'service_perfdata' => 'ss.perfdata',
'service_is_flapping' => 'ss.is_flapping',
'service_acknowledged' => 'ss.problem_has_been_acknowledged', 'service_acknowledged' => 'ss.problem_has_been_acknowledged',
'service_in_downtime' => 'CASE WHEN (ss.scheduled_downtime_depth = 0) THEN 0 ELSE 1 END', '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_does_active_checks' => 'ss.active_checks_enabled',
'service_accepts_passive_checks' => 'ss.passive_checks_enabled', 'service_accepts_passive_checks' => 'ss.passive_checks_enabled',
'service_last_state_change' => 'UNIX_TIMESTAMP(ss.last_state_change)', 'service_last_state_change' => 'UNIX_TIMESTAMP(ss.last_state_change)',
'service_last_hard_state' => 'ss.last_hard_state', 'service_check_command' => 'ss.check_command',
'service_last_hard_state_change' => 'UNIX_TIMESTAMP(ss.last_hard_state_change)', 'service_last_time_ok' => 'ss.last_time_ok',
'service_check_command' => 'ss.check_command', 'service_last_time_warning' => 'ss.last_time_warning',
'service_last_check' => 'UNIX_TIMESTAMP(ss.last_check)', 'service_last_time_critical' => 'ss.last_time_critical',
'service_next_check' => 'CASE WHEN ss.should_be_scheduled = 1 THEN UNIX_TIMESTAMP(ss.next_check) ELSE NULL END', 'service_last_time_unknown' => 'ss.last_time_unknown',
'service_check_execution_time' => 'ss.execution_time', 'service_current_check_attempt' => 'ss.current_check_attempt',
'service_check_latency' => 'ss.latency', 'service_max_check_attempts' => 'ss.max_check_attempts',
'service_notifications_enabled' => 'ss.notifications_enabled', 'service_attempt' => 'CONCAT(ss.current_check_attempt, \'/\', ss.max_check_attempts)',
'service_last_time_ok' => 'ss.last_time_ok', 'service_last_check' => 'ss.last_check',
'service_last_time_warning' => 'ss.last_time_warning', 'service_next_check' => 'ss.next_check',
'service_last_time_critical' => 'ss.last_time_critical', 'service_check_type' => 'ss.check_type',
'service_last_time_unknown' => 'ss.last_time_unknown', '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( 'serviceproblemsummary' => array(
'host_unhandled_service_count' => 'sps.unhandled_service_count' 'host_unhandled_service_count' => 'sps.unhandled_service_count'
@ -214,14 +238,14 @@ 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,
'hoststatus' => true, 'hoststatus' => true,
@ -309,15 +333,15 @@ class StatusQuery extends AbstractQuery
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;
} }
@ -327,10 +351,10 @@ class StatusQuery extends AbstractQuery
$this->baseQuery->joinleft( $this->baseQuery->joinleft(
array ('sps' => new \Zend_Db_Expr( array ('sps' => new \Zend_Db_Expr(
'(SELECT COUNT(s.service_object_id) as unhandled_service_count, s.host_object_id as host_object_id '. '(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 '. '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.problem_has_been_acknowledged = 0 AND ss.scheduled_downtime_depth = 0 AND '.
'ss.service_object_id = s.service_object_id '. 'ss.service_object_id = s.service_object_id '.
'GROUP BY s.host_object_id'. 'GROUP BY s.host_object_id'.
')')), ')')),
'sps.host_object_id = hs.host_object_id', 'sps.host_object_id = hs.host_object_id',
array() array()

View File

@ -92,7 +92,7 @@ class Statusdat extends AbstractBackend
* @param $service * @param $service
* @return MonitoringObjectList|null * @return MonitoringObjectList|null
*/ */
public function fetchService($host, $service) public function fetchService($host, $service, $fetchAll = false)
{ {
$idxName = $host . ";" . $service; $idxName = $host . ";" . $service;
$objs = & $this->reader->getObjects(); $objs = & $this->reader->getObjects();

View File

@ -729,8 +729,8 @@ class Meta
} else { } else {
unset($commands[self::CMD_START_ACCEPTING_PASSIVE_CHECKS]); unset($commands[self::CMD_START_ACCEPTING_PASSIVE_CHECKS]);
} }
$obsess = 'obsess_over_'.$type;
if ($object->obsess_over_host === '1') { if ($object->$obsess === '1') {
unset($commands[self::CMD_START_OBSESSING]); unset($commands[self::CMD_START_OBSESSING]);
} else { } else {
unset($commands[self::CMD_STOP_OBSESSING]); unset($commands[self::CMD_STOP_OBSESSING]);

View File

@ -45,8 +45,8 @@ class HostStruct4Properties extends \stdClass
public $host_flap_detection_enabled = '1'; public $host_flap_detection_enabled = '1';
public $host_is_flapping = '0'; public $host_is_flapping = '0';
public $host_percent_state_change = '12.36842'; public $host_percent_state_change = '12.36842';
public $host_latency = '0.12041'; public $host_check_latency = '0.12041';
public $host_execution_time = '0'; public $host_check_execution_time = '0';
public $host_scheduled_downtime_depth = '1'; public $host_scheduled_downtime_depth = '1';
public $host_failure_prediction_enabled = '1'; public $host_failure_prediction_enabled = '1';
public $host_process_performance_data = '1'; public $host_process_performance_data = '1';

View File

@ -79,7 +79,7 @@ class PDOInsertionStrategy
*/ */
private function insertHosts() private function insertHosts()
{ {
$hosts = &$this->fixture->getHosts(); $hosts = $this->fixture->getHosts();
$insertObjectQuery = $this->connection->prepare( $insertObjectQuery = $this->connection->prepare(
'INSERT INTO icinga_objects (object_id, objecttype_id, name1, is_active) VALUES (?, 1, ?, 1);' 'INSERT INTO icinga_objects (object_id, objecttype_id, name1, is_active) VALUES (?, 1, ?, 1);'
@ -207,7 +207,7 @@ class PDOInsertionStrategy
$insertContactQuery = $this->connection->prepare( $insertContactQuery = $this->connection->prepare(
'INSERT INTO icinga_contacts (contact_object_id, alias) VALUES (?, ?);' 'INSERT INTO icinga_contacts (contact_object_id, alias) VALUES (?, ?);'
); );
$contacts = &$this->fixture->getContacts(); $contacts = $this->fixture->getContacts();
foreach($contacts as &$contact) { foreach($contacts as &$contact) {
$insertObjectQuery->execute($this->objectId, $contact["alias"]); $insertObjectQuery->execute($this->objectId, $contact["alias"]);
$insertContactQuery->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)'. 'INSERT INTO icinga_comments (object_id, comment_type, internal_comment_id, author_name, comment_data)'.
' VALUES (?, ?, ?, ?, ?);' ' VALUES (?, ?, ?, ?, ?);'
); );
$comments = &$this->fixture->getComments(); $comments = $this->fixture->getComments();
foreach ($comments as $comment) { foreach ($comments as $comment) {
if (isset($comment["host"])) { if (isset($comment["host"])) {
$type = 1; $type = 1;
@ -260,7 +260,7 @@ class PDOInsertionStrategy
$insertHostgroupMemberQuery = $this->connection->prepare( $insertHostgroupMemberQuery = $this->connection->prepare(
'INSERT INTO icinga_hostgroup_members (hostgroup_id, host_object_id) VALUES (?, ?)' 'INSERT INTO icinga_hostgroup_members (hostgroup_id, host_object_id) VALUES (?, ?)'
); );
$hostgroups = &$this->fixture->getHostgroups(); $hostgroups = $this->fixture->getHostgroups();
foreach ($hostgroups as &$hostgroup) { foreach ($hostgroups as &$hostgroup) {
$insertObjectQuery->execute(array($this->objectId, $hostgroup["name"])); $insertObjectQuery->execute(array($this->objectId, $hostgroup["name"]));
@ -289,7 +289,7 @@ class PDOInsertionStrategy
$insertServicegroupMemberQuery = $this->connection->prepare( $insertServicegroupMemberQuery = $this->connection->prepare(
'INSERT INTO icinga_servicegroup_members (servicegroup_id, service_object_id) VALUES (?, ?)' 'INSERT INTO icinga_servicegroup_members (servicegroup_id, service_object_id) VALUES (?, ?)'
); );
$servicegroups = &$this->fixture->getServicegroups(); $servicegroups = $this->fixture->getServicegroups();
foreach ($servicegroups as &$servicegroup) { foreach ($servicegroups as &$servicegroup) {
$insertObjectQuery->execute(array($this->objectId, $servicegroup["name"])); $insertObjectQuery->execute(array($this->objectId, $servicegroup["name"]));

View File

@ -146,22 +146,9 @@ define servicegroup {
*/ */
public function testRuntimeParsingForBigFile() public function testRuntimeParsingForBigFile()
{ {
$this->markTestSkipped('Skipped slow tests'); //$this->markTestSkipped('Skipped slow tests');
$objects = fopen("res/status/objects.cache","r"); $objects = fopen("./res/status/icinga.objects.cache","r");
$status = fopen("res/status/status.big.dat","r"); $status = fopen("./res/status/icinga.status.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");
$testParser = new Parser($objects); $testParser = new Parser($objects);
$testParser->parseObjectsFile(); $testParser->parseObjectsFile();
$testParser->parseRuntimeState($status); $testParser->parseRuntimeState($status);