From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 96D6E1FF15F for ; Sat, 26 Jul 2025 03:05:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B6A41315AF; Sat, 26 Jul 2025 03:06:35 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Sat, 26 Jul 2025 03:06:00 +0200 Message-Id: <20250726010626.1496866-6-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250726010626.1496866-1-a.lauterer@proxmox.com> References: <20250726010626.1496866-1-a.lauterer@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753491982157 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [rrd.pm] Subject: [pve-devel] [PATCH cluster v4 2/2] rrd: adapt to new RRD format with different aggregation windows X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" With PVE9 we introduced a new RRD format that has different aggregation steps, similar to what we use in the Backup Server. We therefore need to adapt the functions that get data from RRD accordingly. The result is usually a finer resolution for time windows larger than hourly. We also introduce decade as a time window. In case existing RRD files have not yet been converted to the new RRD format, we need keep using the old time windows. Additionally, since they only store data up to a year, we catch the situation where a full decade might be requested and pin it to a year. Signed-off-by: Aaron Lauterer --- src/PVE/RRD.pm | 52 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/src/PVE/RRD.pm b/src/PVE/RRD.pm index 93df608..c95f495 100644 --- a/src/PVE/RRD.pm +++ b/src/PVE/RRD.pm @@ -14,14 +14,30 @@ sub create_rrd_data { my $rrd = "$rrddir/$rrdname"; + # Format: [ resolution, number of data points/count] + # Old ranges, pre PVE9 + my $setup_pve2 = { + hour => [60, 60], # 1 min resolution, one hour + day => [60 * 30, 70], # 30 min resolution, one day + week => [60 * 180, 70], # 3 hour resolution, one week + month => [60 * 720, 70], # 12 hour resolution, 1 month + year => [60 * 10080, 70], # 7 day resolution, 1 year + }; + my $setup = { - hour => [60, 70], - day => [60 * 30, 70], - week => [60 * 180, 70], - month => [60 * 720, 70], - year => [60 * 10080, 70], + hour => [60, 60], # 1 min resolution + day => [60, 1440], # 1 min resolution, full day + week => [60 * 30, 336], # 30 min resolution, 7 days + month => [3600 * 6, 121], # 6 hour resolution, 30 days, need one more count. Otherwise RRD gets wrong $step + year => [3600 * 6, 1140], # 6 hour resolution, 360 days + decade => [86400 * 7, 570], # 1 week resolution, 10 years }; + if ($rrdname =~ /^pve2/) { + $setup = $setup_pve2; + $timeframe = "year" if $timeframe eq "decade"; # we only store up to one year in the old format + } + my ($reso, $count) = @{ $setup->{$timeframe} }; my $ctime = $reso * int(time() / $reso); my $req_start = $ctime - $reso * $count; @@ -82,14 +98,30 @@ sub create_rrd_graph { my $filename = "${rrd}_${ds_txt}.png"; + # Format: [ resolution, number of data points/count] + # Old ranges, pre PVE9 + my $setup_pve2 = { + hour => [60, 60], # 1 min resolution, one hour + day => [60 * 30, 70], # 30 min resolution, one day + week => [60 * 180, 70], # 3 hour resolution, one week + month => [60 * 720, 70], # 12 hour resolution, 1 month + year => [60 * 10080, 70], # 7 day resolution, 1 year + }; + my $setup = { - hour => [60, 60], - day => [60 * 30, 70], - week => [60 * 180, 70], - month => [60 * 720, 70], - year => [60 * 10080, 70], + hour => [60, 60], # 1 min resolution + day => [60, 1440], # 1 min resolution, full day + week => [60 * 30, 336], # 30 min resolution, 7 days + month => [3600 * 6, 121], # 6 hour resolution, 30 days, need one more count. Otherwise RRD gets wrong $step + year => [3600 * 6, 1140], # 6 hour resolution, 360 days + decade => [86400 * 7, 570], # 1 week resolution, 10 years }; + if ($rrdname =~ /^pve2/) { + $setup = $setup_pve2; + $timeframe = "year" if $timeframe eq "decade"; # we only store up to one year in the old format + } + my ($reso, $count) = @{ $setup->{$timeframe} }; my @args = ( -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel