Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(conf/export) broker RRDcacheD export (#11811)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-launois committed Sep 21, 2022
1 parent 4422b96 commit 54e10c7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions www/class/config-generate/broker.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ private function generate($poller_id, $localhost)
}

$subValuesToCastInArray = [];
$rrdCacheOption = 'disable';
$rrdCacheOption = null;
$rrdCached = null;
foreach ($value as $subvalue) {
if (!isset($subvalue['fieldIndex']) ||
$subvalue['fieldIndex'] == "" ||
Expand All @@ -237,21 +238,20 @@ private function generate($poller_id, $localhost)
} elseif ($subvalue['config_key'] === 'category') {
$object[$key][$subvalue['config_group_id']]['filters'][$subvalue['config_key']][] =
$subvalue['config_value'];
} else {
} elseif (in_array($subvalue['config_key'], ['rrd_cached_option', 'rrd_cached'])) {
if ($subvalue['config_key'] === 'rrd_cached_option') {
$rrdCacheOption = $subvalue['config_value'];
continue;
} elseif ($subvalue['config_key'] === 'rrd_cached') {
$rrdCached = $subvalue['config_value'];
}

if ($subvalue['config_key'] === 'rrd_cached') {
if ($rrdCached && $rrdCacheOption) {
if ($rrdCacheOption === 'tcp') {
$object[$key][$subvalue['config_group_id']]['port'] = $subvalue['config_value'];
$object[$key][$subvalue['config_group_id']]['port'] = $rrdCached;
} elseif ($rrdCacheOption === 'unix') {
$object[$key][$subvalue['config_group_id']]['path'] = $subvalue['config_value'];
$object[$key][$subvalue['config_group_id']]['path'] = $rrdCached;
}
continue;
}

} else {
$object[$key][$subvalue['config_group_id']][$subvalue['config_key']] =
$subvalue['config_value'];

Expand Down

0 comments on commit 54e10c7

Please sign in to comment.