IDO: Add config option to use the customvariables table for fetching custom vars

Icinga 1.x has the option to not dump the icinga_customvariablestatus table:

dump_customvar_status=0

With this setting applied, Web 2 will never show custom variables because Web 2 relies on the customvariablestatus table.
This commit introduces a config option to use the customvariables table instead:

/etc/icingaweb2/modules/monitoring/config.ini

[ido]
use_customvar_status_table = 0
This commit is contained in:
Eric Lippmann 2016-09-12 15:52:07 +02:00
parent 65d7c18c31
commit 1ed2ebc191
1 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,8 @@
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
use Icinga\Application\Config;
class CustomvarQuery extends IdoQuery
{
protected $columnMap = array(
@ -44,8 +46,14 @@ class CustomvarQuery extends IdoQuery
$this->columnMap['customvariablestatus']['is_json'] = '(0)';
}
if (! (bool) Config::module('monitoring')->get('ido', 'use_customvar_status_table', true)) {
$table = 'customvariables';
} else {
$table = 'customvariablestatus';
}
$this->select->from(
array('cvs' => $this->prefix . 'customvariablestatus'),
array('cvs' => $this->prefix . $table),
array()
)->join(
array('cvo' => $this->prefix . 'objects'),