Merge branch 'master' into feature/allow-to-list-groups-from-a-ldap-backend-9772
This commit is contained in:
commit
35e62aed80
|
@ -14,11 +14,12 @@
|
|||
#
|
||||
class openldap {
|
||||
|
||||
package { ['openldap-servers', 'openldap-clients']:
|
||||
package { [ 'openldap-servers', 'openldap-clients', ]:
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
service { 'slapd':
|
||||
enable => true,
|
||||
ensure => running,
|
||||
require => Package['openldap-servers'],
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Class: pgsql
|
||||
#
|
||||
# This class installs the postgresql server and client software.
|
||||
# Further it configures pg_hba.conf to trus the local icinga user.
|
||||
# This class installs the PostgreSQL server and client software.
|
||||
# Further it configures pg_hba.conf to trust the local icinga user.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
|
@ -17,26 +17,25 @@ class pgsql {
|
|||
|
||||
Exec { path => '/sbin:/bin:/usr/bin' }
|
||||
|
||||
package { [
|
||||
'postgresql', 'postgresql-server'
|
||||
]:
|
||||
ensure => latest,
|
||||
package { [ 'postgresql', 'postgresql-server', ]:
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
exec { 'initdb':
|
||||
creates => '/var/lib/pgsql/data/pg_xlog',
|
||||
command => 'service postgresql initdb',
|
||||
require => Package['postgresql-server']
|
||||
creates => '/var/lib/pgsql/data/pg_xlog',
|
||||
require => Package['postgresql-server'],
|
||||
}
|
||||
|
||||
service { 'postgresql':
|
||||
enable => true,
|
||||
ensure => running,
|
||||
require => [Package['postgresql-server'], Exec['initdb']]
|
||||
require => [ Package['postgresql-server'], Exec['initdb'], ]
|
||||
}
|
||||
|
||||
file { '/var/lib/pgsql/data/pg_hba.conf':
|
||||
content => template('pgsql/pg_hba.conf.erb'),
|
||||
require => [Package['postgresql-server'], Exec['initdb']],
|
||||
notify => Service['postgresql']
|
||||
require => [ Package['postgresql-server'], Exec['initdb'], ],
|
||||
notify => Service['postgresql'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
namespace Icinga\Forms\Config\Resource;
|
||||
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Application\Platform;
|
||||
use Icinga\Web\Form;
|
||||
|
||||
/**
|
||||
* Form class for adding/modifying database resources
|
||||
|
@ -43,12 +43,30 @@ class DbResourceForm extends Form
|
|||
$dbChoices['oci'] = 'Oracle (OCI8)';
|
||||
}
|
||||
$offerPostgres = false;
|
||||
$offerMysql = false;
|
||||
if (isset($formData['db'])) {
|
||||
if ($formData['db'] === 'pgsql') {
|
||||
$offerPostgres = true;
|
||||
} elseif ($formData['db'] === 'mysql') {
|
||||
$offerMysql = true;
|
||||
}
|
||||
} elseif (key($dbChoices) === 'pgsql') {
|
||||
$offerPostgres = true;
|
||||
} else {
|
||||
$dbChoice = key($dbChoices);
|
||||
if ($dbChoice === 'pgsql') {
|
||||
$offerPostgres = true;
|
||||
} elseif ($dbChoices === 'mysql') {
|
||||
$offerMysql = true;
|
||||
}
|
||||
}
|
||||
$socketInfo = '';
|
||||
if ($offerPostgres) {
|
||||
$socketInfo = $this->translate(
|
||||
'For using unix domain sockets, specify the path to the unix domain socket directory'
|
||||
);
|
||||
} elseif ($offerMysql) {
|
||||
$socketInfo = $this->translate(
|
||||
'For using unix domain sockets, specify localhost'
|
||||
);
|
||||
}
|
||||
$this->addElement(
|
||||
'text',
|
||||
|
@ -76,7 +94,8 @@ class DbResourceForm extends Form
|
|||
array (
|
||||
'required' => true,
|
||||
'label' => $this->translate('Host'),
|
||||
'description' => $this->translate('The hostname of the database'),
|
||||
'description' => $this->translate('The hostname of the database')
|
||||
. ($socketInfo ? '. ' . $socketInfo : ''),
|
||||
'value' => 'localhost'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -19,21 +19,38 @@ to handle authentication and authorization, monitoring data or user preferences.
|
|||
Directive | Description
|
||||
----------------|------------
|
||||
**type** | `db`
|
||||
**db** | Database management system. Either `mysql` or `pgsql`.
|
||||
**host** | Connect to the database server on the given host.
|
||||
**port** | Port number to use for the connection.
|
||||
**db** | Database management system. In most cases `mysql` or `pgsql`.
|
||||
**host** | Connect to the database server on the given host. For using unix domain sockets, specify `localhost` for MySQL and the path to the unix domain socket directory for PostgreSQL.
|
||||
**port** | Port number to use. Mandatory for connections to a PostgreSQL database.
|
||||
**username** | The username to use when connecting to the server.
|
||||
**password** | The password to use when connecting to the server.
|
||||
**dbname** | The database to use.
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
[icingaweb]
|
||||
````
|
||||
[icingaweb-mysql-tcp]
|
||||
type = db
|
||||
db = mysql
|
||||
host = 127.0.0.1
|
||||
port = 3306
|
||||
username = icingaweb
|
||||
password = icingaweb
|
||||
dbname = icingaweb
|
||||
|
||||
[icingaweb-mysql-socket]
|
||||
type = db
|
||||
db = mysql
|
||||
host = localhost
|
||||
port = 3306
|
||||
username = icingaweb
|
||||
password = icingaweb
|
||||
dbname = icingaweb
|
||||
|
||||
[icingaweb-pgsql-socket]
|
||||
type = db
|
||||
db = pgsql
|
||||
host = /var/run/postgresql
|
||||
port = 5432
|
||||
username = icingaweb
|
||||
password = icingaweb
|
||||
dbname = icingaweb
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
namespace Icinga\Web;
|
||||
|
||||
class FileCache
|
||||
|
@ -191,7 +192,7 @@ class FileCache
|
|||
* Whether the given ETag matchesspecific file(s) on disk
|
||||
*
|
||||
* If no ETag is given we'll try to fetch the one from the current
|
||||
* HTTP request.
|
||||
* HTTP request. Respects HTTP Cache-Control: no-cache, if set.
|
||||
*
|
||||
* @param string|array $files file(s) to check
|
||||
* @param string $match ETag to match against
|
||||
|
@ -208,6 +209,9 @@ class FileCache
|
|||
if (! $match) {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'no-cache') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$etag = self::etagForFiles($files);
|
||||
return $match === $etag ? $etag : false;
|
||||
|
|
|
@ -27,7 +27,8 @@ class JavaScript
|
|||
'js/icinga/behavior/tristate.js',
|
||||
'js/icinga/behavior/navigation.js',
|
||||
'js/icinga/behavior/form.js',
|
||||
'js/icinga/behavior/actiontable.js'
|
||||
'js/icinga/behavior/actiontable.js',
|
||||
'js/icinga/behavior/selectable.js'
|
||||
);
|
||||
|
||||
protected static $vendorFiles = array(
|
||||
|
|
|
@ -77,6 +77,7 @@ class HostController extends MonitoredObjectController
|
|||
'host_state_type',
|
||||
'host_last_state_change',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_handled',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
|
|
|
@ -55,6 +55,7 @@ class HostsController extends Controller
|
|||
'host_icon_image_alt',
|
||||
'host_name',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
'host_handled',
|
||||
|
@ -92,6 +93,7 @@ class HostsController extends Controller
|
|||
'host_icon_image_alt',
|
||||
'host_name',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
'host_handled',
|
||||
|
|
|
@ -58,7 +58,6 @@ class ListController extends Controller
|
|||
'host_name',
|
||||
'host_display_name',
|
||||
'host_state' => $stateColumn,
|
||||
'host_address',
|
||||
'host_acknowledged',
|
||||
'host_output',
|
||||
'host_attempt',
|
||||
|
@ -66,15 +65,10 @@ class ListController extends Controller
|
|||
'host_is_flapping',
|
||||
'host_state_type',
|
||||
'host_handled',
|
||||
'host_last_check',
|
||||
'host_last_state_change' => $stateChangeColumn,
|
||||
'host_notifications_enabled',
|
||||
'host_action_url',
|
||||
'host_notes_url',
|
||||
'host_active_checks_enabled',
|
||||
'host_passive_checks_enabled',
|
||||
'host_current_check_attempt',
|
||||
'host_max_check_attempts'
|
||||
'host_passive_checks_enabled'
|
||||
), $this->addColumns()));
|
||||
$this->applyRestriction('monitoring/filter/objects', $query);
|
||||
$this->filterQuery($query);
|
||||
|
@ -132,10 +126,6 @@ class ListController extends Controller
|
|||
'host_name',
|
||||
'host_display_name',
|
||||
'host_state',
|
||||
'host_state_type',
|
||||
'host_last_state_change',
|
||||
'host_address',
|
||||
'host_handled',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'service_state' => $stateColumn,
|
||||
|
@ -152,14 +142,9 @@ class ListController extends Controller
|
|||
'service_state_type',
|
||||
'service_handled',
|
||||
'service_severity',
|
||||
'service_last_check',
|
||||
'service_notifications_enabled',
|
||||
'service_action_url',
|
||||
'service_notes_url',
|
||||
'service_active_checks_enabled',
|
||||
'service_passive_checks_enabled',
|
||||
'current_check_attempt' => 'service_current_check_attempt',
|
||||
'max_check_attempts' => 'service_max_check_attempts'
|
||||
'service_passive_checks_enabled'
|
||||
), $this->addColumns());
|
||||
$query = $this->backend->select()->from('servicestatus', $columns);
|
||||
$this->applyRestriction('monitoring/filter/objects', $query);
|
||||
|
|
|
@ -56,6 +56,7 @@ class ServicesController extends Controller
|
|||
'host_icon_image_alt',
|
||||
'host_name',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_output',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
|
@ -101,6 +102,7 @@ class ServicesController extends Controller
|
|||
'host_icon_image_alt',
|
||||
'host_name',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_output',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
|
|
|
@ -10,15 +10,18 @@ use Icinga\Module\Monitoring\Object\Host;
|
|||
</td>
|
||||
<td>
|
||||
<?= $this->iconImage()->host($object) ?>
|
||||
<strong><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<strong class="selectable"><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||
<small>(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<small class="selectable">(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<?php endif ?>
|
||||
<?= $this->render('partials/host/statusicons.phtml'); ?>
|
||||
<br/>
|
||||
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
||||
<span class="selectable" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||
<?php endif ?>
|
||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||
<br>
|
||||
<?= $this->escape($object->host_address); ?>
|
||||
<span class="selectable" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||
<?php endif ?>
|
||||
<?= $this->render('partials/host/statusicons.phtml'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -11,15 +11,17 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
</td>
|
||||
<td>
|
||||
<?= $this->iconImage()->service($object) ?>
|
||||
<strong><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<strong class="selectable"><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||
<small>(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<small class="selectable">(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<?php endif ?>
|
||||
<br/>
|
||||
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
||||
<span class="selectable" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||
<?php endif ?>
|
||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||
<br>
|
||||
<?= $this->escape($object->host_address); ?>
|
||||
<span class="selectable" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||
<?php endif ?>
|
||||
<?= $this->render('partials/host/statusicons.phtml'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="state <?= Service::getStateText($object->service_state); ?><?= $object->service_handled ? ' handled' : ''; ?>">
|
||||
|
@ -29,7 +31,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
</td>
|
||||
<td>
|
||||
<?= $this->iconImage()->host($object) ?>
|
||||
<strong><?= $this->translate('Service'); ?>: <?= $this->escape($object->service_display_name); ?></strong>
|
||||
<strong><?= $this->translate('Service'); ?>: <span class="selectable"><?= $this->escape($object->service_display_name); ?></span></strong>
|
||||
<?php if ($object->service_display_name !== $object->service_description): ?>
|
||||
<small>(<?= $this->escape($object->service_description); ?>)</small>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -28,6 +28,7 @@ class HoststatusQuery extends IdoQuery
|
|||
'host' => 'ho.name1 COLLATE latin1_general_ci',
|
||||
'host_action_url' => 'h.action_url',
|
||||
'host_address' => 'h.address',
|
||||
'host_address6' => 'h.address6',
|
||||
'host_alias' => 'h.alias',
|
||||
'host_display_name' => 'h.display_name COLLATE latin1_general_ci',
|
||||
'host_icon_image' => 'h.icon_image',
|
||||
|
|
|
@ -832,7 +832,7 @@ abstract class IdoQuery extends DbQuery
|
|||
list($type, $name) = $this->customvarNameToTypeName($customvar);
|
||||
$alias = ($type === 'host' ? 'hcv_' : 'scv_') . $name;
|
||||
|
||||
$this->customVars[$customvar] = $alias;
|
||||
$this->customVars[strtolower($customvar)] = $alias;
|
||||
|
||||
if ($this->hasJoinedVirtualTable('services')) {
|
||||
$leftcol = 's.' . $type . '_object_id';
|
||||
|
|
|
@ -27,6 +27,7 @@ class ServicestatusQuery extends IdoQuery
|
|||
'hosts' => array(
|
||||
'host_action_url' => 'h.action_url',
|
||||
'host_address' => 'h.address',
|
||||
'host_address6' => 'h.address6',
|
||||
'host_alias' => 'h.alias COLLATE latin1_general_ci',
|
||||
'host_display_name' => 'h.display_name COLLATE latin1_general_ci',
|
||||
'host_icon_image' => 'h.icon_image',
|
||||
|
|
|
@ -82,7 +82,7 @@ class Controller extends IcingaWebController
|
|||
'service_description',
|
||||
'servicegroup_name',
|
||||
function ($c) {
|
||||
return preg_match('/^_(?:host|service)_/', $c);
|
||||
return preg_match('/^_(?:host|service)_/i', $c);
|
||||
}
|
||||
));
|
||||
foreach ($this->getRestrictions($name) as $filter) {
|
||||
|
|
|
@ -185,7 +185,11 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
*/
|
||||
public function isValidFilterTarget($column)
|
||||
{
|
||||
return in_array($column, $this->getFilterColumns());
|
||||
// Customvar
|
||||
if ($column[0] === '_' && preg_match('/^_(?:host|service)_/i', $column)) {
|
||||
return true;
|
||||
}
|
||||
return in_array($column, $this->getColumns()) || in_array($column, $this->getStaticFilterColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ class HostStatus extends DataView
|
|||
'host_display_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_state',
|
||||
'host_state_type',
|
||||
'host_handled',
|
||||
|
|
|
@ -18,6 +18,7 @@ class ServiceStatus extends DataView
|
|||
'host_state_type',
|
||||
'host_last_state_change',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_problem',
|
||||
'host_handled',
|
||||
'service_description',
|
||||
|
|
|
@ -95,6 +95,7 @@ class Host extends MonitoredObject
|
|||
'host_active_checks_enabled',
|
||||
'host_active_checks_enabled_changed',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_alias',
|
||||
'host_attempt',
|
||||
'host_check_command',
|
||||
|
|
|
@ -14,11 +14,13 @@ class Macro
|
|||
* @var array
|
||||
*/
|
||||
private static $icingaMacros = array(
|
||||
'HOSTNAME' => 'host_name',
|
||||
'HOSTADDRESS' => 'host_address',
|
||||
'SERVICEDESC' => 'service_description',
|
||||
'host.name' => 'host_name',
|
||||
'host.address' => 'host_address',
|
||||
'HOSTNAME' => 'host_name',
|
||||
'HOSTADDRESS' => 'host_address',
|
||||
'HOSTADDRESS6' => 'host_address6',
|
||||
'SERVICEDESC' => 'service_description',
|
||||
'host.name' => 'host_name',
|
||||
'host.address' => 'host_address',
|
||||
'host.address6' => 'host_address6',
|
||||
'service.description' => 'service_description'
|
||||
);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ class Service extends MonitoredObject
|
|||
'host_acknowledged',
|
||||
'host_active_checks_enabled',
|
||||
'host_address',
|
||||
'host_address6',
|
||||
'host_alias',
|
||||
'host_display_name',
|
||||
'host_handled',
|
||||
|
|
|
@ -16,11 +16,14 @@ class MacroTest extends BaseTestCase
|
|||
$hostMock = Mockery::mock('host');
|
||||
$hostMock->host_name = 'test';
|
||||
$hostMock->host_address = '1.1.1.1';
|
||||
$hostMock->host_address6 = '::1';
|
||||
|
||||
$this->assertEquals(Macro::resolveMacros('$HOSTNAME$', $hostMock), $hostMock->host_name);
|
||||
$this->assertEquals(Macro::resolveMacros('$HOSTADDRESS$', $hostMock), $hostMock->host_address);
|
||||
$this->assertEquals(Macro::resolveMacros('$HOSTADDRESS6$', $hostMock), $hostMock->host_address6);
|
||||
$this->assertEquals(Macro::resolveMacros('$host.name$', $hostMock), $hostMock->host_name);
|
||||
$this->assertEquals(Macro::resolveMacros('$host.address$', $hostMock), $hostMock->host_address);
|
||||
$this->assertEquals(Macro::resolveMacros('$host.address6$', $hostMock), $hostMock->host_address6);
|
||||
}
|
||||
|
||||
public function testServiceMacros()
|
||||
|
@ -28,13 +31,16 @@ class MacroTest extends BaseTestCase
|
|||
$svcMock = Mockery::mock('service');
|
||||
$svcMock->host_name = 'test';
|
||||
$svcMock->host_address = '1.1.1.1';
|
||||
$svcMock->host_address6 = '::1';
|
||||
$svcMock->service_description = 'a service';
|
||||
|
||||
$this->assertEquals(Macro::resolveMacros('$HOSTNAME$', $svcMock), $svcMock->host_name);
|
||||
$this->assertEquals(Macro::resolveMacros('$HOSTADDRESS$', $svcMock), $svcMock->host_address);
|
||||
$this->assertEquals(Macro::resolveMacros('$HOSTADDRESS6$', $svcMock), $svcMock->host_address6);
|
||||
$this->assertEquals(Macro::resolveMacros('$SERVICEDESC$', $svcMock), $svcMock->service_description);
|
||||
$this->assertEquals(Macro::resolveMacros('$host.name$', $svcMock), $svcMock->host_name);
|
||||
$this->assertEquals(Macro::resolveMacros('$host.address$', $svcMock), $svcMock->host_address);
|
||||
$this->assertEquals(Macro::resolveMacros('$host.address6$', $svcMock), $svcMock->host_address6);
|
||||
$this->assertEquals(Macro::resolveMacros('$service.description$', $svcMock), $svcMock->service_description);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
;(function(Icinga, $) {
|
||||
'use strict';
|
||||
|
||||
Icinga.Behaviors = Icinga.Behaviors || {};
|
||||
|
||||
var Selectable = function(icinga) {
|
||||
Icinga.EventListener.call(this, icinga);
|
||||
this.on('rendered', this.onRendered, this);
|
||||
};
|
||||
|
||||
$.extend(Selectable.prototype, new Icinga.EventListener(), {
|
||||
onRendered: function(e) {
|
||||
$('.selectable', e.target).on('dblclick', e.data.self.selectText);
|
||||
},
|
||||
|
||||
selectText: function(e) {
|
||||
var b = document.body,
|
||||
r;
|
||||
if (b.createTextRange) {
|
||||
r = b.createTextRange();
|
||||
r.moveToElementText(e.target);
|
||||
r.select();
|
||||
} else if (window.getSelection) {
|
||||
var s = window.getSelection();
|
||||
r = document.createRange();
|
||||
r.selectNodeContents(e.target);
|
||||
s.removeAllRanges();
|
||||
s.addRange(r);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Icinga.Behaviors.Selectable = Selectable;
|
||||
})(Icinga, jQuery);
|
Loading…
Reference in New Issue