From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster v3 4/4] rrd: adapt to new RRD format with different aggregation windows
Date: Tue, 15 Jul 2025 16:31:53 +0200 [thread overview]
Message-ID: <20250715143218.1548306-10-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20250715143218.1548306-1-a.lauterer@proxmox.com>
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 <a.lauterer@proxmox.com>
---
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
next prev parent reply other threads:[~2025-07-15 14:33 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 14:31 [pve-devel] [PATCH many v3 00/34] Expand and migrate RRD data and add/change summary graphs Aaron Lauterer
2025-07-15 14:31 ` [pve-devel] [PATCH cluster-pve8 v3 1/2] cfs status.c: drop old pve2-vm rrd schema support Aaron Lauterer
2025-07-16 22:32 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH cluster-pve8 v3 2/2] status: handle new metrics update data Aaron Lauterer
2025-07-16 22:32 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH manager-pve8 v3 1/2] api2tools: drop old VM rrd schema Aaron Lauterer
2025-07-16 22:32 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH manager-pve8 v3 2/2] api2tools: extract stats: handle existence of new pve-{type}-9.0 data Aaron Lauterer
2025-07-16 22:32 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH pve9-rrd-migration-tool v3 1/1] introduce rrd migration tool for pve8 -> pve9 Aaron Lauterer
2025-07-16 22:32 ` Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH cluster v3 1/4] cfs status.c: drop old pve2-vm rrd schema support Aaron Lauterer
2025-07-16 22:32 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH cluster v3 2/4] status: handle new metrics update data Aaron Lauterer
2025-07-16 22:32 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH cluster v3 3/4] status: introduce new pve-{type}- rrd and metric format Aaron Lauterer
2025-07-15 14:31 ` Aaron Lauterer [this message]
2025-07-15 14:31 ` [pve-devel] [PATCH common v3 1/2] fix error in pressure parsing Aaron Lauterer
2025-07-16 22:33 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH common v3 2/2] add function to retrieve pressures from cgroup Aaron Lauterer
2025-07-16 22:33 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH widget-toolkit v3 1/2] rrdchart: allow to override the series object Aaron Lauterer
2025-07-21 11:42 ` Dominik Csapak
2025-07-21 15:08 ` Aaron Lauterer
2025-07-15 14:31 ` [pve-devel] [PATCH widget-toolkit v3 2/2] rrdchart: use reference for undo button Aaron Lauterer
2025-07-21 11:43 ` Dominik Csapak
2025-07-15 14:31 ` [pve-devel] [PATCH manager v3 01/14] api2tools: drop old VM rrd schema Aaron Lauterer
2025-07-18 19:17 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:31 ` [pve-devel] [PATCH manager v3 02/14] api2tools: extract stats: handle existence of new pve-{type}-9.0 data Aaron Lauterer
2025-07-18 19:17 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 03/14] pvestatd: collect and distribute new pve-{type}-9.0 metrics Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 04/14] api: nodes: rrd and rrddata add decade option and use new pve-node-9.0 rrd files Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 05/14] api2tools: extract_vm_status add new vm memhost column Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 06/14] ui: rrdmodels: add new columns and update existing Aaron Lauterer
2025-07-21 11:48 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 07/14] ui: node summary: use stacked memory graph with zfs arc Aaron Lauterer
2025-07-21 12:01 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 08/14] ui: add pressure graphs to node and guest summary Aaron Lauterer
2025-07-21 12:05 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 09/14] ui: GuestStatusView: add memhost for VM guests Aaron Lauterer
2025-07-21 12:34 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 10/14] ui: GuestSummary: memory switch to stacked and add hostmem Aaron Lauterer
2025-07-21 12:37 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 11/14] ui: nodesummary: guestsummary: add tooltip info buttons Aaron Lauterer
2025-07-21 12:40 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 12/14] ui: summaries: use titles for disk and network series Aaron Lauterer
2025-07-21 12:40 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 13/14] ui: ResourceStore: add memhost column Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH manager v3 14/14] fix #6068: ui: utils: calculate and render host memory usage correctly Aaron Lauterer
2025-07-21 12:52 ` Dominik Csapak
2025-07-15 14:32 ` [pve-devel] [PATCH storage v3 1/1] status: rrddata: use new pve-storage-9.0 rrd location if file is present Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH qemu-server v3 1/4] metrics: add pressure to metrics Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH qemu-server v3 2/4] vmstatus: add memhost for host view of vm mem consumption Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH qemu-server v3 3/4] vmstatus: switch mem stat to PSS of VM cgroup Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH qemu-server v3 4/4] rrddata: use new pve-vm-9.0 rrd location if file is present Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH container v3 1/2] metrics: add pressures to metrics Aaron Lauterer
2025-07-15 14:32 ` [pve-devel] [PATCH container v3 2/2] rrddata: use new pve-vm-9.0 rrd location if file is present Aaron Lauterer
2025-07-23 10:15 ` [pve-devel] [PATCH many v3 00/34] Expand and migrate RRD data and add/change summary graphs Laurențiu Leahu-Vlăducu
2025-07-26 1:13 ` [pve-devel] SUPERSEEDED " Aaron Lauterer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250715143218.1548306-10-a.lauterer@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.