services_critical_last_state_change_unhandled): ?>
= $this->translate('CRITICAL'); ?>
@@ -84,7 +84,7 @@
|
- = $h->services_total; ?>
+ = $this->qlink($h->services_total, 'monitoring/list/services', array('hostgroup' => $h->hostgroup)) ?>
|
services_ok): ?>
diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php
index 72df4e73f..f34b4b0f5 100644
--- a/modules/monitoring/configuration.php
+++ b/modules/monitoring/configuration.php
@@ -47,8 +47,8 @@ $this->providePermission(
$this->translate('Allow processing host and service check results')
);
$this->providePermission(
- 'monitoring/command/feature/program',
- $this->translate('Allow processing commands for toggling features on a program-wide basis')
+ 'monitoring/command/feature/instance',
+ $this->translate('Allow processing commands for toggling features on an instance-wide basis')
);
$this->providePermission(
'monitoring/command/feature/object',
@@ -87,29 +87,36 @@ $this->provideSearchUrl($this->translate('Servicegroups'), 'monitoring/list/serv
* Problems Section
*/
$section = $this->menuSection($this->translate('Problems'), array(
- 'renderer' => 'ProblemMenuItemRenderer',
- 'icon' => 'block',
- 'priority' => 20
+ 'renderer' => 'ProblemMenuItemRenderer',
+ 'icon' => 'block',
+ 'priority' => 20
));
$section->add($this->translate('Unhandled Hosts'), array(
- 'renderer' => 'UnhandledHostMenuItemRenderer',
- 'url' => 'monitoring/list/hosts?host_problem=1&host_handled=0',
- 'priority' => 40
+ 'renderer' => 'UnhandledHostMenuItemRenderer',
+ 'url' => 'monitoring/list/hosts?host_problem=1&host_handled=0',
+ 'priority' => 30
));
$section->add($this->translate('Unhandled Services'), array(
- 'renderer' => 'UnhandledServiceMenuItemRenderer',
- 'url' => 'monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity',
- 'priority' => 40
+ 'renderer' => 'UnhandledServiceMenuItemRenderer',
+ 'url' => 'monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity',
+ 'priority' => 40
));
$section->add($this->translate('Host Problems'), array(
- 'url' => 'monitoring/list/hosts?host_problem=1&sort=host_severity',
- 'priority' => 50
+ 'url' => 'monitoring/list/hosts?host_problem=1&sort=host_severity',
+ 'priority' => 50
));
$section->add($this->translate('Service Problems'), array(
- 'url' => 'monitoring/list/services?service_problem=1&sort=service_severity&dir=desc',
- 'priority' => 50
+ 'url' => 'monitoring/list/services?service_problem=1&sort=service_severity&dir=desc',
+ 'priority' => 60
+));
+$section->add($this->translate('Service Grid'), array(
+ 'url' => 'monitoring/list/servicegrid?service_problem=1',
+ 'priority' => 70
+));
+$section->add($this->translate('Current Downtimes'), array(
+ 'url' => 'monitoring/list/downtimes?downtime_is_in_effect=1',
+ 'priority' => 80
));
-$section->add($this->translate('Current Downtimes'))->setUrl('monitoring/list/downtimes?downtime_is_in_effect=1');
/*
* Overview Section
@@ -130,10 +137,6 @@ $section->add($this->translate('Services'), array(
'url' => 'monitoring/list/services',
'priority' => 50
));
-$section->add($this->translate('Service Grid'), array(
- 'url' => 'monitoring/list/servicegrid?service_problem=1',
- 'priority' => 51
-));
$section->add($this->translate('Servicegroups'), array(
'url' => 'monitoring/list/servicegroups',
'priority' => 60
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php
index 0cc807ac8..cd7d0aef7 100644
--- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php
+++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php
@@ -518,31 +518,35 @@ class StatusQuery extends IdoQuery
protected function joinServiceproblemsummary()
{
- $sub = new Zend_Db_Expr('(SELECT'
- . ' SUM(CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 0 ELSE 1 END) AS unhandled_services_count,'
- . ' SUM(CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0 THEN 1 ELSE 0 END) AS handled_services_count,'
- . ' s.host_object_id FROM icinga_servicestatus ss'
- . ' JOIN icinga_services s'
- . ' ON s.service_object_id = ss.service_object_id'
- . ' AND ss.current_state > 0'
- . ' JOIN icinga_hoststatus hs'
- . ' ON hs.host_object_id = s.host_object_id'
- . ' GROUP BY s.host_object_id)');
+ $select = <<<'SQL'
+SELECT
+ SUM(
+ CASE WHEN(ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) > 0
+ THEN 0
+ ELSE 1
+ END
+ ) AS unhandled_services_count,
+ SUM(
+ CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0) ) > 0
+ THEN 1
+ ELSE 0
+ END
+ ) AS handled_services_count,
+ s.host_object_id
+FROM
+ icinga_servicestatus ss
+ JOIN icinga_objects o ON o.object_id = ss.service_object_id
+ JOIN icinga_services s ON s.service_object_id = o.object_id
+ JOIN icinga_hoststatus hs ON hs.host_object_id = s.host_object_id
+WHERE
+ o.is_active = 1
+ AND o.objecttype_id = 2
+ AND ss.current_state > 0
+GROUP BY
+ s.host_object_id
+SQL;
$this->select->joinLeft(
- array('sps' => $sub),
- 'sps.host_object_id = hs.host_object_id',
- array()
- );
- return;
-
- $this->select->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'.
- ')')),
+ array('sps' => new Zend_Db_Expr('(' . $select . ')')),
'sps.host_object_id = hs.host_object_id',
array()
);
diff --git a/modules/monitoring/library/Monitoring/BackendStep.php b/modules/monitoring/library/Monitoring/BackendStep.php
index c0dc3d4ea..7f9fc11cf 100644
--- a/modules/monitoring/library/Monitoring/BackendStep.php
+++ b/modules/monitoring/library/Monitoring/BackendStep.php
@@ -7,7 +7,6 @@ namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
-use Icinga\File\Ini\IniWriter;
class BackendStep extends Step
{
@@ -38,11 +37,9 @@ class BackendStep extends Step
);
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray($config),
- 'filename' => Config::resolvePath('modules/monitoring/backends.ini')
- ));
- $writer->write();
+ Config::fromArray($config)
+ ->setConfigFile(Config::resolvePath('modules/monitoring/backends.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->backendIniError = $e;
return false;
@@ -61,13 +58,7 @@ class BackendStep extends Step
try {
$config = Config::app('resources', true);
$config->setSection($resourceName, $resourceConfig);
-
- $writer = new IniWriter(array(
- 'config' => $config,
- 'filename' => Config::resolvePath('resources.ini'),
- 'filemode' => 0660
- ));
- $writer->write();
+ $config->saveIni();
} catch (Exception $e) {
$this->resourcesIniError = $e;
return false;
diff --git a/modules/monitoring/library/Monitoring/InstanceStep.php b/modules/monitoring/library/Monitoring/InstanceStep.php
index 2cb8d7d8d..ab54b6548 100644
--- a/modules/monitoring/library/Monitoring/InstanceStep.php
+++ b/modules/monitoring/library/Monitoring/InstanceStep.php
@@ -7,7 +7,6 @@ namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
-use Icinga\File\Ini\IniWriter;
class InstanceStep extends Step
{
@@ -27,11 +26,9 @@ class InstanceStep extends Step
unset($instanceConfig['name']);
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray(array($instanceName => $instanceConfig)),
- 'filename' => Config::resolvePath('modules/monitoring/instances.ini')
- ));
- $writer->write();
+ Config::fromArray(array($instanceName => $instanceConfig))
+ ->setConfigFile(Config::resolvePath('modules/monitoring/instances.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->error = $e;
return false;
diff --git a/modules/monitoring/library/Monitoring/MonitoringWizard.php b/modules/monitoring/library/Monitoring/MonitoringWizard.php
index d7a3671a4..68d686e21 100644
--- a/modules/monitoring/library/Monitoring/MonitoringWizard.php
+++ b/modules/monitoring/library/Monitoring/MonitoringWizard.php
@@ -4,14 +4,13 @@
namespace Icinga\Module\Monitoring;
-use Icinga\Application\Icinga;
+use Icinga\Application\Platform;
use Icinga\Web\Form;
use Icinga\Web\Wizard;
use Icinga\Web\Request;
use Icinga\Module\Setup\Setup;
use Icinga\Module\Setup\SetupWizard;
use Icinga\Module\Setup\Requirements;
-use Icinga\Module\Setup\Utils\MakeDirStep;
use Icinga\Module\Setup\Forms\SummaryPage;
use Icinga\Module\Monitoring\Forms\Setup\WelcomePage;
use Icinga\Module\Monitoring\Forms\Setup\BackendPage;
@@ -108,8 +107,6 @@ class MonitoringWizard extends Wizard implements SetupWizard
$pageData = $this->getPageData();
$setup = new Setup();
- $setup->addStep(new MakeDirStep(array(Icinga::app()->getConfigDir() . '/modules/monitoring'), 2770));
-
$setup->addStep(
new BackendStep(array(
'backendConfig' => $pageData['setup_monitoring_backend'],
@@ -139,6 +136,22 @@ class MonitoringWizard extends Wizard implements SetupWizard
*/
public function getRequirements()
{
- return new Requirements();
+ $requirements = new Requirements();
+
+ $requirements->addOptional(
+ 'existing_php_mod_sockets',
+ mt('monitoring', 'PHP Module: Sockets'),
+ mt(
+ 'monitoring',
+ 'In case it\'s desired that a TCP connection is being used by Icinga Web 2 to'
+ . ' access a Livestatus interface, the Sockets module for PHP is required.'
+ ),
+ Platform::extensionLoaded('sockets'),
+ Platform::extensionLoaded('sockets') ? mt('monitoring', 'The PHP Module sockets is available.') : (
+ mt('monitoring', 'The PHP Module sockets is not available.')
+ )
+ );
+
+ return $requirements;
}
}
diff --git a/modules/monitoring/library/Monitoring/SecurityStep.php b/modules/monitoring/library/Monitoring/SecurityStep.php
index 4a2c0f846..b3eda02c4 100644
--- a/modules/monitoring/library/Monitoring/SecurityStep.php
+++ b/modules/monitoring/library/Monitoring/SecurityStep.php
@@ -7,7 +7,6 @@ namespace Icinga\Module\Monitoring;
use Exception;
use Icinga\Module\Setup\Step;
use Icinga\Application\Config;
-use Icinga\File\Ini\IniWriter;
class SecurityStep extends Step
{
@@ -26,11 +25,9 @@ class SecurityStep extends Step
$config['security'] = $this->data['securityConfig'];
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray($config),
- 'filename' => Config::resolvePath('modules/monitoring/config.ini')
- ));
- $writer->write();
+ Config::fromArray($config)
+ ->setConfigFile(Config::resolvePath('modules/monitoring/config.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->error = $e;
return false;
diff --git a/modules/setup/library/Setup/Steps/AuthenticationStep.php b/modules/setup/library/Setup/Steps/AuthenticationStep.php
index ce0b49f58..c06b4e294 100644
--- a/modules/setup/library/Setup/Steps/AuthenticationStep.php
+++ b/modules/setup/library/Setup/Steps/AuthenticationStep.php
@@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use Icinga\Application\Config;
-use Icinga\File\Ini\IniWriter;
use Icinga\Data\ConfigObject;
use Icinga\Data\ResourceFactory;
use Icinga\Authentication\Backend\DbUserBackend;
@@ -50,11 +49,9 @@ class AuthenticationStep extends Step
}
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray($config),
- 'filename' => Config::resolvePath('authentication.ini')
- ));
- $writer->write();
+ Config::fromArray($config)
+ ->setConfigFile(Config::resolvePath('authentication.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->authIniError = $e;
return false;
@@ -73,11 +70,9 @@ class AuthenticationStep extends Step
);
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray($config),
- 'filename' => Config::resolvePath('permissions.ini')
- ));
- $writer->write();
+ Config::fromArray($config)
+ ->setConfigFile(Config::resolvePath('permissions.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->permIniError = $e;
return false;
diff --git a/modules/setup/library/Setup/Steps/GeneralConfigStep.php b/modules/setup/library/Setup/Steps/GeneralConfigStep.php
index 39c160628..bf3d8cb89 100644
--- a/modules/setup/library/Setup/Steps/GeneralConfigStep.php
+++ b/modules/setup/library/Setup/Steps/GeneralConfigStep.php
@@ -7,7 +7,6 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use Icinga\Application\Logger;
use Icinga\Application\Config;
-use Icinga\File\Ini\IniWriter;
use Icinga\Module\Setup\Step;
class GeneralConfigStep extends Step
@@ -35,11 +34,9 @@ class GeneralConfigStep extends Step
}
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray($config),
- 'filename' => Config::resolvePath('config.ini')
- ));
- $writer->write();
+ Config::fromArray($config)
+ ->setConfigFile(Config::resolvePath('config.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->error = $e;
return false;
diff --git a/modules/setup/library/Setup/Steps/ResourceStep.php b/modules/setup/library/Setup/Steps/ResourceStep.php
index c04cdbc79..aae1c3aca 100644
--- a/modules/setup/library/Setup/Steps/ResourceStep.php
+++ b/modules/setup/library/Setup/Steps/ResourceStep.php
@@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use Icinga\Application\Config;
-use Icinga\File\Ini\IniWriter;
use Icinga\Module\Setup\Step;
class ResourceStep extends Step
@@ -38,12 +37,9 @@ class ResourceStep extends Step
}
try {
- $writer = new IniWriter(array(
- 'config' => Config::fromArray($resourceConfig),
- 'filename' => Config::resolvePath('resources.ini'),
- 'filemode' => 0660
- ));
- $writer->write();
+ Config::fromArray($resourceConfig)
+ ->setConfigFile(Config::resolvePath('resources.ini'))
+ ->saveIni();
} catch (Exception $e) {
$this->error = $e;
return false;
diff --git a/modules/setup/library/Setup/Utils/MakeDirStep.php b/modules/setup/library/Setup/Utils/MakeDirStep.php
index d7813541b..b758ccd79 100644
--- a/modules/setup/library/Setup/Utils/MakeDirStep.php
+++ b/modules/setup/library/Setup/Utils/MakeDirStep.php
@@ -16,12 +16,12 @@ class MakeDirStep extends Step
/**
* @param array $paths
- * @param int $dirmode Directory mode in octal notation
+ * @param int $dirmode
*/
public function __construct($paths, $dirmode)
{
$this->paths = $paths;
- $this->dirmode = octdec((string) $dirmode);
+ $this->dirmode = $dirmode;
$this->errors = array();
}
diff --git a/modules/setup/library/Setup/WebWizard.php b/modules/setup/library/Setup/WebWizard.php
index 8ae7344ea..b580101ed 100644
--- a/modules/setup/library/Setup/WebWizard.php
+++ b/modules/setup/library/Setup/WebWizard.php
@@ -334,18 +334,6 @@ class WebWizard extends Wizard implements SetupWizard
);
}
- $configDir = Icinga::app()->getConfigDir();
- $setup->addStep(
- new MakeDirStep(
- array(
- $configDir . DIRECTORY_SEPARATOR . 'modules',
- $configDir . DIRECTORY_SEPARATOR . 'preferences',
- $configDir . DIRECTORY_SEPARATOR . 'enabledModules'
- ),
- 2770
- )
- );
-
foreach ($this->getWizards() as $wizard) {
if ($wizard->isComplete()) {
$setup->addSteps($wizard->getSetup()->getSteps());
diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js
index 31a0d10a8..1a8aadca5 100644
--- a/public/js/icinga/loader.js
+++ b/public/js/icinga/loader.js
@@ -24,8 +24,6 @@
this.failureNotice = null;
- this.exception = null;
-
/**
* Pending requests
*/
@@ -109,7 +107,8 @@
url : url,
data : data,
headers: headers,
- context: self
+ context: self,
+ failure: false
});
req.$target = $target;
@@ -313,15 +312,12 @@
onResponse: function (data, textStatus, req) {
var self = this;
if (this.failureNotice !== null) {
- this.failureNotice.remove();
+ if (! this.failureNotice.hasClass('fading-out')) {
+ this.failureNotice.remove();
+ }
this.failureNotice = null;
}
- if (this.exception !== null) {
- this.exception.remove();
- this.exception = null;
- }
-
// Remove 'impact' class if there was such
if (req.$target.hasClass('impact')) {
req.$target.removeClass('impact');
@@ -346,42 +342,11 @@
var rendered = false;
var classes;
- if (! req.autorefresh) {
- // TODO: Hook for response/url?
- var $forms = $('[action="' + this.icinga.utils.parseUrl(url).path + '"]');
- var $matches = $.merge($('[href="' + url + '"]'), $forms);
- $matches.each(function (idx, el) {
- if ($(el).closest('#menu').length) {
- if (req.$target[0].id === 'col1') {
- self.icinga.behaviors.navigation.resetActive();
- }
- } else if ($(el).closest('table.action').length) {
- $(el).closest('table.action').find('.active').removeClass('active');
- }
- });
-
- $matches.each(function (idx, el) {
- var $el = $(el);
- if ($el.closest('#menu').length) {
- if ($el.is('form')) {
- $('input', $el).addClass('active');
- } else {
- if (req.$target[0].id === 'col1') {
- self.icinga.behaviors.navigation.setActive($el);
- }
- }
- // Interrupt .each, only on menu item shall be active
- return false;
- } else if ($(el).closest('table.action').length) {
- $el.addClass('active');
- }
- });
- } else {
+ if (req.autorefresh) {
// TODO: next container url
active = $('[href].active', req.$target).attr('href');
}
-
var target = req.getResponseHeader('X-Icinga-Container');
var newBody = false;
var oldNotifications = false;
@@ -555,10 +520,43 @@
* Regardless of whether a request succeeded of failed, clean up
*/
onComplete: function (req, textStatus) {
+ if (! req.autorefresh) {
+ // TODO: Hook for response/url?
+ var url = req.url;
+ var $forms = $('[action="' + this.icinga.utils.parseUrl(url).path + '"]');
+ var $matches = $.merge($('[href="' + url + '"]'), $forms);
+ $matches.each(function (idx, el) {
+ if ($(el).closest('#menu').length) {
+ if (req.$target[0].id === 'col1') {
+ self.icinga.behaviors.navigation.resetActive();
+ }
+ } else if ($(el).closest('table.action').length) {
+ $(el).closest('table.action').find('.active').removeClass('active');
+ }
+ });
+
+ $matches.each(function (idx, el) {
+ var $el = $(el);
+ if ($el.closest('#menu').length) {
+ if ($el.is('form')) {
+ $('input', $el).addClass('active');
+ } else {
+ if (req.$target[0].id === 'col1') {
+ self.icinga.behaviors.navigation.setActive($el);
+ }
+ }
+ // Interrupt .each, only on menu item shall be active
+ return false;
+ } else if ($(el).closest('table.action').length) {
+ $el.addClass('active');
+ }
+ });
+ }
+
// Update history when necessary. Don't do so for requests triggered
// by history or autorefresh events
if (! req.historyTriggered && ! req.autorefresh) {
- if (req.$target.hasClass('container')) {
+ if (req.$target.hasClass('container') && req.failure === false) {
// We only want to care about top-level containers
if (req.$target.parent().closest('.container').length === 0) {
this.icinga.history.pushCurrentState();
@@ -594,18 +592,18 @@
onFailure: function (req, textStatus, errorThrown) {
var url = req.url;
- if (req.status === 500) {
- if (this.exception === null) {
- req.$target.addClass('impact');
+ req.failure = true;
- this.exception = this.createNotice(
- 'error',
- $('h1', $(req.responseText)).first().html(),
- true
- );
- this.icinga.ui.fixControls();
- }
- } else if (req.status > 0) {
+ /*
+ * Test if a manual actions comes in and autorefresh is active: Stop refreshing
+ */
+ if (! req.historyTriggered && ! req.autorefresh && req.$target.data('icingaRefresh') > 0
+ && req.$target.data('icingaUrl') !== url) {
+ req.$target.data('icingaRefresh', 0);
+ req.$target.data('icingaUrl', url);
+ }
+
+ if (req.status > 0) {
this.icinga.logger.error(
req.status,
errorThrown + ':',
@@ -617,9 +615,6 @@
req.action,
req.autorefresh
);
-
- // Header example:
- // Icinga.debug(req.getResponseHeader('X-Icinga-Redirect'));
} else {
if (errorThrown === 'abort') {
this.icinga.logger.debug(
@@ -660,7 +655,13 @@
var $notice = $(
'' + message + ''
).appendTo($('#notifications'));
+
this.icinga.ui.fixControls();
+
+ if (!persist) {
+ this.icinga.ui.fadeNotificationsAway();
+ }
+
return $notice;
},
@@ -721,11 +722,12 @@
// $container.html(content);
} else {
- if ($container.closest('.dashboard').length &&
- ! $('h1', $content).length
+ if ($container.closest('.dashboard').length
) {
- var title = $('h1', $container).first().detach();
- $('h1', $content).first().detach();
+ if (! $('h1', $content).length) {
+ var title = $('h1', $container).first().detach();
+ $('h1', $content).first().detach();
+ }
$container.html(title).append(content);
} else if (action === 'replace') {
$container.html(content);
|