Fix bug in graphite (#15393)

It was quite wrong.  Not sure if the fixed code is correct though.
fixes #15391
This commit is contained in:
Tony Murray
2023-10-05 14:38:48 -05:00
committed by GitHub
parent 9fca01830c
commit affb68e2bc

View File

@@ -103,12 +103,14 @@ class Graphite extends BaseDatastore
$hostname = preg_replace('/\./', '_', $device['hostname']);
$measurement = preg_replace(['/\./', '/\//'], '_', $measurement);
$measurement = preg_replace('/\|/', '.', $measurement);
$measurement_name = preg_replace('/\./', '_', $tags['rrd_name']);
if (is_array($measurement_name)) {
$ms_name = implode('.', $measurement_name);
$ms_name = $tags['rrd_name'] ?? '';
if (is_array($ms_name)) {
$ms_name = implode('.', $ms_name);
} else {
$ms_name = $measurement_name;
$ms_name = preg_replace('/\./', '_', $ms_name);
}
// remove the port-id tags from the metric
if (preg_match('/^port-id\d+/', $ms_name)) {
$ms_name = '';