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

fix(conf/export) broker RRDcacheD export (#11811) #11834

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']) ||
a-launois marked this conversation as resolved.
Show resolved Hide resolved
$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