From 8004d4c4e5b77dc438b07826aee4fe1aedbd5682 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 8 Apr 2024 16:44:59 +0200 Subject: [PATCH] Template: Fix multi template graphs The Bug: It was not possible to create graphs with multi3 template graphs if different metrics or different numbers of metrics were given per graph. Example (with 3 graphs): graph 1: value, min, max, crit, warning graph 2: value, crit, max, warning graph 3: value, min --- library/Graphite/Graphing/Template.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/Graphite/Graphing/Template.php b/library/Graphite/Graphing/Template.php index 0950fed0..e804078d 100644 --- a/library/Graphite/Graphing/Template.php +++ b/library/Graphite/Graphing/Template.php @@ -207,8 +207,13 @@ protected function combineMetrics( $allowedNextCurveMetricsPerCurrentCurveName = []; foreach ($currentCombination as $currentCurveName => $currentCurveMetric) { - $allowedNextCurveMetricsPerCurrentCurveName[$currentCurveName] - = $possibleCombinations[$currentCurveName][$nextCurveName][$currentCurveMetric]; + if (isset($possibleCombinations[$currentCurveName][$nextCurveName][$currentCurveMetric])) { + $allowedNextCurveMetricsPerCurrentCurveName[$currentCurveName] + = $possibleCombinations[$currentCurveName][$nextCurveName][$currentCurveMetric]; + } else { + $metricsCombinations[] = $currentCombination; + return; + } } $allowedNextCurveMetrics = $allowedNextCurveMetricsPerCurrentCurveName[$currentCurveName];