[pve-devel] [PATCH manager v2 4/5] api: nodes: rrd and rrddata add decade option and use new pve-node-9.0 rrd files
Aaron Lauterer
a.lauterer at proxmox.com
Wed Jul 9 18:36:55 CEST 2025
if the new rrd pve-node-9.0 files are present, they contain the current
data and should be used.
'decade' is now possible as timeframe with the new RRD format.
Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
Notes:
changes since:
RFC:
* switch from pve9- to pve-{type}-9.0 schema
PVE/API2/Nodes.pm | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 1eb04d9a..69b3d873 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -836,7 +836,7 @@ __PACKAGE__->register_method({
timeframe => {
description => "Specify the time frame you are interested in.",
type => 'string',
- enum => ['hour', 'day', 'week', 'month', 'year'],
+ enum => ['hour', 'day', 'week', 'month', 'year', 'decade'],
},
ds => {
description => "The list of datasources you want to display.",
@@ -860,9 +860,10 @@ __PACKAGE__->register_method({
code => sub {
my ($param) = @_;
- return PVE::RRD::create_rrd_graph(
- "pve2-node/$param->{node}", $param->{timeframe}, $param->{ds}, $param->{cf},
- );
+ my $path = "pve-node-9.0/$param->{node}";
+ $path = "pve2-node/$param->{node}" if !-e "/var/lib/rrdcached/db/${path}";
+ return PVE::RRD::create_rrd_graph($path, $param->{timeframe},
+ $param->{ds}, $param->{cf});
},
});
@@ -883,7 +884,7 @@ __PACKAGE__->register_method({
timeframe => {
description => "Specify the time frame you are interested in.",
type => 'string',
- enum => ['hour', 'day', 'week', 'month', 'year'],
+ enum => ['hour', 'day', 'week', 'month', 'year', 'decade'],
},
cf => {
description => "The RRD consolidation function",
@@ -903,8 +904,9 @@ __PACKAGE__->register_method({
code => sub {
my ($param) = @_;
- return PVE::RRD::create_rrd_data("pve2-node/$param->{node}", $param->{timeframe},
- $param->{cf});
+ my $path = "pve-node-9.0/$param->{node}";
+ $path = "pve2-node/$param->{node}" if !-e "/var/lib/rrdcached/db/${path}";
+ return PVE::RRD::create_rrd_data($path, $param->{timeframe}, $param->{cf});
},
});
--
2.39.5
More information about the pve-devel
mailing list