Merge branch 'master' into feature/improve-chart-implementation-7841

This commit is contained in:
Matthias Jentsch 2015-01-19 15:15:24 +01:00
commit 4dfad963e9
80 changed files with 663 additions and 559 deletions
.puppet
hiera
modules
icingaweb2/manifests
pgsql/templates
profiles/icingaweb2_dev/manifests
application/forms
doc
icingaweb2.spec
library/Icinga
Application
File/Ini
Util
Web/View/helpers
modules
packages/files/config/modules

@ -5,3 +5,4 @@ icingaweb2::web_path: icingaweb2
icingaweb2::db_user: icingaweb2
icingaweb2::db_pass: icingaweb2
icingaweb2::db_name: icingaweb2
icingaweb2::group: icingaweb2

@ -1,14 +1,15 @@
class icingaweb2::config (
$config = hiera('icingaweb2::config')
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group')
) {
group { 'icingaweb':
group { $web_group:
ensure => present,
}
file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]:
ensure => directory,
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => '2770',
}
}

@ -1,14 +1,15 @@
define icingaweb2::config::general (
$source,
$config = hiera('icingaweb2::config'),
$replace = true
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group'),
$replace = true
) {
include icingaweb2::config
file { "${config}/${name}.ini":
content => template("${source}/${name}.ini.erb"),
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => 0660,
replace => $replace,
}

@ -1,8 +1,9 @@
define icingaweb2::config::module (
$module,
$source,
$config = hiera('icingaweb2::config'),
$replace = true
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group'),
$replace = true
) {
include icingaweb2::config
@ -10,7 +11,7 @@ define icingaweb2::config::module (
file { "${config}/modules/${module}":
ensure => directory,
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => '2770',
}
}
@ -18,7 +19,7 @@ define icingaweb2::config::module (
file { "${config}/modules/${module}/${name}.ini":
source => "${source}/modules/${module}/${name}.ini",
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => 0660,
replace => $replace,
}

@ -71,6 +71,11 @@ local icinga icinga trust
host icinga icinga 127.0.0.1/32 trust
host icinga icinga ::1/128 trust
# icinga2
local icinga2 icinga2 trust
host icinga2 icinga2 127.0.0.1/32 trust
host icinga2 icinga2 ::1/128 trust
# icinga_unittest
local icinga_unittest icinga_unittest trust
host icinga_unittest icinga_unittest 127.0.0.1/32 trust
@ -81,6 +86,11 @@ local icingaweb icingaweb trust
host icingaweb icingaweb 127.0.0.1/32 trust
host icingaweb icingaweb ::1/128 trust
# icingaweb2
local <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> trust
host <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> 127.0.0.1/32 trust
host <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> ::1/128 trust
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:

@ -1,10 +1,11 @@
class icingaweb2_dev (
$config = hiera('icingaweb2::config'),
$log = hiera('icingaweb2::log'),
$web_path = hiera('icingaweb2::web_path'),
$db_user = hiera('icingaweb2::db_user'),
$db_pass = hiera('icingaweb2::db_pass'),
$db_name = hiera('icingaweb2::db_name'),
$config = hiera('icingaweb2::config'),
$log = hiera('icingaweb2::log'),
$web_path = hiera('icingaweb2::web_path'),
$db_user = hiera('icingaweb2::db_user'),
$db_pass = hiera('icingaweb2::db_pass'),
$db_name = hiera('icingaweb2::db_name'),
$web_group = hiera('icingaweb2::group'),
) {
include apache
include php
@ -28,7 +29,7 @@ class icingaweb2_dev (
Exec { path => '/usr/local/bin:/usr/bin:/bin' }
# TODO(el): Enabling/disabling modules should be a resource
User <| alias == apache |> { groups +> 'icingaweb' }
User <| alias == apache |> { groups +> $web_group }
-> exec { 'enable-monitoring-module':
command => 'icingacli module enable monitoring',
user => 'apache',
@ -50,7 +51,7 @@ class icingaweb2_dev (
file { $log_dir:
ensure => directory,
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => '2775'
}

@ -18,7 +18,7 @@ class LoginForm extends Form
public function init()
{
$this->setName('form_login');
$this->setSubmitLabel(t('Login'));
$this->setSubmitLabel($this->translate('Login'));
}
/**
@ -31,8 +31,8 @@ class LoginForm extends Form
'username',
array(
'required' => true,
'label' => t('Username'),
'placeholder' => t('Please enter your username...'),
'label' => $this->translate('Username'),
'placeholder' => $this->translate('Please enter your username...'),
'class' => false === isset($formData['username']) ? 'autofocus' : ''
)
);
@ -41,8 +41,8 @@ class LoginForm extends Form
'password',
array(
'required' => true,
'label' => t('Password'),
'placeholder' => t('...and your password'),
'label' => $this->translate('Password'),
'placeholder' => $this->translate('...and your password'),
'class' => isset($formData['username']) ? 'autofocus' : ''
)
);

@ -30,8 +30,8 @@ class AutologinBackendForm extends Form
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t(
'label' => $this->translate('Backend Name'),
'description' => $this->translate(
'The name of this authentication provider that is used to differentiate it from others'
),
'validators' => array(
@ -52,8 +52,8 @@ class AutologinBackendForm extends Form
'text',
'strip_username_regexp',
array(
'label' => t('Filter Pattern'),
'description' => t(
'label' => $this->translate('Filter Pattern'),
'description' => $this->translate(
'The regular expression to use to strip specific parts off from usernames.'
. ' Leave empty if you do not want to strip off anything'
),

@ -53,8 +53,8 @@ class DbBackendForm extends Form
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t(
'label' => $this->translate('Backend Name'),
'description' => $this->translate(
'The name of this authentication provider that is used to differentiate it from others'
),
)
@ -64,8 +64,10 @@ class DbBackendForm extends Form
'resource',
array(
'required' => true,
'label' => t('Database Connection'),
'description' => t('The database connection to use for authenticating with this provider'),
'label' => $this->translate('Database Connection'),
'description' => $this->translate(
'The database connection to use for authenticating with this provider'
),
'multiOptions' => false === empty($this->resources)
? array_combine($this->resources, $this->resources)
: array()
@ -107,11 +109,11 @@ class DbBackendForm extends Form
try {
$dbUserBackend = new DbUserBackend(ResourceFactory::createResource($form->getResourceConfig()));
if ($dbUserBackend->count() < 1) {
$form->addError(t('No users found under the specified database backend'));
$form->addError($form->translate('No users found under the specified database backend'));
return false;
}
} catch (Exception $e) {
$form->addError(sprintf(t('Using the specified backend failed: %s'), $e->getMessage()));
$form->addError(sprintf($form->translate('Using the specified backend failed: %s'), $e->getMessage()));
return false;
}

@ -54,8 +54,8 @@ class LdapBackendForm extends Form
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t(
'label' => $this->translate('Backend Name'),
'description' => $this->translate(
'The name of this authentication provider that is used to differentiate it from others'
)
)
@ -65,8 +65,8 @@ class LdapBackendForm extends Form
'resource',
array(
'required' => true,
'label' => t('LDAP Resource'),
'description' => t('The resource to use for authenticating with this provider'),
'label' => $this->translate('LDAP Resource'),
'description' => $this->translate('The resource to use for authenticating with this provider'),
'multiOptions' => false === empty($this->resources)
? array_combine($this->resources, $this->resources)
: array()
@ -77,8 +77,8 @@ class LdapBackendForm extends Form
'user_class',
array(
'required' => true,
'label' => t('LDAP User Object Class'),
'description' => t('The object class used for storing users on the ldap server'),
'label' => $this->translate('LDAP User Object Class'),
'description' => $this->translate('The object class used for storing users on the ldap server'),
'value' => 'inetOrgPerson'
)
);
@ -87,8 +87,10 @@ class LdapBackendForm extends Form
'user_name_attribute',
array(
'required' => true,
'label' => t('LDAP User Name Attribute'),
'description' => t('The attribute name used for storing the user name on the ldap server'),
'label' => $this->translate('LDAP User Name Attribute'),
'description' => $this->translate(
'The attribute name used for storing the user name on the ldap server'
),
'value' => 'uid'
)
);
@ -105,9 +107,11 @@ class LdapBackendForm extends Form
'base_dn',
array(
'required' => false,
'label' => t('Base DN'),
'description' => t('The path where users can be found on the ldap server. ' .
' Leave empty to select all users available on the specified resource.')
'label' => $this->translate('Base DN'),
'description' => $this->translate(
'The path where users can be found on the ldap server. Leave ' .
'empty to select all users available on the specified resource.'
)
)
);
return $this;
@ -146,7 +150,7 @@ class LdapBackendForm extends Form
$form->addError($e->getMessage());
return false;
} catch (Exception $e) {
$form->addError(sprintf(t('Unable to validate authentication: %s'), $e->getMessage()));
$form->addError(sprintf($form->translate('Unable to validate authentication: %s'), $e->getMessage()));
return false;
}

@ -31,7 +31,7 @@ class AuthenticationBackendConfigForm extends ConfigForm
public function init()
{
$this->setName('form_config_authbackend');
$this->setSubmitLabel(t('Save Changes'));
$this->setSubmitLabel($this->translate('Save Changes'));
}
/**
@ -70,7 +70,7 @@ class AuthenticationBackendConfigForm extends ConfigForm
} elseif ($type === 'autologin') {
$form = new AutologinBackendForm();
} else {
throw new InvalidArgumentException(sprintf(t('Invalid backend type "%s" provided'), $type));
throw new InvalidArgumentException(sprintf($this->translate('Invalid backend type "%s" provided'), $type));
}
return $form;
@ -91,9 +91,9 @@ class AuthenticationBackendConfigForm extends ConfigForm
{
$name = isset($values['name']) ? $values['name'] : '';
if (! $name) {
throw new InvalidArgumentException(t('Authentication backend name missing'));
throw new InvalidArgumentException($this->translate('Authentication backend name missing'));
} elseif ($this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Authentication backend already exists'));
throw new InvalidArgumentException($this->translate('Authentication backend already exists'));
}
unset($values['name']);
@ -114,11 +114,11 @@ class AuthenticationBackendConfigForm extends ConfigForm
public function edit($name, array $values)
{
if (! $name) {
throw new InvalidArgumentException(t('Old authentication backend name missing'));
throw new InvalidArgumentException($this->translate('Old authentication backend name missing'));
} elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) {
throw new InvalidArgumentException(t('New authentication backend name missing'));
throw new InvalidArgumentException($this->translate('New authentication backend name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Unknown authentication backend provided'));
throw new InvalidArgumentException($this->translate('Unknown authentication backend provided'));
}
$backendConfig = $this->config->getSection($name);
@ -144,9 +144,9 @@ class AuthenticationBackendConfigForm extends ConfigForm
public function remove($name)
{
if (! $name) {
throw new InvalidArgumentException(t('Authentication backend name missing'));
throw new InvalidArgumentException($this->translate('Authentication backend name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Unknown authentication backend provided'));
throw new InvalidArgumentException($this->translate('Unknown authentication backend provided'));
}
$backendConfig = $this->config->getSection($name);
@ -167,9 +167,9 @@ class AuthenticationBackendConfigForm extends ConfigForm
public function move($name, $position)
{
if (! $name) {
throw new InvalidArgumentException(t('Authentication backend name missing'));
throw new InvalidArgumentException($this->translate('Authentication backend name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Unknown authentication backend provided'));
throw new InvalidArgumentException($this->translate('Unknown authentication backend provided'));
}
$backendOrder = $this->config->keys();
@ -208,10 +208,10 @@ class AuthenticationBackendConfigForm extends ConfigForm
try {
if ($authBackend === null) { // create new backend
$this->add($this->getValues());
$message = t('Authentication backend "%s" has been successfully created');
$message = $this->translate('Authentication backend "%s" has been successfully created');
} else { // edit existing backend
$this->edit($authBackend, $this->getValues());
$message = t('Authentication backend "%s" has been successfully changed');
$message = $this->translate('Authentication backend "%s" has been successfully changed');
}
} catch (InvalidArgumentException $e) {
Notification::error($e->getMessage());
@ -237,11 +237,13 @@ class AuthenticationBackendConfigForm extends ConfigForm
$authBackend = $this->request->getQuery('auth_backend');
if ($authBackend !== null) {
if ($authBackend === '') {
throw new ConfigurationError(t('Authentication backend name missing'));
throw new ConfigurationError($this->translate('Authentication backend name missing'));
} elseif (! $this->config->hasSection($authBackend)) {
throw new ConfigurationError(t('Unknown authentication backend provided'));
throw new ConfigurationError($this->translate('Unknown authentication backend provided'));
} elseif ($this->config->getSection($authBackend)->backend === null) {
throw new ConfigurationError(sprintf(t('Backend "%s" has no `backend\' setting'), $authBackend));
throw new ConfigurationError(
sprintf($this->translate('Backend "%s" has no `backend\' setting'), $authBackend)
);
}
$configValues = $this->config->getSection($authBackend)->toArray();
@ -257,7 +259,7 @@ class AuthenticationBackendConfigForm extends ConfigForm
);
if (false === empty($autologinBackends)) {
throw new ConfigurationError(t('Could not find any resources for authentication'));
throw new ConfigurationError($this->translate('Could not find any resources for authentication'));
}
}
}
@ -276,8 +278,8 @@ class AuthenticationBackendConfigForm extends ConfigForm
array(
'order' => 0,
'ignore' => true,
'label' => t('Force Changes'),
'description' => t('Check this box to enforce changes without connectivity validation')
'label' => $this->translate('Force Changes'),
'description' => $this->translate('Check this box to enforce changes without connectivity validation')
)
);
}
@ -291,7 +293,7 @@ class AuthenticationBackendConfigForm extends ConfigForm
$backendType = isset($formData['type']) ? $formData['type'] : null;
if (isset($this->resources['db'])) {
$backendTypes['db'] = t('Database');
$backendTypes['db'] = $this->translate('Database');
}
if (isset($this->resources['ldap']) && ($backendType === 'ldap' || Platform::extensionLoaded('ldap'))) {
$backendTypes['ldap'] = 'LDAP';
@ -304,7 +306,7 @@ class AuthenticationBackendConfigForm extends ConfigForm
}
);
if ($backendType === 'autologin' || empty($autologinBackends)) {
$backendTypes['autologin'] = t('Autologin');
$backendTypes['autologin'] = $this->translate('Autologin');
}
if ($backendType === null) {
@ -318,8 +320,10 @@ class AuthenticationBackendConfigForm extends ConfigForm
'ignore' => true,
'required' => true,
'autosubmit' => true,
'label' => t('Backend Type'),
'description' => t('The type of the resource to use for this authenticaton provider'),
'label' => $this->translate('Backend Type'),
'description' => $this->translate(
'The type of the resource to use for this authenticaton provider'
),
'multiOptions' => $backendTypes
)
);

@ -52,7 +52,7 @@ class AuthenticationBackendReorderForm extends ConfigForm
try {
if ($configForm->move($backendName, $position)->save()) {
Notification::success(t('Authentication order updated!'));
Notification::success($this->translate('Authentication order updated!'));
} else {
return false;
}

@ -33,10 +33,10 @@ class ApplicationConfigForm extends Form
'text',
'global_module_path',
array(
'label' => t('Module Path'),
'label' => $this->translate('Module Path'),
'required' => true,
'value' => implode(':', Icinga::app()->getModuleManager()->getModuleDirs()),
'description' => t(
'description' => $this->translate(
'Contains the directories that will be searched for available modules, separated by '
. 'colons. Modules that don\'t exist in these directories can still be symlinked in '
. 'the module folder, but won\'t show up in the list of disabled modules.'
@ -50,11 +50,11 @@ class ApplicationConfigForm extends Form
array(
'required' => true,
'autosubmit' => true,
'label' => t('User Preference Storage Type'),
'label' => $this->translate('User Preference Storage Type'),
'multiOptions' => array(
'ini' => t('File System (INI Files)'),
'db' => t('Database'),
'null' => t('Don\'t Store Preferences')
'ini' => $this->translate('File System (INI Files)'),
'db' => $this->translate('Database'),
'null' => $this->translate('Don\'t Store Preferences')
)
)
);
@ -72,7 +72,7 @@ class ApplicationConfigForm extends Form
array(
'required' => true,
'multiOptions' => $backends,
'label' => t('Database Connection')
'label' => $this->translate('Database Connection')
)
);
}

@ -4,7 +4,6 @@
namespace Icinga\Forms\Config\General;
use Icinga\Application\Icinga;
use Icinga\Application\Logger;
use Icinga\Web\Form;
use Icinga\Web\Form\Validator\WritablePathValidator;
@ -31,12 +30,12 @@ class LoggingConfigForm extends Form
array(
'required' => true,
'autosubmit' => true,
'label' => t('Logging Type'),
'description' => t('The type of logging to utilize.'),
'label' => $this->translate('Logging Type'),
'description' => $this->translate('The type of logging to utilize.'),
'multiOptions' => array(
'syslog' => 'Syslog',
'file' => t('File', 'app.config.logging.type'),
'none' => t('None', 'app.config.logging.type')
'file' => $this->translate('File', 'app.config.logging.type'),
'none' => $this->translate('None', 'app.config.logging.type')
)
)
);
@ -47,13 +46,13 @@ class LoggingConfigForm extends Form
'logging_level',
array(
'required' => true,
'label' => t('Logging Level'),
'description' => t('The maximum logging level to emit.'),
'label' => $this->translate('Logging Level'),
'description' => $this->translate('The maximum logging level to emit.'),
'multiOptions' => array(
Logger::$levels[Logger::ERROR] => t('Error', 'app.config.logging.level'),
Logger::$levels[Logger::WARNING] => t('Warning', 'app.config.logging.level'),
Logger::$levels[Logger::INFO] => t('Information', 'app.config.logging.level'),
Logger::$levels[Logger::DEBUG] => t('Debug', 'app.config.logging.level')
Logger::$levels[Logger::ERROR] => $this->translate('Error', 'app.config.logging.level'),
Logger::$levels[Logger::WARNING] => $this->translate('Warning', 'app.config.logging.level'),
Logger::$levels[Logger::INFO] => $this->translate('Information', 'app.config.logging.level'),
Logger::$levels[Logger::DEBUG] => $this->translate('Debug', 'app.config.logging.level')
)
)
);
@ -65,8 +64,10 @@ class LoggingConfigForm extends Form
'logging_application',
array(
'required' => true,
'label' => t('Application Prefix'),
'description' => t('The name of the application by which to prefix syslog messages.'),
'label' => $this->translate('Application Prefix'),
'description' => $this->translate(
'The name of the application by which to prefix syslog messages.'
),
'value' => 'icingaweb2',
'validators' => array(
array(
@ -91,8 +92,8 @@ class LoggingConfigForm extends Form
// 'logging_facility',
// array(
// 'required' => true,
// 'label' => t('Facility'),
// 'description' => t('The syslog facility to utilize.'),
// 'label' => $this->translate('Facility'),
// 'description' => $this->translate('The syslog facility to utilize.'),
// 'multiOptions' => array(
// 'user' => 'LOG_USER'
// )
@ -104,8 +105,8 @@ class LoggingConfigForm extends Form
'logging_file',
array(
'required' => true,
'label' => t('File path'),
'description' => t('The full path to the log file to write messages to.'),
'label' => $this->translate('File path'),
'description' => $this->translate('The full path to the log file to write messages to.'),
'value' => '/var/log/icingaweb2/icingaweb2.log',
'validators' => array(new WritablePathValidator())
)

@ -20,7 +20,7 @@ class GeneralConfigForm extends ConfigForm
public function init()
{
$this->setName('form_config_general');
$this->setSubmitLabel(t('Save Changes'));
$this->setSubmitLabel($this->translate('Save Changes'));
}
/**
@ -52,7 +52,7 @@ class GeneralConfigForm extends ConfigForm
}
if ($this->save()) {
Notification::success(t('New configuration has successfully been stored'));
Notification::success($this->translate('New configuration has successfully been stored'));
} else {
return false;
}

@ -41,8 +41,8 @@ class DbResourceForm extends Form
'name',
array(
'required' => true,
'label' => t('Resource Name'),
'description' => t('The unique name of this resource')
'label' => $this->translate('Resource Name'),
'description' => $this->translate('The unique name of this resource')
)
);
$this->addElement(
@ -50,8 +50,8 @@ class DbResourceForm extends Form
'db',
array(
'required' => true,
'label' => t('Database Type'),
'description' => t('The type of SQL database'),
'label' => $this->translate('Database Type'),
'description' => $this->translate('The type of SQL database'),
'multiOptions' => $dbChoices
)
);
@ -60,8 +60,8 @@ class DbResourceForm extends Form
'host',
array (
'required' => true,
'label' => t('Host'),
'description' => t('The hostname of the database'),
'label' => $this->translate('Host'),
'description' => $this->translate('The hostname of the database'),
'value' => 'localhost'
)
);
@ -70,8 +70,8 @@ class DbResourceForm extends Form
'port',
array(
'required' => true,
'label' => t('Port'),
'description' => t('The port to use'),
'label' => $this->translate('Port'),
'description' => $this->translate('The port to use'),
'value' => 3306
)
);
@ -80,8 +80,8 @@ class DbResourceForm extends Form
'dbname',
array(
'required' => true,
'label' => t('Database Name'),
'description' => t('The name of the database to use')
'label' => $this->translate('Database Name'),
'description' => $this->translate('The name of the database to use')
)
);
$this->addElement(
@ -89,8 +89,8 @@ class DbResourceForm extends Form
'username',
array (
'required' => true,
'label' => t('Username'),
'description' => t('The user name to use for authentication')
'label' => $this->translate('Username'),
'description' => $this->translate('The user name to use for authentication')
)
);
$this->addElement(
@ -99,8 +99,8 @@ class DbResourceForm extends Form
array(
'required' => true,
'renderPassword' => true,
'label' => t('Password'),
'description' => t('The password to use for authentication')
'label' => $this->translate('Password'),
'description' => $this->translate('The password to use for authentication')
)
);
@ -132,7 +132,9 @@ class DbResourceForm extends Form
$resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
$resource->getConnection()->getConnection();
} catch (Exception $e) {
$form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
$form->addError(
$form->translate('Connectivity validation failed, connection to the given resource not possible.')
);
return false;
}

@ -30,8 +30,8 @@ class FileResourceForm extends Form
'name',
array(
'required' => true,
'label' => t('Resource Name'),
'description' => t('The unique name of this resource')
'label' => $this->translate('Resource Name'),
'description' => $this->translate('The unique name of this resource')
)
);
$this->addElement(
@ -39,8 +39,8 @@ class FileResourceForm extends Form
'filename',
array(
'required' => true,
'label' => t('Filepath'),
'description' => t('The filename to fetch information from'),
'label' => $this->translate('Filepath'),
'description' => $this->translate('The filename to fetch information from'),
'validators' => array(new ReadablePathValidator())
)
);
@ -49,8 +49,8 @@ class FileResourceForm extends Form
'fields',
array(
'required' => true,
'label' => t('Pattern'),
'description' => t('The regular expression by which to identify columns')
'label' => $this->translate('Pattern'),
'description' => $this->translate('The regular expression by which to identify columns')
)
);

@ -32,8 +32,8 @@ class LdapResourceForm extends Form
'name',
array(
'required' => true,
'label' => t('Resource Name'),
'description' => t('The unique name of this resource')
'label' => $this->translate('Resource Name'),
'description' => $this->translate('The unique name of this resource')
)
);
$this->addElement(
@ -41,8 +41,10 @@ class LdapResourceForm extends Form
'hostname',
array(
'required' => true,
'label' => t('Host'),
'description' => t('The hostname or address of the LDAP server to use for authentication'),
'label' => $this->translate('Host'),
'description' => $this->translate(
'The hostname or address of the LDAP server to use for authentication'
),
'value' => 'localhost'
)
);
@ -51,8 +53,8 @@ class LdapResourceForm extends Form
'port',
array(
'required' => true,
'label' => t('Port'),
'description' => t('The port of the LDAP server to use for authentication'),
'label' => $this->translate('Port'),
'description' => $this->translate('The port of the LDAP server to use for authentication'),
'value' => 389
)
);
@ -61,8 +63,10 @@ class LdapResourceForm extends Form
'root_dn',
array(
'required' => true,
'label' => t('Root DN'),
'description' => t('Only the root and its child nodes will be accessible on this resource.')
'label' => $this->translate('Root DN'),
'description' => $this->translate(
'Only the root and its child nodes will be accessible on this resource.'
)
)
);
$this->addElement(
@ -70,8 +74,8 @@ class LdapResourceForm extends Form
'bind_dn',
array(
'required' => true,
'label' => t('Bind DN'),
'description' => t('The user dn to use for querying the ldap server')
'label' => $this->translate('Bind DN'),
'description' => $this->translate('The user dn to use for querying the ldap server')
)
);
$this->addElement(
@ -80,8 +84,8 @@ class LdapResourceForm extends Form
array(
'required' => true,
'renderPassword' => true,
'label' => t('Bind Password'),
'description' => t('The password to use for querying the ldap server')
'label' => $this->translate('Bind Password'),
'description' => $this->translate('The password to use for querying the ldap server')
)
);
@ -119,7 +123,9 @@ class LdapResourceForm extends Form
throw new Exception();
}
} catch (Exception $e) {
$form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
$form->addError(
$form->translate('Connectivity validation failed, connection to the given resource not possible.')
);
return false;
}

@ -33,8 +33,8 @@ class LivestatusResourceForm extends Form
'name',
array(
'required' => true,
'label' => t('Resource Name'),
'description' => t('The unique name of this resource')
'label' => $this->translate('Resource Name'),
'description' => $this->translate('The unique name of this resource')
)
);
$this->addElement(
@ -42,8 +42,8 @@ class LivestatusResourceForm extends Form
'socket',
array(
'required' => true,
'label' => t('Socket'),
'description' => t('The path to your livestatus socket used for querying monitoring data'),
'label' => $this->translate('Socket'),
'description' => $this->translate('The path to your livestatus socket used for querying monitoring data'),
'value' => '/var/run/icinga2/cmd/livestatus'
)
);
@ -75,8 +75,10 @@ class LivestatusResourceForm extends Form
try {
$resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
$resource->connect()->disconnect();
} catch (Exception $e) {
$form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
} catch (Exception $_) {
$form->addError(
$form->translate('Connectivity validation failed, connection to the given resource not possible.')
);
return false;
}

@ -22,7 +22,7 @@ class ResourceConfigForm extends ConfigForm
public function init()
{
$this->setName('form_config_resource');
$this->setSubmitLabel(t('Save Changes'));
$this->setSubmitLabel($this->translate('Save Changes'));
}
/**
@ -43,7 +43,7 @@ class ResourceConfigForm extends ConfigForm
} elseif ($type === 'file') {
return new FileResourceForm();
} else {
throw new InvalidArgumentException(sprintf(t('Invalid resource type "%s" provided'), $type));
throw new InvalidArgumentException(sprintf($this->translate('Invalid resource type "%s" provided'), $type));
}
}
@ -62,9 +62,9 @@ class ResourceConfigForm extends ConfigForm
{
$name = isset($values['name']) ? $values['name'] : '';
if (! $name) {
throw new InvalidArgumentException(t('Resource name missing'));
throw new InvalidArgumentException($this->translate('Resource name missing'));
} elseif ($this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Resource already exists'));
throw new InvalidArgumentException($this->translate('Resource already exists'));
}
unset($values['name']);
@ -85,11 +85,11 @@ class ResourceConfigForm extends ConfigForm
public function edit($name, array $values)
{
if (! $name) {
throw new InvalidArgumentException(t('Old resource name missing'));
throw new InvalidArgumentException($this->translate('Old resource name missing'));
} elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) {
throw new InvalidArgumentException(t('New resource name missing'));
throw new InvalidArgumentException($this->translate('New resource name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Unknown resource provided'));
throw new InvalidArgumentException($this->translate('Unknown resource provided'));
}
$resourceConfig = $this->config->getSection($name);
@ -111,9 +111,9 @@ class ResourceConfigForm extends ConfigForm
public function remove($name)
{
if (! $name) {
throw new InvalidArgumentException(t('Resource name missing'));
throw new InvalidArgumentException($this->translate('Resource name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(t('Unknown resource provided'));
throw new InvalidArgumentException($this->translate('Unknown resource provided'));
}
$resourceConfig = $this->config->getSection($name);
@ -143,10 +143,10 @@ class ResourceConfigForm extends ConfigForm
try {
if ($resource === null) { // create new resource
$this->add($this->getValues());
$message = t('Resource "%s" has been successfully created');
$message = $this->translate('Resource "%s" has been successfully created');
} else { // edit existing resource
$this->edit($resource, $this->getValues());
$message = t('Resource "%s" has been successfully changed');
$message = $this->translate('Resource "%s" has been successfully changed');
}
} catch (InvalidArgumentException $e) {
Notification::error($e->getMessage());
@ -172,9 +172,9 @@ class ResourceConfigForm extends ConfigForm
$resource = $this->request->getQuery('resource');
if ($resource !== null) {
if ($resource === '') {
throw new ConfigurationError(t('Resource name missing'));
throw new ConfigurationError($this->translate('Resource name missing'));
} elseif (! $this->config->hasSection($resource)) {
throw new ConfigurationError(t('Unknown resource provided'));
throw new ConfigurationError($this->translate('Unknown resource provided'));
}
$configValues = $this->config->getSection($resource)->toArray();
@ -197,8 +197,8 @@ class ResourceConfigForm extends ConfigForm
array(
'order' => 0,
'ignore' => true,
'label' => t('Force Changes'),
'description' => t('Check this box to enforce changes without connectivity validation')
'label' => $this->translate('Force Changes'),
'description' => $this->translate('Check this box to enforce changes without connectivity validation')
)
);
}
@ -211,14 +211,14 @@ class ResourceConfigForm extends ConfigForm
$resourceType = isset($formData['type']) ? $formData['type'] : 'db';
$resourceTypes = array(
'file' => t('File'),
'file' => $this->translate('File'),
'livestatus' => 'Livestatus',
);
if ($resourceType === 'ldap' || Platform::extensionLoaded('ldap')) {
$resourceTypes['ldap'] = 'LDAP';
}
if ($resourceType === 'db' || Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$resourceTypes['db'] = t('SQL Database');
$resourceTypes['db'] = $this->translate('SQL Database');
}
$this->addElement(
@ -227,8 +227,8 @@ class ResourceConfigForm extends ConfigForm
array(
'required' => true,
'autosubmit' => true,
'label' => t('Resource Type'),
'description' => t('The type of resource'),
'label' => $this->translate('Resource Type'),
'description' => $this->translate('The type of resource'),
'multiOptions' => $resourceTypes,
'value' => $resourceType
)

@ -17,6 +17,6 @@ class ConfirmRemovalForm extends Form
public function init()
{
$this->setName('form_confirm_removal');
$this->setSubmitLabel(t('Confirm Removal'));
$this->setSubmitLabel($this->translate('Confirm Removal'));
}
}

@ -26,7 +26,7 @@ class DashletForm extends Form
{
$this->setName('form_dashboard_addurl');
if (! $this->getSubmitLabel()) {
$this->setSubmitLabel(t('Add To Dashboard'));
$this->setSubmitLabel($this->translate('Add To Dashboard'));
}
$this->setAction(URL::fromRequest());
}
@ -66,9 +66,10 @@ class DashletForm extends Form
'url',
array(
'required' => true,
'label' => t('Url'),
'description' =>
t('Enter url being loaded in the dashlet. You can paste the full URL, including filters.')
'label' => $this->translate('Url'),
'description' => $this->translate(
'Enter url being loaded in the dashlet. You can paste the full URL, including filters.'
)
)
);
$this->addElement(
@ -76,8 +77,8 @@ class DashletForm extends Form
'dashlet',
array(
'required' => true,
'label' => t('Dashlet Title'),
'description' => t('Enter a title for the dashlet.')
'label' => $this->translate('Dashlet Title'),
'description' => $this->translate('Enter a title for the dashlet.')
)
);
$this->addElement(
@ -95,9 +96,8 @@ class DashletForm extends Form
'pane',
array(
'required' => true,
'label' => t("New Dashboard Title"),
'description' =>
t('Enter a title for the new pane.')
'label' => $this->translate("New Dashboard Title"),
'description' => $this->translate('Enter a title for the new pane.')
)
);
} else {
@ -106,10 +106,9 @@ class DashletForm extends Form
'pane',
array(
'required' => true,
'label' => t('Dashboard'),
'label' => $this->translate('Dashboard'),
'multiOptions' => $panes,
'description' =>
t('Select a pane you want to add the dashlet.')
'description' => $this->translate('Select a pane you want to add the dashlet.')
)
);
}
@ -119,9 +118,9 @@ class DashletForm extends Form
'create_new_pane',
array(
'required' => false,
'label' => t('New dashboard'),
'label' => $this->translate('New dashboard'),
'class' => 'autosubmit',
'description' => t('Check this box if you want to add the dashlet to a new dashboard')
'description' => $this->translate('Check this box if you want to add the dashlet to a new dashboard')
)
);
}

@ -26,8 +26,8 @@ class LdapDiscoveryForm extends Form
'domain',
array(
'required' => true,
'label' => t('Search Domain'),
'description' => t('Search this domain for records of available servers.'),
'label' => $this->translate('Search Domain'),
'description' => $this->translate('Search this domain for records of available servers.'),
)
);
@ -36,7 +36,7 @@ class LdapDiscoveryForm extends Form
'note',
'additional_description',
array(
'value' => t('No Ldap servers found on this domain.'
'value' => $this->translate('No Ldap servers found on this domain.'
. ' You can try to specify host and port and try again, or just skip this step and '
. 'configure the server manually.'
)
@ -47,8 +47,8 @@ class LdapDiscoveryForm extends Form
'hostname',
array(
'required' => false,
'label' => t('Host'),
'description' => t('IP or host name to search.'),
'label' => $this->translate('Host'),
'description' => $this->translate('IP or host name to search.'),
)
);
@ -57,8 +57,8 @@ class LdapDiscoveryForm extends Form
'port',
array(
'required' => false,
'label' => t('Port'),
'description' => t('Port', 389),
'label' => $this->translate('Port'),
'description' => $this->translate('Port', 389),
)
);
}

@ -105,9 +105,9 @@ class PreferenceForm extends Form
try {
if ($this->getElement('btn_submit_preferences')->isChecked()) {
$this->save();
Notification::success(t('Preferences successfully saved'));
Notification::success($this->translate('Preferences successfully saved'));
} else {
Notification::success(t('Preferences successfully saved for the current session'));
Notification::success($this->translate('Preferences successfully saved for the current session'));
}
} catch (Exception $e) {
Logger::error($e);
@ -142,13 +142,13 @@ class PreferenceForm extends Form
public function createElements(array $formData)
{
$languages = array();
$languages['autodetect'] = sprintf(t('Browser (%s)', 'preferences.form'), $this->getLocale());
$languages['autodetect'] = sprintf($this->translate('Browser (%s)', 'preferences.form'), $this->getLocale());
foreach (Translator::getAvailableLocaleCodes() as $language) {
$languages[$language] = $language;
}
$tzList = array();
$tzList['autodetect'] = sprintf(t('Browser (%s)', 'preferences.form'), $this->getDefaultTimezone());
$tzList['autodetect'] = sprintf($this->translate('Browser (%s)', 'preferences.form'), $this->getDefaultTimezone());
foreach (DateTimeZone::listIdentifiers() as $tz) {
$tzList[$tz] = $tz;
}
@ -158,8 +158,8 @@ class PreferenceForm extends Form
'language',
array(
'required' => true,
'label' => t('Your Current Language'),
'description' => t('Use the following language to display texts and messages'),
'label' => $this->translate('Your Current Language'),
'description' => $this->translate('Use the following language to display texts and messages'),
'multiOptions' => $languages,
'value' => substr(setlocale(LC_ALL, 0), 0, 5)
)
@ -170,8 +170,8 @@ class PreferenceForm extends Form
'timezone',
array(
'required' => true,
'label' => t('Your Current Timezone'),
'description' => t('Use the following timezone for dates and times'),
'label' => $this->translate('Your Current Timezone'),
'description' => $this->translate('Use the following timezone for dates and times'),
'multiOptions' => $tzList,
'value' => $this->getDefaultTimezone()
)
@ -182,7 +182,7 @@ class PreferenceForm extends Form
'show_benchmark',
array(
'required' => true,
'label' => t('Use benchmark')
'label' => $this->translate('Use benchmark')
)
);
@ -191,7 +191,7 @@ class PreferenceForm extends Form
'btn_submit_preferences',
array(
'ignore' => true,
'label' => t('Save to the Preferences'),
'label' => $this->translate('Save to the Preferences'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'div'))
@ -204,7 +204,7 @@ class PreferenceForm extends Form
'btn_submit_session',
array(
'ignore' => true,
'label' => t('Save for the current Session'),
'label' => $this->translate('Save for the current Session'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'div'))

@ -72,8 +72,8 @@ class RoleForm extends ConfigForm
'name',
array(
'required' => true,
'label' => t('Role Name'),
'description' => t('The name of the role'),
'label' => $this->translate('Role Name'),
'description' => $this->translate('The name of the role'),
'ignore' => true
),
),
@ -81,24 +81,26 @@ class RoleForm extends ConfigForm
'textarea',
'users',
array(
'label' => t('Users'),
'description' => t('Comma-separated list of users that are assigned to the role')
'label' => $this->translate('Users'),
'description' => $this->translate('Comma-separated list of users that are assigned to the role')
),
),
array(
'textarea',
'groups',
array(
'label' => t('Groups'),
'description' => t('Comma-separated list of groups that are assigned to the role')
'label' => $this->translate('Groups'),
'description' => $this->translate('Comma-separated list of groups that are assigned to the role')
),
),
array(
'multiselect',
'permissions',
array(
'label' => t('Permissions Set'),
'description' => t('The permissions to grant. You may select more than one permission'),
'label' => $this->translate('Permissions Set'),
'description' => $this->translate(
'The permissions to grant. You may select more than one permission'
),
'multiOptions' => $this->providedPermissions
)
)
@ -133,7 +135,7 @@ class RoleForm extends ConfigForm
}
if (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf(
t('Can\'t load role \'%s\'. Role does not exist'),
$this->translate('Can\'t load role \'%s\'. Role does not exist'),
$name
));
}
@ -174,7 +176,7 @@ class RoleForm extends ConfigForm
}
if ($this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf(
t('Can\'t add role \'%s\'. Role already exists'),
$this->translate('Can\'t add role \'%s\'. Role already exists'),
$name
));
}
@ -200,7 +202,7 @@ class RoleForm extends ConfigForm
}
if (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf(
t('Can\'t remove role \'%s\'. Role does not exist'),
$this->translate('Can\'t remove role \'%s\'. Role does not exist'),
$name
));
}
@ -233,7 +235,7 @@ class RoleForm extends ConfigForm
} else {
if (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(sprintf(
t('Can\'t update role \'%s\'. Role does not exist'),
$this->translate('Can\'t update role \'%s\'. Role does not exist'),
$name
));
}

@ -6,7 +6,7 @@ system and distribution you are running. But it is also possible to install Icin
## <a id="installation-requirements"></a> Installing Requirements
* A web server, e.g. Apache or nginx
* PHP >= 5.3.0
* PHP >= 5.3.0 w/ gettext and OpenSSL support
* MySQL or PostgreSQL PHP libraries when using a database for authentication or storing user preferences into a database
* LDAP PHP library when using Active Directory or LDAP for authentication
* Icinga 1.x w/ Livestatus or IDO, Icinga 2 w/ Livestatus or IDO feature enabled
@ -38,25 +38,73 @@ git clone git://git.icinga.org/icingaweb2.git
Choose a target directory and move Icinga Web 2 there.
````
mv icingaweb2 /usr/share/icingaweb
mv icingaweb2 /usr/share/icingaweb2
````
**Step 3: Configuring the Web Server**
Use `icingacli` to generate web server configuration for either Apache or nginx.
*Apache*
Apache:
````
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb/public
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public
````
*nginx*
nginx:
````
./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb/public
./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
````
**Step 4: Web Setup**
**Step 4: Preparing Web Setup**
Because both web and CLI must have access to configuration and logs, permissions will be managed using a special
system group. The web server user and CLI user have to be added to this system group.
Add the system group `icingaweb2` in the first place.
Fedora, RHEL, CentOS, SLES and OpenSUSE:
````
groupadd -r icingaweb2
````
Debian and Ubuntu:
````
addgroup --system icingaweb2
````
Add your web server's user to the system group `icingaweb2`:
Fedora, RHEL and CentOS:
````
usermod -a -G icingaweb2 apache
````
SLES and OpenSUSE:
````
usermod -G icingaweb2 wwwrun
````
Debian and Ubuntu:
````
usermod -a -G icingaweb2 wwwrun
````
Use `icingacli` to create the configuration directory which defaults to **/etc/icingaweb2**:
````
./bin/icingacli setup config directory
````
When using the web setup you are required to authenticate using a token. In order to generate a token use the
`icingacli`:
````
./bin/icingacli setup token create
````
In case you do not remember the token you can show it using the `icingacli`:
````
./bin/icingacli setup token show
````
**Step 5: Web Setup**
Visit Icinga Web 2 in your browser and complete installation using the web setup.

@ -29,6 +29,20 @@ Packager: Icinga Team <info@icinga.org>
%endif
%endif
%if 0%{?suse_version}
%define wwwconfigdir %{_sysconfdir}/apache2/conf.d
%define wwwuser wwwrun
%define zend php5-ZendFramework
%if 0%{?suse_version} == 1110
%define php php53
Requires: apache2-mod_php53
%else
%define php php5
Requires: apache2-mod_php5
%endif
%endif
Requires(pre): shadow-utils
Requires: %{name}-common = %{version}-%{release}
Requires: php-Icinga = %{version}-%{release}
@ -50,6 +64,7 @@ Icinga Web 2
%define logdir %{_localstatedir}/log/%{name}
%define phpdir %{_datadir}/php
%define icingawebgroup icingaweb2
%define docsdir %{_datadir}/doc/%{name}
%package common
@ -61,21 +76,23 @@ Common files for Icinga Web 2 and the Icinga CLI
%package -n php-Icinga
Summary: Icinga Web 2 PHP library
Group: Development/Libraries
Requires: %{php} >= 5.3.0
Summary: Icinga Web 2 PHP library
Group: Development/Libraries
Requires: %{php} >= 5.3.0
%{?suse_version:Requires: %{php}-gettext %{php}-openssl}
%description -n php-Icinga
Icinga Web 2 PHP library
%package -n icingacli
Summary: Icinga CLI
Group: Applications/System
Requires: %{name}-common = %{version}-%{release}
Requires: php-Icinga = %{version}-%{release}
Requires: %{php_cli} >= 5.3.0
%{?rhel:Requires: bash-completion}
Summary: Icinga CLI
Group: Applications/System
Requires: %{name}-common = %{version}-%{release}
Requires: php-Icinga = %{version}-%{release}
%{?suse_version:Requires: %{php} >= 5.3.0}
%{?rhel:Requires: %{php_cli} >= 5.3.0}
%{?rhel:Requires: bash-completion}
%description -n icingacli
Icinga CLI
@ -154,7 +171,7 @@ Icinga Web 2 vendor library Zend
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir},%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{_datadir}/doc/%{name}}
mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir}/modules/setup,%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{docsdir}}
cp -prv application doc %{buildroot}/%{basedir}
cp -pv etc/bash_completion.d/icingacli %{buildroot}/%{_sysconfdir}/bash_completion.d/icingacli
cp -prv modules/{monitoring,setup} %{buildroot}/%{basedir}/modules
@ -164,11 +181,16 @@ cp -prv public/{css,img,js,error_norewrite.html} %{buildroot}/%{basedir}/public
cp -pv packages/files/apache/icingaweb2.conf %{buildroot}/%{wwwconfigdir}/icingaweb2.conf
cp -pv packages/files/bin/icingacli %{buildroot}/%{bindir}
cp -pv packages/files/public/index.php %{buildroot}/%{basedir}/public
cp -prv etc/schema %{buildroot}/%{_datadir}/doc/%{name}
cp -prv etc/schema %{buildroot}/%{docsdir}
cp -prv packages/files/config/modules/setup %{buildroot}/%{configdir}/modules/
%pre
getent group icingacmd >/dev/null || groupadd -r icingacmd
%if 0%{?suse_version}
usermod -G icingacmd,%{icingawebgroup} %{wwwuser}
%else
usermod -a -G icingacmd,%{icingawebgroup} %{wwwuser}
%endif
exit 0
%clean
@ -186,8 +208,10 @@ rm -rf %{buildroot}
%{basedir}/public
%{wwwconfigdir}/icingaweb2.conf
%attr(2775,root,%{icingawebgroup}) %dir %{logdir}
%{_datadir}/doc/%{name}
%docdir %{_datadir}/doc/%{name}
%{docsdir}
%docdir %{docsdir}
%attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules/setup
%attr(0660,root,%{icingawebgroup}) %config(noreplace) %{configdir}/modules/setup/config.ini
%pre common
@ -198,7 +222,8 @@ exit 0
%defattr(-,root,root)
%{basedir}/application/locale
%dir %{basedir}/modules
%attr(2770,root,%{icingawebgroup}) %config(noreplace) %{configdir}
%attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}
%attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules
%files -n php-Icinga

@ -279,7 +279,7 @@ class Config implements Countable, Iterator
*
* @param string $file The file to parse
*
* @throws NotReadableError When the file does not exist or cannot be read
* @throws NotReadableError When the file cannot be read
*/
public static function fromIni($file)
{
@ -292,7 +292,7 @@ class Config implements Countable, Iterator
$config = new static(new ConfigObject(parse_ini_file($filepath, true)));
$config->setConfigFile($filepath);
return $config;
} else {
} elseif (@file_exists($filepath)) {
throw new NotReadableError(t('Cannot read config file "%s". Permission denied'), $filepath);
}
@ -322,7 +322,7 @@ class Config implements Countable, Iterator
*/
public static function app($configname = 'config', $fromDisk = false)
{
if (!isset(self::$app[$configname]) || $fromDisk) {
if (! isset(self::$app[$configname]) || $fromDisk) {
self::$app[$configname] = static::fromIni(static::resolvePath($configname . '.ini'));
}
@ -341,12 +341,12 @@ class Config implements Countable, Iterator
*/
public static function module($modulename, $configname = 'config', $fromDisk = false)
{
if (!isset(self::$modules[$modulename])) {
if (! isset(self::$modules[$modulename])) {
self::$modules[$modulename] = array();
}
$moduleConfigs = self::$modules[$modulename];
if (!isset($moduleConfigs[$configname]) || $fromDisk) {
if (! isset($moduleConfigs[$configname]) || $fromDisk) {
$moduleConfigs[$configname] = static::fromIni(
static::resolvePath('modules/' . $modulename . '/' . $configname . '.ini')
);

@ -759,15 +759,15 @@ class Module
protected function registerAutoloader()
{
$moduleName = ucfirst($this->getName());
$moduleLibraryDir = $this->getLibDir(). '/'. $moduleName;
if (is_dir($this->getBaseDir()) && is_dir($this->getLibDir()) && is_dir($moduleLibraryDir)) {
if (is_dir($moduleLibraryDir)) {
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir);
if (is_dir($this->getFormDir())) {
$this->app->getLoader()->registerNamespace(
'Icinga\\Module\\' . $moduleName. '\\Forms',
$this->getFormDir()
);
}
}
$moduleFormDir = $this->getFormDir();
if (is_dir($moduleFormDir)) {
$this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir);
}
return $this;

@ -27,7 +27,7 @@ class IniWriter extends Zend_Config_Writer_FileAbstract
*
* @var int
*/
public static $fileMode = 0664;
public static $fileMode = 0660;
/**
* Create a new INI writer

@ -36,4 +36,22 @@ class String
{
return str_replace(' ', '', ucwords(str_replace($separator, ' ', strtolower($name))));
}
/**
* Add ellipsis when a string is longer than max length
*
* @param string $string
* @param int $maxLength
* @param string $ellipsis
*
* @return string
*/
public static function ellipsis($string, $maxLength, $ellipsis = '...')
{
if (strlen($string) > $maxLength) {
return substr($string, 0, $maxLength - strlen($ellipsis)) . $ellipsis;
}
return $string;
}
}

@ -0,0 +1,8 @@
<?php
namespace Icinga\Web\View;
use Icinga\Util\String;
$this->addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis = '...') {
return String::ellipsis($string, $maxLength, $ellipsis);
});

@ -64,8 +64,9 @@ class Monitoring_ProcessController extends Controller
'process_performance_data'
)
)
->getQuery()
->fetchRow();
->getQuery();
$this->handleFormatRequest($programStatus);
$programStatus = $programStatus->fetchRow();
if ($programStatus === false) {
return $this->render('not-running', true, null);
}

@ -21,7 +21,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm
*/
public function init()
{
$this->setSubmitLabel(mt('monitoring', 'Disable Notifications'));
$this->setSubmitLabel($this->translate('Disable Notifications'));
}
/**
@ -30,8 +30,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm
*/
public function getHelp()
{
return mt(
'monitoring',
return $this->translate(
'This command is used to disable host and service notifications for a specific time.'
);
}
@ -49,8 +48,8 @@ class DisableNotificationsExpireCommandForm extends CommandForm
'expire_time',
array(
'required' => true,
'label' => mt('monitoring', 'Expire Time'),
'description' => mt('monitoring', 'Set the expire time.'),
'label' => $this->translate('Expire Time'),
'description' => $this->translate('Set the expire time.'),
'value' => $expireTime
)
);
@ -67,7 +66,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm
$disableNotifications
->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp());
$this->getTransport($this->request)->send($disableNotifications);
Notification::success(mt('monitoring', 'Disabling host and service notifications..'));
Notification::success($this->translate('Disabling host and service notifications..'));
return true;
}
}

@ -61,13 +61,13 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
if ((bool) $this->status->notifications_enabled) {
$notificationDescription = sprintf(
'<a title="%s" href="%s" data-base-target="_next">%s</a>',
mt('monitoring', 'Disable notifications for a specific time on a program-wide basis'),
$this->translate('Disable notifications for a specific time on a program-wide basis'),
$this->getView()->href('monitoring/process/disable-notifications'),
mt('monitoring', 'Disable temporarily')
$this->translate('Disable temporarily')
);
} elseif ($this->status->disable_notif_expire_time) {
$notificationDescription = sprintf(
mt('monitoring', 'Notifications will be re-enabled in <strong>%s</strong>'),
$this->translate('Notifications will be re-enabled in <strong>%s</strong>'),
$this->getView()->timeUntil($this->status->disable_notif_expire_time)
);
} else {
@ -78,7 +78,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS,
array(
'label' => mt('monitoring', 'Active Host Checks Being Executed'),
'label' => $this->translate('Active Host Checks Being Executed'),
'autosubmit' => true
)
),
@ -86,7 +86,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS,
array(
'label' => mt('monitoring', 'Active Service Checks Being Executed'),
'label' => $this->translate('Active Service Checks Being Executed'),
'autosubmit' => true
)
),
@ -94,7 +94,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS,
array(
'label' => mt('monitoring', 'Event Handlers Enabled'),
'label' => $this->translate('Event Handlers Enabled'),
'autosubmit' => true
)
),
@ -102,7 +102,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION,
array(
'label' => mt('monitoring', 'Flap Detection Enabled'),
'label' => $this->translate('Flap Detection Enabled'),
'autosubmit' => true
)
),
@ -110,7 +110,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_NOTIFICATIONS,
array(
'label' => mt('monitoring', 'Notifications Enabled'),
'label' => $this->translate('Notifications Enabled'),
'autosubmit' => true,
'description' => $notificationDescription,
'decorators' => array(
@ -129,7 +129,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING,
array(
'label' => mt('monitoring', 'Obsessing Over Hosts'),
'label' => $this->translate('Obsessing Over Hosts'),
'autosubmit' => true
)
),
@ -137,7 +137,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING,
array(
'label' => mt('monitoring', 'Obsessing Over Services'),
'label' => $this->translate('Obsessing Over Services'),
'autosubmit' => true
)
),
@ -145,7 +145,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS,
array(
'label' => mt('monitoring', 'Passive Host Checks Being Accepted'),
'label' => $this->translate('Passive Host Checks Being Accepted'),
'autosubmit' => true
)
),
@ -153,7 +153,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS,
array(
'label' => mt('monitoring', 'Passive Service Checks Being Accepted'),
'label' => $this->translate('Passive Service Checks Being Accepted'),
'autosubmit' => true
)
),
@ -161,7 +161,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA,
array(
'label' => mt('monitoring', 'Performance Data Being Processed'),
'label' => $this->translate('Performance Data Being Processed'),
'autosubmit' => true
)
)
@ -198,7 +198,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
->setEnabled($enabled);
$this->getTransport($this->request)->send($toggleFeature);
}
Notification::success(mt('monitoring', 'Toggling feature..'));
Notification::success($this->translate('Toggling feature..'));
return true;
}
}

@ -31,8 +31,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
*/
public function getHelp()
{
return mt(
'monitoring',
return $this->translate(
'This command is used to acknowledge host or service problems. When a problem is acknowledged,'
. ' future notifications about problems are temporarily disabled until the host or service'
. ' recovers.'
@ -51,9 +50,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'comment',
array(
'required' => true,
'label' => mt('monitoring', 'Comment'),
'description' => mt(
'monitoring',
'label' => $this->translate('Comment'),
'description' => $this->translate(
'If you work with other administrators, you may find it useful to share information about the'
. ' the host or service that is having problems. Make sure you enter a brief description of'
. ' what you are doing.'
@ -64,9 +62,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'checkbox',
'persistent',
array(
'label' => mt('monitoring', 'Persistent Comment'),
'description' => mt(
'monitoring',
'label' => $this->translate('Persistent Comment'),
'description' => $this->translate(
'If you would like the comment to remain even when the acknowledgement is removed, check this'
. ' option.'
)
@ -76,8 +73,10 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'checkbox',
'expire',
array(
'label' => mt('monitoring', 'Use Expire Time'),
'description' => mt('monitoring', 'If the acknowledgement should expire, check this option.'),
'label' => $this->translate('Use Expire Time'),
'description' => $this->translate(
'If the acknowledgement should expire, check this option.'
),
'autosubmit' => true
)
)
@ -89,10 +88,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'dateTimePicker',
'expire_time',
array(
'label' => mt('monitoring', 'Expire Time'),
'label' => $this->translate('Expire Time'),
'value' => $expireTime,
'description' => mt(
'monitoring',
'description' => $this->translate(
'Enter the expire date and time for this acknowledgement here. Icinga will delete the'
. ' acknowledgement after this time expired.'
)
@ -114,10 +112,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'checkbox',
'sticky',
array(
'label' => mt('monitoring', 'Sticky Acknowledgement'),
'label' => $this->translate('Sticky Acknowledgement'),
'value' => true,
'description' => mt(
'monitoring',
'description' => $this->translate(
'If you want the acknowledgement to disable notifications until the host or service recovers,'
. ' check this option.'
)
@ -127,10 +124,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'checkbox',
'notify',
array(
'label' => mt('monitoring', 'Send Notification'),
'label' => $this->translate('Send Notification'),
'value' => true,
'description' => mt(
'monitoring',
'description' => $this->translate(
'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,'
. ' uncheck this option.'
)

@ -29,8 +29,7 @@ class AddCommentCommandForm extends ObjectsCommandForm
*/
public function getHelp()
{
return mt(
'monitoring',
return $this->translate(
'This command is used to add host or service comments.'
);
}
@ -47,9 +46,8 @@ class AddCommentCommandForm extends ObjectsCommandForm
'comment',
array(
'required' => true,
'label' => mt('monitoring', 'Comment'),
'description' => mt(
'monitoring',
'label' => $this->translate('Comment'),
'description' => $this->translate(
'If you work with other administrators, you may find it useful to share information about the'
. ' the host or service that is having problems. Make sure you enter a brief description of'
. ' what you are doing.'
@ -60,10 +58,9 @@ class AddCommentCommandForm extends ObjectsCommandForm
'checkbox',
'persistent',
array(
'label' => mt('monitoring', 'Persistent'),
'label' => $this->translate('Persistent'),
'value' => true,
'description' => mt(
'monitoring',
'description' => $this->translate(
'If you uncheck this option, the comment will automatically be deleted the next time Icinga is'
. ' restarted.'
)

@ -35,8 +35,8 @@ class CheckNowCommandForm extends ObjectsCommandForm
array(
'ignore' => true,
'type' => 'submit',
'value' => mt('monitoring', 'Check now'),
'label' => '<i class="icon-reschedule"></i> ' . mt('monitoring', 'Check now'),
'value' => $this->translate('Check now'),
'label' => '<i class="icon-reschedule"></i> ' . $this->translate('Check now'),
'decorators' => array('ViewHelper'),
'escape' => false,
'class' => 'link-like'

@ -55,7 +55,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
array(
'ignore' => true,
'label' => 'X',
'title' => mt('monitoring', 'Delete comment'),
'title' => $this->translate('Delete comment'),
'decorators' => array('ViewHelper')
)
);
@ -80,7 +80,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
if (! empty($redirect)) {
$this->setRedirectUrl($redirect);
}
Notification::success(mt('monitoring', 'Deleting comment..'));
Notification::success($this->translate('Deleting comment..'));
return true;
}
}

@ -55,7 +55,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
array(
'ignore' => true,
'label' => 'X',
'title' => mt('monitoring', 'Delete downtime'),
'title' => $this->translate('Delete downtime'),
'decorators' => array('ViewHelper')
)
);
@ -80,7 +80,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
if (! empty($redirect)) {
$this->setRedirectUrl($redirect);
}
Notification::success(mt('monitoring', 'Deleting downtime..'));
Notification::success($this->translate('Deleting downtime..'));
return true;
}
}

@ -29,8 +29,7 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
*/
public function getHelp()
{
return mt(
'monitoring',
return $this->translate(
'This command is used to submit passive host or service check results.'
);
}
@ -53,17 +52,17 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
'status',
array(
'required' => true,
'label' => mt('monitoring', 'Status'),
'description' => mt('monitoring', 'The state this check result should report'),
'label' => $this->translate('Status'),
'description' => $this->translate('The state this check result should report'),
'multiOptions' => $object->getType() === $object::TYPE_HOST ? array(
ProcessCheckResultCommand::HOST_UP => mt('monitoring', 'UP', 'icinga.state'),
ProcessCheckResultCommand::HOST_DOWN => mt('monitoring', 'DOWN', 'icinga.state'),
ProcessCheckResultCommand::HOST_UNREACHABLE => mt('monitoring', 'UNREACHABLE', 'icinga.state')
ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'),
ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state'),
ProcessCheckResultCommand::HOST_UNREACHABLE => $this->translate('UNREACHABLE', 'icinga.state')
) : array(
ProcessCheckResultCommand::SERVICE_OK => mt('monitoring', 'OK', 'icinga.state'),
ProcessCheckResultCommand::SERVICE_WARNING => mt('monitoring', 'WARNING', 'icinga.state'),
ProcessCheckResultCommand::SERVICE_CRITICAL => mt('monitoring', 'CRITICAL', 'icinga.state'),
ProcessCheckResultCommand::SERVICE_UNKNOWN => mt('monitoring', 'UNKNOWN', 'icinga.state')
ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'),
ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'),
ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'),
ProcessCheckResultCommand::SERVICE_UNKNOWN => $this->translate('UNKNOWN', 'icinga.state')
)
)
);
@ -72,8 +71,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
'output',
array(
'required' => true,
'label' => mt('monitoring', 'Output'),
'description' => mt('monitoring', 'The plugin output of this check result')
'label' => $this->translate('Output'),
'description' => $this->translate('The plugin output of this check result')
)
);
$this->addElement(
@ -81,9 +80,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm
'perfdata',
array(
'allowEmpty' => true,
'label' => mt('monitoring', 'Performance Data'),
'description' => mt(
'monitoring',
'label' => $this->translate('Performance Data'),
'description' => $this->translate(
'The performance data of this check result. Leave empty'
. ' if this check result has no performance data'
)

@ -24,9 +24,8 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm
'checkbox',
'all_services',
array(
'label' => mt('monitoring', 'All Services'),
'description' => mt(
'monitoring',
'label' => $this->translate('All Services'),
'description' => $this->translate(
'Schedule check for all services on the hosts and the hosts themselves.'
)
)

@ -27,9 +27,8 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
'checkbox',
'all_services',
array(
'label' => mt('monitoring', 'All Services'),
'description' => mt(
'monitoring',
'label' => $this->translate('All Services'),
'description' => $this->translate(
'Schedule downtime for all services on the hosts and the hosts themselves.'
)
)
@ -38,15 +37,14 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
'select',
'child_hosts',
array(
'label' => mt('monitoring', 'Child Hosts'),
'label' => $this->translate('Child Hosts'),
'required' => true,
'multiOptions' => array(
0 => mt('monitoring', 'Do nothing with child hosts'),
1 => mt('monitoring', 'Schedule triggered downtime for all child hosts'),
2 => mt('monitoring', 'Schedule non-triggered downtime for all child hosts')
0 => $this->translate('Do nothing with child hosts'),
1 => $this->translate('Schedule triggered downtime for all child hosts'),
2 => $this->translate('Schedule non-triggered downtime for all child hosts')
),
'description' => mt(
'monitoring',
'description' => $this->translate(
'Define what should be done with the child hosts of the hosts.'
)
)

@ -32,8 +32,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
*/
public function getHelp()
{
return mt(
'monitoring',
return $this->translate(
'This command is used to schedule the next check of hosts or services. Icinga will re-queue the'
. ' hosts or services to be checked at the time you specify.'
);
@ -52,8 +51,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
'note',
'command-info',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'This command is used to schedule the next check of hosts or services. Icinga will re-queue the'
. ' hosts or services to be checked at the time you specify.'
)
@ -64,8 +62,10 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
'check_time',
array(
'required' => true,
'label' => mt('monitoring', 'Check Time'),
'description' => mt('monitoring', 'Set the date and time when the check should be scheduled.'),
'label' => $this->translate('Check Time'),
'description' => $this->translate(
'Set the date and time when the check should be scheduled.'
),
'value' => $checkTime
)
),
@ -73,9 +73,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
'checkbox',
'force_check',
array(
'label' => mt('monitoring', 'Force Check'),
'description' => mt(
'monitoring',
'label' => $this->translate('Force Check'),
'description' => $this->translate(
'If you select this option, Icinga will force a check regardless of both what time the'
. ' scheduled check occurs and whether or not checks are enabled.'
)

@ -42,8 +42,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
*/
public function getHelp()
{
return mt(
'monitoring',
return $this->translate(
'This command is used to schedule host and service downtimes. During the specified downtime,'
. ' Icinga will not send notifications out about the hosts and services. When the scheduled'
. ' downtime expires, Icinga will send out notifications for the hosts and services as it'
@ -67,9 +66,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'comment',
array(
'required' => true,
'label' => mt('monitoring', 'Comment'),
'description' => mt(
'monitoring',
'label' => $this->translate('Comment'),
'description' => $this->translate(
'If you work with other administrators, you may find it useful to share information about the'
. ' the host or service that is having problems. Make sure you enter a brief description of'
. ' what you are doing.'
@ -81,8 +79,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'start',
array(
'required' => true,
'label' => mt('monitoring', 'Start Time'),
'description' => mt('monitoring', 'Set the start date and time for the downtime.'),
'label' => $this->translate('Start Time'),
'description' => $this->translate('Set the start date and time for the downtime.'),
'value' => $start
)
),
@ -91,8 +89,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'end',
array(
'required' => true,
'label' => mt('monitoring', 'End Time'),
'description' => mt('monitoring', 'Set the end date and time for the downtime.'),
'label' => $this->translate('End Time'),
'description' => $this->translate('Set the end date and time for the downtime.'),
'value' => $end
)
),
@ -102,17 +100,16 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
array(
'required' => true,
'autosubmit' => true,
'label' => mt('monitoring', 'Type'),
'description' => mt(
'monitoring',
'label' => $this->translate('Type'),
'description' => $this->translate(
'If you select the fixed option, the downtime will be in effect between the start and end'
. ' times you specify whereas a flexible downtime starts when the host or service enters a'
. ' problem state sometime between the start and end times you specified and lasts as long'
. ' as the duration time you enter. The duration fields do not apply for fixed downtimes.'
),
'multiOptions' => array(
self::FIXED => mt('monitoring', 'Fixed'),
self::FLEXIBLE => mt('monitoring', 'Flexible')
self::FIXED => $this->translate('Fixed'),
self::FLEXIBLE => $this->translate('Flexible')
),
'validators' => array(
array(
@ -141,7 +138,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'hours',
array(
'required' => true,
'label' => mt('monitoring', 'Hours'),
'label' => $this->translate('Hours'),
'value' => 2,
'min' => -1
)
@ -151,7 +148,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'minutes',
array(
'required' => true,
'label' => mt('monitoring', 'Minutes'),
'label' => $this->translate('Minutes'),
'value' => 0,
'min' => -1
)
@ -161,9 +158,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
array('hours', 'minutes'),
'duration',
array(
'legend' => mt('monitoring', 'Flexible Duration'),
'description' => mt(
'monitoring',
'legend' => $this->translate('Flexible Duration'),
'description' => $this->translate(
'Enter here the duration of the downtime. The downtime will be automatically deleted after this'
. ' time expired.'
),

@ -33,7 +33,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
'checkbox',
ToggleObjectFeatureCommand::FEATURE_ACTIVE_CHECKS,
array(
'label' => mt('monitoring', 'Active Checks'),
'label' => $this->translate('Active Checks'),
'autosubmit' => true
)
),
@ -41,7 +41,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
'checkbox',
ToggleObjectFeatureCommand::FEATURE_PASSIVE_CHECKS,
array(
'label' => mt('monitoring', 'Passive Checks'),
'label' => $this->translate('Passive Checks'),
'autosubmit' => true
)
),
@ -49,7 +49,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
'checkbox',
ToggleObjectFeatureCommand::FEATURE_OBSESSING,
array(
'label' => mt('monitoring', 'Obsessing'),
'label' => $this->translate('Obsessing'),
'autosubmit' => true
)
),
@ -57,7 +57,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
'checkbox',
ToggleObjectFeatureCommand::FEATURE_NOTIFICATIONS,
array(
'label' => mt('monitoring', 'Notifications'),
'label' => $this->translate('Notifications'),
'autosubmit' => true
)
),
@ -65,7 +65,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
'checkbox',
ToggleObjectFeatureCommand::FEATURE_EVENT_HANDLER,
array(
'label' => mt('monitoring', 'Event Handler'),
'label' => $this->translate('Event Handler'),
'autosubmit' => true
)
),
@ -73,7 +73,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
'checkbox',
ToggleObjectFeatureCommand::FEATURE_FLAP_DETECTION,
array(
'label' => mt('monitoring', 'Flap Detection'),
'label' => $this->translate('Flap Detection'),
'autosubmit' => true
)
)
@ -95,7 +95,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
$element = $this->getElement($feature);
$element->setChecked($object->{$feature});
if ((bool) $object->{$feature . '_changed'} === true) {
$element->setDescription(mt('monitoring', 'changed'));
$element->setDescription($this->translate('changed'));
}
}
return $this;
@ -120,7 +120,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
}
}
}
Notification::success(mt('monitoring', 'Toggling feature..'));
Notification::success($this->translate('Toggling feature..'));
return true;
}
}

@ -28,9 +28,9 @@ class LocalInstanceForm extends Form
'path',
array(
'required' => true,
'label' => mt('monitoring', 'Command File'),
'label' => $this->translate('Command File'),
'value' => '/var/run/icinga2/cmd/icinga2.cmd',
'description' => mt('monitoring', 'Path to the local Icinga command file')
'description' => $this->translate('Path to the local Icinga command file')
)
);
return $this;

@ -29,8 +29,8 @@ class RemoteInstanceForm extends Form
'host',
array(
'required' => true,
'label' => mt('monitoring', 'Host'),
'description' => mt('monitoring',
'label' => $this->translate('Host'),
'description' => $this->translate(
'Hostname or address of the remote Icinga instance'
)
)
@ -40,8 +40,8 @@ class RemoteInstanceForm extends Form
'port',
array(
'required' => true,
'label' => mt('monitoring', 'Port'),
'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'),
'label' => $this->translate('Port'),
'description' => $this->translate('SSH port to connect to on the remote Icinga instance'),
'value' => 22
)
),
@ -50,8 +50,8 @@ class RemoteInstanceForm extends Form
'user',
array(
'required' => true,
'label' => mt('monitoring', 'User'),
'description' => mt('monitoring',
'label' => $this->translate('User'),
'description' => $this->translate(
'User to log in as on the remote Icinga instance. Please note that key-based SSH login must be'
. ' possible for this user'
)
@ -62,9 +62,9 @@ class RemoteInstanceForm extends Form
'path',
array(
'required' => true,
'label' => mt('monitoring', 'Command File'),
'label' => $this->translate('Command File'),
'value' => '/var/run/icinga2/cmd/icinga2.cmd',
'description' => mt('monitoring', 'Path to the Icinga command file on the remote Icinga instance')
'description' => $this->translate('Path to the Icinga command file on the remote Icinga instance')
)
)
));

@ -25,7 +25,7 @@ class InstanceConfigForm extends ConfigForm
public function init()
{
$this->setName('form_config_monitoring_instance');
$this->setSubmitLabel(mt('monitoring', 'Save Changes'));
$this->setSubmitLabel($this->translate('Save Changes'));
}
/**
@ -48,7 +48,7 @@ class InstanceConfigForm extends ConfigForm
break;
default:
throw new InvalidArgumentException(
sprintf(mt('monitoring', 'Invalid instance type "%s" given'), $type)
sprintf($this->translate('Invalid instance type "%s" given'), $type)
);
}
return $form;
@ -69,10 +69,10 @@ class InstanceConfigForm extends ConfigForm
{
$name = isset($values['name']) ? $values['name'] : '';
if (! $name) {
throw new InvalidArgumentException(mt('monitoring', 'Instance name missing'));
throw new InvalidArgumentException($this->translate('Instance name missing'));
}
if ($this->config->hasSection($name)) {
throw new InvalidArgumentException(mt('monitoring', 'Instance already exists'));
throw new InvalidArgumentException($this->translate('Instance already exists'));
}
unset($values['name']);
@ -93,11 +93,11 @@ class InstanceConfigForm extends ConfigForm
public function edit($name, array $values)
{
if (! $name) {
throw new InvalidArgumentException(mt('monitoring', 'Old instance name missing'));
throw new InvalidArgumentException($this->translate('Old instance name missing'));
} elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) {
throw new InvalidArgumentException(mt('monitoring', 'New instance name missing'));
throw new InvalidArgumentException($this->translate('New instance name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided'));
throw new InvalidArgumentException($this->translate('Unknown instance name provided'));
}
unset($values['name']);
@ -117,9 +117,9 @@ class InstanceConfigForm extends ConfigForm
public function remove($name)
{
if (! $name) {
throw new InvalidArgumentException(mt('monitoring', 'Instance name missing'));
throw new InvalidArgumentException($this->translate('Instance name missing'));
} elseif (! $this->config->hasSection($name)) {
throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided'));
throw new InvalidArgumentException($this->translate('Unknown instance name provided'));
}
$instanceConfig = $this->config->getSection($name);
@ -136,10 +136,10 @@ class InstanceConfigForm extends ConfigForm
$instanceName = $this->request->getQuery('instance');
if ($instanceName !== null) {
if (! $instanceName) {
throw new ConfigurationError(mt('monitoring', 'Instance name missing'));
throw new ConfigurationError($this->translate('Instance name missing'));
}
if (! $this->config->hasSection($instanceName)) {
throw new ConfigurationError(mt('monitoring', 'Unknown instance name given'));
throw new ConfigurationError($this->translate('Unknown instance name given'));
}
$instanceConfig = $this->config->getSection($instanceName)->toArray();
@ -158,10 +158,10 @@ class InstanceConfigForm extends ConfigForm
try {
if ($instanceName === null) { // create new instance
$this->add($this->getValues());
$message = mt('monitoring', 'Instance "%s" created successfully.');
$message = $this->translate('Instance "%s" created successfully.');
} else { // edit existing instance
$this->edit($instanceName, $this->getValues());
$message = mt('monitoring', 'Instance "%s" edited successfully.');
$message = $this->translate('Instance "%s" edited successfully.');
}
} catch (InvalidArgumentException $e) {
Notification::error($e->getMessage());
@ -189,7 +189,7 @@ class InstanceConfigForm extends ConfigForm
'name',
array(
'required' => true,
'label' => mt('monitoring', 'Instance Name')
'label' => $this->translate('Instance Name')
)
),
array(
@ -198,10 +198,10 @@ class InstanceConfigForm extends ConfigForm
array(
'required' => true,
'autosubmit' => true,
'label' => mt('monitoring', 'Instance Type'),
'label' => $this->translate('Instance Type'),
'multiOptions' => array(
LocalCommandFile::TRANSPORT => mt('monitoring', 'Local Command File'),
RemoteCommandFile::TRANSPORT => mt('monitoring', 'Remote Command File')
LocalCommandFile::TRANSPORT => $this->translate('Local Command File'),
RemoteCommandFile::TRANSPORT => $this->translate('Remote Command File')
),
'value' => $instanceType
)

@ -18,7 +18,7 @@ class SecurityConfigForm extends ConfigForm
public function init()
{
$this->setName('form_config_monitoring_security');
$this->setSubmitLabel(mt('monitoring', 'Save Changes'));
$this->setSubmitLabel($this->translate('Save Changes'));
}
/**
@ -29,7 +29,7 @@ class SecurityConfigForm extends ConfigForm
$this->config->setSection('security', $this->getValues());
if ($this->save()) {
Notification::success(mt('monitoring', 'New security configuration has successfully been stored'));
Notification::success($this->translate('New security configuration has successfully been stored'));
} else {
return false;
}
@ -54,8 +54,8 @@ class SecurityConfigForm extends ConfigForm
array(
'allowEmpty' => true,
'value' => '*pw*,*pass*,community',
'label' => mt('monitoring', 'Protected Custom Variables'),
'description' => mt('monitoring',
'label' => $this->translate('Protected Custom Variables'),
'description' => $this->translate(
'Comma separated case insensitive list of protected custom variables.'
. ' Use * as a placeholder for zero or more wildcard characters.'
. ' Existance of those custom variables will be shown, but their values will be masked.'

@ -44,7 +44,7 @@ class EventOverviewForm extends Form
'checkbox',
'statechange',
array(
'label' => t('State Changes'),
'label' => $this->translate('State Changes'),
'class' => 'autosubmit',
'decorators' => $decorators,
'value' => strpos($url, $this->stateChangeFilter()->toQueryString()) === false ? 0 : 1
@ -54,7 +54,7 @@ class EventOverviewForm extends Form
'checkbox',
'downtime',
array(
'label' => t('Downtimes'),
'label' => $this->translate('Downtimes'),
'class' => 'autosubmit',
'decorators' => $decorators,
'value' => strpos($url, $this->downtimeFilter()->toQueryString()) === false ? 0 : 1
@ -64,7 +64,7 @@ class EventOverviewForm extends Form
'checkbox',
'comment',
array(
'label' => t('Comments'),
'label' => $this->translate('Comments'),
'class' => 'autosubmit',
'decorators' => $decorators,
'value' => strpos($url, $this->commentFilter()->toQueryString()) === false ? 0 : 1
@ -74,7 +74,7 @@ class EventOverviewForm extends Form
'checkbox',
'notification',
array(
'label' => t('Notifications'),
'label' => $this->translate('Notifications'),
'class' => 'autosubmit',
'decorators' => $decorators,
'value' => strpos($url, $this->notificationFilter()->toQueryString()) === false ? 0 : 1
@ -84,7 +84,7 @@ class EventOverviewForm extends Form
'checkbox',
'flapping',
array(
'label' => t('Flapping'),
'label' => $this->translate('Flapping'),
'class' => 'autosubmit',
'decorators' => $decorators,
'value' => strpos($url, $this->flappingFilter()->toQueryString()) === false ? 0 : 1

@ -20,7 +20,7 @@ class BackendPage extends Form
'note',
'title',
array(
'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'),
'value' => $this->translate('Monitoring Backend', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -31,8 +31,7 @@ class BackendPage extends Form
'note',
'description',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'Please configure below how Icinga Web 2 should retrieve monitoring information.'
)
)
@ -44,8 +43,8 @@ class BackendPage extends Form
array(
'required' => true,
'value' => 'icinga',
'label' => mt('monitoring', 'Backend Name'),
'description' => mt('monitoring', 'The identifier of this backend')
'label' => $this->translate('Backend Name'),
'description' => $this->translate('The identifier of this backend')
)
);
@ -60,8 +59,10 @@ class BackendPage extends Form
'type',
array(
'required' => true,
'label' => mt('monitoring', 'Backend Type'),
'description' => mt('monitoring', 'The data source used for retrieving monitoring information'),
'label' => $this->translate('Backend Type'),
'description' => $this->translate(
'The data source used for retrieving monitoring information'
),
'multiOptions' => $resourceTypes
)
);

@ -28,7 +28,7 @@ class IdoResourcePage extends Form
'note',
'title',
array(
'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'),
'value' => $this->translate('Monitoring IDO Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -39,8 +39,7 @@ class IdoResourcePage extends Form
'note',
'description',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'Please fill out the connection details below to access'
. ' the IDO database of your monitoring environment.'
)
@ -91,8 +90,10 @@ class IdoResourcePage extends Form
'skip_validation',
array(
'required' => true,
'label' => t('Skip Validation'),
'description' => t('Check this to not to validate connectivity with the given database server')
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given database server'
)
)
);
}

@ -20,7 +20,7 @@ class InstancePage extends Form
'note',
'title',
array(
'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'),
'value' => $this->translate('Monitoring Instance', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -31,8 +31,7 @@ class InstancePage extends Form
'note',
'description',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'Please define the settings specific to your monitoring instance below.'
)
)

@ -28,7 +28,7 @@ class LivestatusResourcePage extends Form
'note',
'title',
array(
'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'),
'value' => $this->translate('Monitoring Livestatus Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -39,8 +39,7 @@ class LivestatusResourcePage extends Form
'note',
'description',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'Please fill out the connection details below to access the Livestatus'
. ' socket interface for your monitoring environment.'
)
@ -91,8 +90,10 @@ class LivestatusResourcePage extends Form
'skip_validation',
array(
'required' => true,
'label' => t('Skip Validation'),
'description' => t('Check this to not to validate connectivity with the given Livestatus socket')
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given Livestatus socket'
)
)
);
}

@ -20,7 +20,7 @@ class SecurityPage extends Form
'note',
'title',
array(
'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'),
'value' => $this->translate('Monitoring Security', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -31,8 +31,7 @@ class SecurityPage extends Form
'note',
'description',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'To protect your monitoring environment against prying eyes please fill out the settings below.'
)
)

@ -19,10 +19,7 @@ class WelcomePage extends Form
'note',
'welcome',
array(
'value' => mt(
'monitoring',
'Welcome to the configuration of the monitoring module for Icinga Web 2!'
),
'value' => $this->translate('Welcome to the configuration of the monitoring module for Icinga Web 2!'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -34,7 +31,7 @@ class WelcomePage extends Form
'note',
'core_hint',
array(
'value' => mt('monitoring', 'This is the core module for Icinga Web 2.')
'value' => $this->translate('This is the core module for Icinga Web 2.')
)
);
@ -42,8 +39,7 @@ class WelcomePage extends Form
'note',
'description',
array(
'value' => mt(
'monitoring',
'value' => $this->translate(
'It offers various status and reporting views with powerful filter capabilities that allow'
. ' you to keep track of the most important events in your monitoring environment.'
)

@ -19,7 +19,7 @@ class StatehistoryForm extends Form
public function init()
{
$this->setName('form_event_overview');
$this->setSubmitLabel(mt('monitoring', 'Apply'));
$this->setSubmitLabel($this->translate('Apply'));
}
/**
@ -65,14 +65,14 @@ class StatehistoryForm extends Form
'select',
'from',
array(
'label' => mt('monitoring', 'From'),
'label' => $this->translate('From'),
'value' => $this->getRequest()->getParam('from', strtotime('3 months ago')),
'multiOptions' => array(
strtotime('midnight 3 months ago') => mt('monitoring', '3 Months'),
strtotime('midnight 4 months ago') => mt('monitoring', '4 Months'),
strtotime('midnight 8 months ago') => mt('monitoring', '8 Months'),
strtotime('midnight 12 months ago') => mt('monitoring', '1 Year'),
strtotime('midnight 24 months ago') => mt('monitoring', '2 Years')
strtotime('midnight 3 months ago') => $this->translate('3 Months'),
strtotime('midnight 4 months ago') => $this->translate('4 Months'),
strtotime('midnight 8 months ago') => $this->translate('8 Months'),
strtotime('midnight 12 months ago') => $this->translate('1 Year'),
strtotime('midnight 24 months ago') => $this->translate('2 Years')
),
'class' => 'autosubmit'
)
@ -81,10 +81,10 @@ class StatehistoryForm extends Form
'select',
'to',
array(
'label' => mt('monitoring', 'To'),
'label' => $this->translate('To'),
'value' => $this->getRequest()->getParam('to', time()),
'multiOptions' => array(
time() => mt('monitoring', 'Today')
time() => $this->translate('Today')
),
'class' => 'autosubmit'
)
@ -95,11 +95,11 @@ class StatehistoryForm extends Form
'select',
'objecttype',
array(
'label' => mt('monitoring', 'Object type'),
'label' => $this->translate('Object type'),
'value' => $objectType,
'multiOptions' => array(
'services' => mt('monitoring', 'Services'),
'hosts' => mt('monitoring', 'Hosts')
'services' => $this->translate('Services'),
'hosts' => $this->translate('Hosts')
),
'class' => 'autosubmit'
)
@ -113,13 +113,13 @@ class StatehistoryForm extends Form
'select',
'state',
array(
'label' => mt('monitoring', 'State'),
'label' => $this->translate('State'),
'value' => $serviceState,
'multiOptions' => array(
'cnt_critical_hard' => mt('monitoring', 'Critical'),
'cnt_warning_hard' => mt('monitoring', 'Warning'),
'cnt_unknown_hard' => mt('monitoring', 'Unknown'),
'cnt_ok' => mt('monitoring', 'Ok')
'cnt_critical_hard' => $this->translate('Critical'),
'cnt_warning_hard' => $this->translate('Warning'),
'cnt_unknown_hard' => $this->translate('Unknown'),
'cnt_ok' => $this->translate('Ok')
),
'class' => 'autosubmit'
)
@ -133,12 +133,12 @@ class StatehistoryForm extends Form
'select',
'state',
array(
'label' => mt('monitoring', 'State'),
'label' => $this->translate('State'),
'value' => $hostState,
'multiOptions' => array(
'cnt_up' => mt('monitoring', 'Up'),
'cnt_down_hard' => mt('monitoring', 'Down'),
'cnt_unreachable_hard' => mt('monitoring', 'Unreachable')
'cnt_up' => $this->translate('Up'),
'cnt_down_hard' => $this->translate('Down'),
'cnt_unreachable_hard' => $this->translate('Unreachable')
),
'class' => 'autosubmit'
)

@ -115,7 +115,7 @@ if ($hosts->count() === 0) {
array('style' => 'font-weight: normal')
) ?>)</span>
<?php endif ?>
<p class="pluginoutput"><?= $this->escape(substr(strip_tags($host->host_output), 0, 10000)) ?></p>
<p class="pluginoutput"><?= $this->escape($this->ellipsis($host->host_output, 10000)) ?></p>
</td>
<?php foreach($this->extraColumns as $col): ?>
<td><?= $this->escape($host->$col) ?></td>

@ -112,7 +112,7 @@ foreach ($services as $service):
(<?= strtoupper(Host::getStateText($service->host_state, true)); ?>)
<?php endif ?>
</a><?php endif ?><br />
<p class="pluginoutput"><?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?></p>
<p class="pluginoutput"><?= $this->escape($this->ellipsis($service->service_output, 10000)); ?></p>
</td>
<?php foreach($this->extraColumns as $col): ?>
<td><?= $this->escape($service->$col) ?></td>

@ -292,7 +292,6 @@ abstract class IdoQuery extends DbQuery
$mapped = $this->getMappedField($field);
if ($mapped === null) {
return stripos($field, 'UNIX_TIMESTAMP') !== false;
return false;
}
return stripos($mapped, 'UNIX_TIMESTAMP') !== false;
}
@ -324,6 +323,11 @@ abstract class IdoQuery extends DbQuery
foreach ($columns as $key => & $value) {
$value = preg_replace('/ COLLATE .+$/', '', $value);
$value = preg_replace('/inet_aton\(([[:word:].]+)\)/i', '$1::inet - \'0.0.0.0\'', $value);
$value = preg_replace(
'/UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\))/i',
'CASE WHEN ($1 < \'1970-01-03 00:00:00+00\'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP($1) END',
$value
);
}
}
}

@ -11,17 +11,27 @@ class ProgramstatusQuery extends IdoQuery
{
protected $columnMap = array(
'programstatus' => array(
'id' => 'programstatus_id',
'status_update_time' => 'UNIX_TIMESTAMP(status_update_time)',
'program_start_time' => 'UNIX_TIMESTAMP(program_start_time)',
'program_end_time' => 'UNIX_TIMESTAMP(program_end_time)',
'is_currently_running' => 'is_currently_running',
'id' => 'programstatus_id',
'status_update_time' => 'UNIX_TIMESTAMP(programstatus.status_update_time)',
'program_start_time' => 'UNIX_TIMESTAMP(programstatus.program_start_time)',
'program_end_time' => 'UNIX_TIMESTAMP(programstatus.program_end_time)',
'is_currently_running' => 'CASE WHEN (programstatus.is_currently_running = 0)
THEN
0
ELSE
CASE WHEN (UNIX_TIMESTAMP(programstatus.status_update_time) + 60 > UNIX_TIMESTAMP(NOW()))
THEN
1
ELSE
0
END
END',
'process_id' => 'process_id',
'daemon_mode' => 'daemon_mode',
'last_command_check' => 'UNIX_TIMESTAMP(last_command_check)',
'last_log_rotation' => 'UNIX_TIMESTAMP(last_log_rotation)',
'last_command_check' => 'UNIX_TIMESTAMP(programstatus.last_command_check)',
'last_log_rotation' => 'UNIX_TIMESTAMP(programstatus.last_log_rotation)',
'notifications_enabled' => 'notifications_enabled',
'disable_notif_expire_time' => 'UNIX_TIMESTAMP(disable_notif_expire_time)',
'disable_notif_expire_time' => 'UNIX_TIMESTAMP(programstatus.disable_notif_expire_time)',
'active_service_checks_enabled' => 'active_service_checks_enabled',
'passive_service_checks_enabled' => 'passive_service_checks_enabled',
'active_host_checks_enabled' => 'active_host_checks_enabled',

@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring;
use Icinga\Application\Icinga;
use Icinga\Web\Form;
use Icinga\Web\Wizard;
use Icinga\Web\Request;
@ -124,7 +125,7 @@ class MonitoringWizard extends Wizard implements SetupWizard
$pageData = $this->getPageData();
$setup = new Setup();
$setup->addStep(new MakeDirStep(array($this->getConfigDir() . '/modules/monitoring'), 0775));
$setup->addStep(new MakeDirStep(array(Icinga::app()->getConfigDir() . '/modules/monitoring'), 2770));
$setup->addStep(
new BackendStep(array(
@ -159,21 +160,4 @@ class MonitoringWizard extends Wizard implements SetupWizard
{
return new Requirements();
}
/**
* Return the configuration directory of Icinga Web 2
*
* @return string
*/
protected function getConfigDir()
{
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
} else {
$configDir = '/etc/icingaweb';
}
$canonical = realpath($configDir);
return $canonical ? $canonical : $configDir;
}
}

@ -74,16 +74,15 @@ class AdminAccountPage extends Form
$choices = array();
if ($this->backendConfig['backend'] !== 'db') {
$choices['by_name'] = mt('setup', 'By Name', 'setup.admin');
$choices['by_name'] = $this->translate('By Name', 'setup.admin');
$this->addElement(
'text',
'by_name',
array(
'required' => isset($formData['user_type']) && $formData['user_type'] === 'by_name',
'value' => $this->getUsername(),
'label' => mt('setup', 'Username'),
'description' => mt(
'setup',
'label' => $this->translate('Username'),
'description' => $this->translate(
'Define the initial administrative account by providing a username that reflects'
. ' a user created later or one that is authenticated using external mechanisms'
)
@ -94,21 +93,20 @@ class AdminAccountPage extends Form
if ($this->backendConfig['backend'] === 'db' || $this->backendConfig['backend'] === 'ldap') {
$users = $this->fetchUsers();
if (false === empty($users)) {
$choices['existing_user'] = mt('setup', 'Existing User');
$choices['existing_user'] = $this->translate('Existing User');
$this->addElement(
'select',
'existing_user',
array(
'required' => isset($formData['user_type']) && $formData['user_type'] === 'existing_user',
'label' => mt('setup', 'Username'),
'label' => $this->translate('Username'),
'description' => sprintf(
mt(
'setup',
$this->translate(
'Choose a user reported by the %s backend as the initial administrative account',
'setup.admin'
),
$this->backendConfig['backend'] === 'db'
? mt('setup', 'database', 'setup.admin.authbackend')
? $this->translate('database', 'setup.admin.authbackend')
: 'LDAP'
),
'multiOptions' => array_combine($users, $users)
@ -118,16 +116,15 @@ class AdminAccountPage extends Form
}
if ($this->backendConfig['backend'] === 'db') {
$choices['new_user'] = mt('setup', 'New User');
$choices['new_user'] = $this->translate('New User');
$required = isset($formData['user_type']) && $formData['user_type'] === 'new_user';
$this->addElement(
'text',
'new_user',
array(
'required' => $required,
'label' => mt('setup', 'Username'),
'description' => mt(
'setup',
'label' => $this->translate('Username'),
'description' => $this->translate(
'Enter the username to be used when creating an initial administrative account'
)
)
@ -137,8 +134,8 @@ class AdminAccountPage extends Form
'new_user_password',
array(
'required' => $required,
'label' => mt('setup', 'Password'),
'description' => mt('setup', 'Enter the password to assign to the newly created account')
'label' => $this->translate('Password'),
'description' => $this->translate('Enter the password to assign to the newly created account')
)
);
$this->addElement(
@ -146,8 +143,8 @@ class AdminAccountPage extends Form
'new_user_2ndpass',
array(
'required' => $required,
'label' => mt('setup', 'Repeat password'),
'description' => mt('setup', 'Please repeat the password given above to avoid typing errors'),
'label' => $this->translate('Repeat password'),
'description' => $this->translate('Please repeat the password given above to avoid typing errors'),
'validators' => array(
array('identical', false, array('new_user_password'))
)
@ -179,7 +176,7 @@ class AdminAccountPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Administration', 'setup.page.title'),
'value' => $this->translate('Administration', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -215,7 +212,7 @@ class AdminAccountPage extends Form
}
if ($data['user_type'] === 'new_user' && array_search($data['new_user'], $this->fetchUsers()) !== false) {
$this->getElement('new_user')->addError(mt('setup', 'Username already exists.'));
$this->getElement('new_user')->addError($this->translate('Username already exists.'));
return false;
}

@ -62,7 +62,7 @@ class AuthBackendPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Authentication Backend', 'setup.page.title'),
'value' => $this->translate('Authentication Backend', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -71,20 +71,17 @@ class AuthBackendPage extends Form
);
if ($this->config['type'] === 'db') {
$note = mt(
'setup',
$note = $this->translate(
'As you\'ve chosen to use a database for authentication all you need '
. 'to do now is defining a name for your first authentication backend.'
);
} elseif ($this->config['type'] === 'ldap') {
$note = mt(
'setup',
$note = $this->translate(
'Before you are able to authenticate using the LDAP connection defined earlier you need to'
. ' provide some more information so that Icinga Web 2 is able to locate account details.'
);
} else { // if ($this->config['type'] === 'autologin'
$note = mt(
'setup',
$note = $this->translate(
'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary'
. ' to adjust usernames before any permissions, restrictions, etc. are being applied.'
);
@ -150,8 +147,8 @@ class AuthBackendPage extends Form
'order' => 2,
'ignore' => true,
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt('setup', 'Check this to not to validate authentication using this backend')
'label' => $this->translate('Skip Validation'),
'description' => $this->translate('Check this to not to validate authentication using this backend')
)
);
}

@ -29,7 +29,7 @@ class AuthenticationPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Authentication', 'setup.page.title'),
'value' => $this->translate('Authentication', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -40,8 +40,7 @@ class AuthenticationPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Please choose how you want to authenticate when accessing Icinga Web 2.'
. ' Configuring backend specific details follows in a later step.'
)
@ -50,20 +49,20 @@ class AuthenticationPage extends Form
$backendTypes = array();
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$backendTypes['db'] = t('Database');
$backendTypes['db'] = $this->translate('Database');
}
if (Platform::extensionLoaded('ldap')) {
$backendTypes['ldap'] = 'LDAP';
}
$backendTypes['autologin'] = t('Autologin');
$backendTypes['autologin'] = $this->translate('Autologin');
$this->addElement(
'select',
'type',
array(
'required' => true,
'label' => mt('setup', 'Authentication Type'),
'description' => mt('setup', 'The type of authentication to use when accessing Icinga Web 2'),
'label' => $this->translate('Authentication Type'),
'description' => $this->translate('The type of authentication to use when accessing Icinga Web 2'),
'multiOptions' => $backendTypes
)
);

@ -90,7 +90,7 @@ class DatabaseCreationPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Database Setup', 'setup.page.title'),
'value' => $this->translate('Database Setup', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -101,8 +101,7 @@ class DatabaseCreationPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'It seems that either the database you defined earlier does not yet exist and cannot be created'
. ' using the provided access credentials or the database does not have the required schema to '
. 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.'
@ -116,16 +115,16 @@ class DatabaseCreationPage extends Form
'username',
array(
'required' => false === $skipValidation,
'label' => mt('setup', 'Username'),
'description' => mt('setup', 'A user which is able to create databases and/or touch the database schema')
'label' => $this->translate('Username'),
'description' => $this->translate('A user which is able to create databases and/or touch the database schema')
)
);
$this->addElement(
'password',
'password',
array(
'label' => mt('setup', 'Password'),
'description' => mt('setup', 'The password for the database user defined above')
'label' => $this->translate('Password'),
'description' => $this->translate('The password for the database user defined above')
)
);
@ -182,7 +181,7 @@ class DatabaseCreationPage extends Form
// form need to be granted to create databases, users...
if (false === $db->checkPrivileges($this->databaseSetupPrivileges)) {
$this->addError(
mt('setup', 'The provided credentials cannot be used to create the database and/or the user.')
$this->translate('The provided credentials cannot be used to create the database and/or the user.')
);
$this->addSkipValidationCheckbox();
return false;
@ -191,8 +190,7 @@ class DatabaseCreationPage extends Form
// ...and to grant all required usage privileges to others
if (false === $db->isGrantable($this->databaseUsagePrivileges)) {
$this->addError(sprintf(
mt(
'setup',
$this->translate(
'The provided credentials cannot be used to grant all required privileges to the login "%s".'
),
$this->config['username']
@ -215,9 +213,8 @@ class DatabaseCreationPage extends Form
array(
'order' => 2,
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt(
'setup',
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate the ability to login and required privileges'
)
)

@ -39,7 +39,7 @@ class DbResourcePage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Database Resource', 'setup.page.title'),
'value' => $this->translate('Database Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -50,8 +50,7 @@ class DbResourcePage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Now please configure your database resource. Note that the database itself does not need to'
. ' exist at this time as it is going to be created once the wizard is about to be finished.'
)
@ -121,8 +120,10 @@ class DbResourcePage extends Form
'skip_validation',
array(
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt('setup', 'Check this to not to validate connectivity with the given database server')
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given database server'
)
)
);
}

@ -29,7 +29,7 @@ class GeneralConfigPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Application Configuration', 'setup.page.title'),
'value' => $this->translate('Application Configuration', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -40,8 +40,7 @@ class GeneralConfigPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Now please adjust all application and logging related configuration options to fit your needs.'
)
)

@ -82,7 +82,7 @@ EOT;
'note',
'title',
array(
'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'),
'value' => $this->translate('LDAP Discovery Results', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -94,7 +94,7 @@ EOT;
'description',
array(
'value' => sprintf(
mt('setup', 'The following directory service has been found on domain "%s":'),
$this->translate('The following directory service has been found on domain "%s":'),
$this->config['domain']
)
)
@ -119,7 +119,7 @@ EOT;
'confirm',
array(
'value' => '1',
'label' => mt('setup', 'Use this configuration?')
'label' => $this->translate('Use this configuration?')
)
);
}

@ -36,7 +36,7 @@ class LdapDiscoveryPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'),
'value' => $this->translate('LDAP Discovery', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -47,8 +47,7 @@ class LdapDiscoveryPage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'You can use this page to discover LDAP or ActiveDirectory servers ' .
' for authentication. If you don\' want to execute a discovery, just skip this step.'
)
@ -66,8 +65,8 @@ class LdapDiscoveryPage extends Form
'skip_validation',
array(
'required' => true,
'label' => mt('setup', 'Skip'),
'description' => mt('setup', 'Do not discover LDAP servers and enter all settings manually.')
'label' => $this->translate('Skip'),
'description' => $this->translate('Do not discover LDAP servers and enter all settings manually.')
)
);
}
@ -94,7 +93,9 @@ class LdapDiscoveryPage extends Form
return true;
}
}
$this->addError(sprintf(t('Could not find any LDAP servers on the domain "%s".'), $data['domain']));
$this->addError(
sprintf($this->translate('Could not find any LDAP servers on the domain "%s".'), $data['domain'])
);
return false;
}

@ -37,7 +37,7 @@ class LdapResourcePage extends Form
'note',
'title',
array(
'value' => mt('setup', 'LDAP Resource', 'setup.page.title'),
'value' => $this->translate('LDAP Resource', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -48,8 +48,7 @@ class LdapResourcePage extends Form
'note',
'description',
array(
'value' => mt(
'setup',
'value' => $this->translate(
'Now please configure your AD/LDAP resource. This will later '
. 'be used to authenticate users logging in to Icinga Web 2.'
)
@ -107,9 +106,8 @@ class LdapResourcePage extends Form
'skip_validation',
array(
'required' => true,
'label' => mt('setup', 'Skip Validation'),
'description' => mt(
'setup',
'label' => $this->translate('Skip Validation'),
'description' => $this->translate(
'Check this to not to validate connectivity with the given directory service'
)
)

@ -30,8 +30,7 @@ class PreferencesPage extends Form
$this->getElement('type')
->setValue('db')
->setDescription(
mt(
'setup',
$this->translate(
'Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.'
)
);
@ -47,7 +46,7 @@ class PreferencesPage extends Form
'note',
'title',
array(
'value' => mt('setup', 'Preferences', 'setup.page.title'),
'value' => $this->translate('Preferences', 'setup.page.title'),
'decorators' => array(
'ViewHelper',
array('HtmlTag', array('tag' => 'h2'))
@ -58,23 +57,23 @@ class PreferencesPage extends Form
'note',
'description',
array(
'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.')
'value' => $this->translate('Please choose how Icinga Web 2 should store user preferences.')
)
);
$storageTypes = array();
$storageTypes['ini'] = t('File System (INI Files)');
$storageTypes['ini'] = $this->translate('File System (INI Files)');
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$storageTypes['db'] = t('Database');
$storageTypes['db'] = $this->translate('Database');
}
$storageTypes['null'] = t('Don\'t Store Preferences');
$storageTypes['null'] = $this->translate('Don\'t Store Preferences');
$this->addElement(
'select',
'type',
array(
'required' => true,
'label' => t('User Preference Storage Type'),
'label' => $this->translate('User Preference Storage Type'),
'multiOptions' => $storageTypes
)
);

@ -32,9 +32,8 @@ class WelcomePage extends Form
'token',
array(
'required' => true,
'label' => mt('setup', 'Setup Token'),
'description' => mt(
'setup',
'label' => $this->translate('Setup Token'),
'description' => $this->translate(
'For security reasons we need to ensure that you are permitted to run this wizard.'
. ' Please provide a token by following the instructions below.'
),

@ -46,7 +46,7 @@ $cliPath = realpath(Icinga::app()->getApplicationDir() . '/../bin/icingacli');
); ?></p>
<p><?= mt('setup', 'If you\'ve got the IcingaCLI installed you can do the following:'); ?></p>
<div class="code">
<span><?= $cliPath ? $cliPath : 'icingacli'; ?> setup config createDirectory <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?><?= $configDir !== '/etc/icingaweb' ? ' --path ' . $configDir : ''; ?>;</span>
<span><?= $cliPath ? $cliPath : 'icingacli'; ?> setup config directory --group <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?><?= $configDir !== '/etc/icingaweb2' ? ' --config ' . $configDir : ''; ?>;</span>
<span><?= $cliPath ? $cliPath : 'icingacli'; ?> setup token create;</span>
</div>
<p><?= mt('setup', 'In case the IcingaCLI is missing you can create the token manually:'); ?></p>

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Steps;
use Exception;
use PDOException;
use Icinga\Application\Icinga;
use Icinga\Module\Setup\Step;
use Icinga\Module\Setup\Utils\DbTool;
use Icinga\Module\Setup\Exception\SetupException;
@ -71,7 +70,7 @@ class DatabaseStep extends Step
$this->log(mt('setup', 'Database schema already exists...'));
} else {
$this->log(mt('setup', 'Creating database schema...'));
$db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/mysql.schema.sql');
$db->import($this->data['schemaPath'] . '/mysql.schema.sql');
}
if ($db->hasLogin($this->data['resourceConfig']['username'])) {
@ -122,7 +121,7 @@ class DatabaseStep extends Step
$this->log(mt('setup', 'Database schema already exists...'));
} else {
$this->log(mt('setup', 'Creating database schema...'));
$db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/pgsql.schema.sql');
$db->import($this->data['schemaPath'] . '/pgsql.schema.sql');
}
if ($db->hasLogin($this->data['resourceConfig']['username'])) {

@ -16,12 +16,12 @@ class MakeDirStep extends Step
/**
* @param array $paths
* @param int $dirmode
* @param int $dirmode Directory mode in octal notation
*/
public function __construct($paths, $dirmode)
{
$this->paths = $paths;
$this->dirmode = $dirmode;
$this->dirmode = octdec((string) $dirmode);
$this->errors = array();
}

@ -295,7 +295,9 @@ class WebWizard extends Wizard implements SetupWizard
: null,
'adminPassword' => isset($pageData['setup_database_creation']['password'])
? $pageData['setup_database_creation']['password']
: null
: null,
'schemaPath' => Config::module('setup')
->get('schema', 'path', Icinga::app()->getBaseDir('etc/schema'))
))
);
}

@ -0,0 +1,2 @@
[schema]
path = /usr/share/doc/icingaweb2/schema