From 25275c7c749f5981a9ca862687f9de38b8659b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Duret?= Date: Mon, 22 Jul 2024 09:44:38 +0200 Subject: [PATCH] Backport https://github.com/centreon/centreon/pull/4401/files --- .../modules/centreon/mbi/etl/perfdata/main.pm | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gorgone/gorgone/modules/centreon/mbi/etl/perfdata/main.pm b/gorgone/gorgone/modules/centreon/mbi/etl/perfdata/main.pm index 170903907c0..df7d3ed6abd 100644 --- a/gorgone/gorgone/modules/centreon/mbi/etl/perfdata/main.pm +++ b/gorgone/gorgone/modules/centreon/mbi/etl/perfdata/main.pm @@ -346,6 +346,30 @@ sub dailyProcessing { ] }; } + if (defined($etl->{run}->{etlProperties}->{'centile.week'}) && $etl->{run}->{etlProperties}->{'centile.week'} eq '1') { + push @{$etl->{run}->{schedule}->{perfdata}->{stages}->[0]}, { + type => 'sql', + db => 'centstorage', + sql => [ + [ + '[PARTITIONS] Add partition [p' . $partName . '] on table [mod_bi_metriccentileweeklyvalue]', + "ALTER TABLE `mod_bi_metriccentileweeklyvalue` ADD PARTITION (PARTITION `p$partName` VALUES LESS THAN(" . $epoch . "))" + ] + ] + }; + } + if (defined($etl->{run}->{etlProperties}->{'centile.month'}) && $etl->{run}->{etlProperties}->{'centile.month'} eq '1') { + push @{$etl->{run}->{schedule}->{perfdata}->{stages}->[0]}, { + type => 'sql', + db => 'centstorage', + sql => [ + [ + '[PARTITIONS] Add partition [p' . $partName . '] on table [mod_bi_metriccentilemonthlyvalue]', + "ALTER TABLE `mod_bi_metriccentilemonthlyvalue` ADD PARTITION (PARTITION `p$partName` VALUES LESS THAN(" . $epoch . "))" + ] + ] + }; + } # processing agregation by month. If the day is the first day of the month, also processing agregation by month processDayAndMonthAgregation($etl, $liveServices, $start, $end);