* [pdm-devel] [RFC datacenter-manager 1/5] pdm-api-types/ui/resources: rename and bump PBS datastore high-usage
2025-10-27 14:25 [pdm-devel] [RFC datacenter-manager 0/5] show uptrending datastores in dashboard panel Christian Ebner
@ 2025-10-27 14:25 ` Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 2/5] pdm-api-types: extend datastore resources by optional estimated full Christian Ebner
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2025-10-27 14:25 UTC (permalink / raw)
To: pdm-devel
Renames the currently used high-usage to critical-usage and bumps the
limit to 95% usage threshold. This further escalates the value,
already bumped to 80% in commit b346b9a0 ("api types: increase
high-usage threshold from 75% to 80%"), with the intend to extend the
dashboard panel by an uptrending metric to show datastores which are
estimated to be full in the near future.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
lib/pdm-api-types/src/resource.rs | 12 ++++++------
server/src/api/resources.rs | 7 ++++---
ui/src/dashboard/pbs_datastores_panel.rs | 10 +++++-----
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index e3c84cf..def8500 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -7,8 +7,8 @@ use proxmox_schema::{api, ApiStringFormat, ApiType, EnumEntry, OneOfSchema, Sche
use super::remotes::{RemoteType, REMOTE_ID_SCHEMA};
-/// High PBS datastore usage threshold
-pub const PBS_DATASTORE_HIGH_USAGE_THRESHOLD: f64 = 0.80;
+/// Critical PBS datastore usage threshold
+pub const PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD: f64 = 0.95;
#[api(
"id-property": "id",
@@ -117,8 +117,8 @@ impl Resource {
if r.backing_device.is_some() {
properties.push("removable".to_string());
}
- if r.usage > PBS_DATASTORE_HIGH_USAGE_THRESHOLD {
- properties.push("high-usage".to_string());
+ if r.usage > PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD {
+ properties.push("critical-usage".to_string());
}
}
properties.join(",")
@@ -582,9 +582,9 @@ pub struct PbsDatastoreStatusCount {
pub online: u64,
/// Amount of datastores which are in a maintenance mode
pub in_maintenance: Option<u64>,
- /// Amount of datastores which have high datastore usage
+ /// Amount of datastores which have critical datastore usage
#[serde(skip_serializing_if = "Option::is_none")]
- pub high_usage: Option<u64>,
+ pub critical_usage: Option<u64>,
/// Amount of datastores in unknown state
#[serde(skip_serializing_if = "Option::is_none")]
pub unknown: Option<u64>,
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 57563b3..586c732 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -13,7 +13,8 @@ use pdm_api_types::remotes::{Remote, RemoteType};
use pdm_api_types::resource::{
FailedRemote, PbsDatastoreResource, PbsNodeResource, PveLxcResource, PveNodeResource,
PveQemuResource, PveSdnResource, PveStorageResource, RemoteResources, Resource, ResourceType,
- ResourcesStatus, SdnStatus, SdnZoneResource, TopEntities, PBS_DATASTORE_HIGH_USAGE_THRESHOLD,
+ ResourcesStatus, SdnStatus, SdnZoneResource, TopEntities,
+ PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD,
};
use pdm_api_types::subscription::{
NodeSubscriptionInfo, RemoteSubscriptionState, RemoteSubscriptions, SubscriptionLevel,
@@ -464,8 +465,8 @@ pub async fn get_status(
} else {
*counts.pbs_datastores.in_maintenance.get_or_insert_default() += 1;
}
- if r.usage > PBS_DATASTORE_HIGH_USAGE_THRESHOLD {
- *counts.pbs_datastores.high_usage.get_or_insert_default() += 1;
+ if r.usage > PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD {
+ *counts.pbs_datastores.critical_usage.get_or_insert_default() += 1;
}
if r.backing_device.is_some() {
*counts.pbs_datastores.removable.get_or_insert_default() += 1;
diff --git a/ui/src/dashboard/pbs_datastores_panel.rs b/ui/src/dashboard/pbs_datastores_panel.rs
index e028476..4cfc0c8 100644
--- a/ui/src/dashboard/pbs_datastores_panel.rs
+++ b/ui/src/dashboard/pbs_datastores_panel.rs
@@ -42,7 +42,7 @@ pub enum StatusRow {
InMaintenance(u64),
Removable(u64),
S3Backend(u64),
- HighUsage(u64),
+ CriticalUsage(u64),
Unknown(u64),
All(u64),
}
@@ -77,7 +77,7 @@ impl yew::Component for PbsDatastoresPanelComponent {
StatusRow::InMaintenance(status.in_maintenance.unwrap_or_default()),
StatusRow::Removable(status.removable.unwrap_or_default()),
StatusRow::S3Backend(status.s3_backend.unwrap_or_default()),
- StatusRow::HighUsage(status.high_usage.unwrap_or_default()),
+ StatusRow::CriticalUsage(status.critical_usage.unwrap_or_default()),
StatusRow::Unknown(status.unknown.unwrap_or_default()),
StatusRow::All(status.online + status.in_maintenance.unwrap_or_default()),
];
@@ -109,11 +109,11 @@ fn create_list_tile(
"Online",
Some(("online", "status")),
),
- StatusRow::HighUsage(count) => (
+ StatusRow::CriticalUsage(count) => (
Fa::from(Status::Warning),
count,
- "High usage",
- Some(("high-usage", "property")),
+ "Critical Usage",
+ Some(("critical-usage", "property")),
),
StatusRow::InMaintenance(count) => (
Fa::new("wrench"),
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [pdm-devel] [RFC datacenter-manager 2/5] pdm-api-types: extend datastore resources by optional estimated full
2025-10-27 14:25 [pdm-devel] [RFC datacenter-manager 0/5] show uptrending datastores in dashboard panel Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 1/5] pdm-api-types/ui/resources: rename and bump PBS datastore high-usage Christian Ebner
@ 2025-10-27 14:25 ` Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 3/5] server: resources: account for datastores with upwards usage trend Christian Ebner
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2025-10-27 14:25 UTC (permalink / raw)
To: pdm-devel
Collect the estimated full date so it can be used to count and filter
for datastores with a disk usage uptrend, estimated to be full within
the next 7 days, and therefore might need closer monitoring or
intervention.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
lib/pdm-api-types/src/resource.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index def8500..10ea123 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -9,6 +9,8 @@ use super::remotes::{RemoteType, REMOTE_ID_SCHEMA};
/// Critical PBS datastore usage threshold
pub const PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD: f64 = 0.95;
+/// PBS datastore fillup regression threshold (1 week as secs)
+pub const PBS_DATASTORE_FILLUP_THRESHOLD: u64 = 7 * 24 * 60 * 60;
#[api(
"id-property": "id",
@@ -508,6 +510,9 @@ pub struct PbsDatastoreResource {
/// Datastore backend type
#[serde(skip_serializing_if = "Option::is_none")]
pub backend_type: Option<String>,
+ /// Datastore estimated full date (unix epoch)
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub estimated_full_date: Option<i64>,
}
#[api(
@@ -585,6 +590,9 @@ pub struct PbsDatastoreStatusCount {
/// Amount of datastores which have critical datastore usage
#[serde(skip_serializing_if = "Option::is_none")]
pub critical_usage: Option<u64>,
+ /// Amount of datastores with an upwards usage trend
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub uptrending_usage: Option<u64>,
/// Amount of datastores in unknown state
#[serde(skip_serializing_if = "Option::is_none")]
pub unknown: Option<u64>,
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [pdm-devel] [RFC datacenter-manager 3/5] server: resources: account for datastores with upwards usage trend
2025-10-27 14:25 [pdm-devel] [RFC datacenter-manager 0/5] show uptrending datastores in dashboard panel Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 1/5] pdm-api-types/ui/resources: rename and bump PBS datastore high-usage Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 2/5] pdm-api-types: extend datastore resources by optional estimated full Christian Ebner
@ 2025-10-27 14:25 ` Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 4/5] ui: dashboard: show datastores with upwards trend in stats panel Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 5/5] pdm-api-types: calculate upwards trending datastore usage property Christian Ebner
4 siblings, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2025-10-27 14:25 UTC (permalink / raw)
To: pdm-devel
Count datastores for which the estimated full date is within 7 days
as uptrend usage. This is in preparation for showing these in the
PBS datastore statistics panel.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
server/src/api/resources.rs | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 586c732..97224f7 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -1,6 +1,7 @@
use std::collections::HashMap;
use std::str::FromStr;
use std::sync::{LazyLock, RwLock};
+use std::time::{SystemTime, UNIX_EPOCH};
use anyhow::{bail, format_err, Error};
use futures::future::join_all;
@@ -14,7 +15,7 @@ use pdm_api_types::resource::{
FailedRemote, PbsDatastoreResource, PbsNodeResource, PveLxcResource, PveNodeResource,
PveQemuResource, PveSdnResource, PveStorageResource, RemoteResources, Resource, ResourceType,
ResourcesStatus, SdnStatus, SdnZoneResource, TopEntities,
- PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD,
+ PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD, PBS_DATASTORE_FILLUP_THRESHOLD,
};
use pdm_api_types::subscription::{
NodeSubscriptionInfo, RemoteSubscriptionState, RemoteSubscriptions, SubscriptionLevel,
@@ -468,6 +469,20 @@ pub async fn get_status(
if r.usage > PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD {
*counts.pbs_datastores.critical_usage.get_or_insert_default() += 1;
}
+ if let Some(estimated_full) = r.estimated_full_date {
+ if let Ok(now) = SystemTime::now().duration_since(UNIX_EPOCH) {
+ let threshold = now.as_secs() + PBS_DATASTORE_FILLUP_THRESHOLD;
+ if estimated_full > 0
+ && (estimated_full as u64) > now.as_secs()
+ && (estimated_full as u64) < threshold
+ {
+ *counts
+ .pbs_datastores
+ .uptrending_usage
+ .get_or_insert_default() += 1;
+ }
+ }
+ }
if r.backing_device.is_some() {
*counts.pbs_datastores.removable.get_or_insert_default() += 1;
}
@@ -1074,6 +1089,7 @@ fn map_pbs_datastore_status(
maintenance: store_config.maintenance_mode.clone(),
backing_device: store_config.backing_device.clone(),
backend_type,
+ estimated_full_date: status.estimated_full_date,
})
} else {
Resource::PbsDatastore(PbsDatastoreResource {
@@ -1082,6 +1098,7 @@ fn map_pbs_datastore_status(
maxdisk,
disk,
usage,
+ estimated_full_date: status.estimated_full_date,
..Default::default()
})
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [pdm-devel] [RFC datacenter-manager 4/5] ui: dashboard: show datastores with upwards trend in stats panel
2025-10-27 14:25 [pdm-devel] [RFC datacenter-manager 0/5] show uptrending datastores in dashboard panel Christian Ebner
` (2 preceding siblings ...)
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 3/5] server: resources: account for datastores with upwards usage trend Christian Ebner
@ 2025-10-27 14:25 ` Christian Ebner
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 5/5] pdm-api-types: calculate upwards trending datastore usage property Christian Ebner
4 siblings, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2025-10-27 14:25 UTC (permalink / raw)
To: pdm-devel
Shows and allow to filter for datastores which have an upwards trend
which would lead to the datastore being full shortly.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/dashboard/pbs_datastores_panel.rs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/ui/src/dashboard/pbs_datastores_panel.rs b/ui/src/dashboard/pbs_datastores_panel.rs
index 4cfc0c8..ece918d 100644
--- a/ui/src/dashboard/pbs_datastores_panel.rs
+++ b/ui/src/dashboard/pbs_datastores_panel.rs
@@ -4,7 +4,7 @@ use pdm_api_types::resource::{PbsDatastoreStatusCount, ResourceType};
use pdm_search::{Search, SearchTerm};
use proxmox_yew_comp::Status;
use pwt::{
- css::{self, TextAlign},
+ css::{self, FontColor, TextAlign},
prelude::*,
widget::{Container, Fa, List, ListTile},
};
@@ -43,6 +43,7 @@ pub enum StatusRow {
Removable(u64),
S3Backend(u64),
CriticalUsage(u64),
+ UptrendingUsage(u64),
Unknown(u64),
All(u64),
}
@@ -78,6 +79,7 @@ impl yew::Component for PbsDatastoresPanelComponent {
StatusRow::Removable(status.removable.unwrap_or_default()),
StatusRow::S3Backend(status.s3_backend.unwrap_or_default()),
StatusRow::CriticalUsage(status.critical_usage.unwrap_or_default()),
+ StatusRow::UptrendingUsage(status.uptrending_usage.unwrap_or_default()),
StatusRow::Unknown(status.unknown.unwrap_or_default()),
StatusRow::All(status.online + status.in_maintenance.unwrap_or_default()),
];
@@ -115,6 +117,12 @@ fn create_list_tile(
"Critical Usage",
Some(("critical-usage", "property")),
),
+ StatusRow::UptrendingUsage(count) => (
+ Fa::new("arrow-up").class(FontColor::Warning),
+ count,
+ "Uptrendig Usage",
+ Some(("uptrending-usage", "property")),
+ ),
StatusRow::InMaintenance(count) => (
Fa::new("wrench"),
count,
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [pdm-devel] [RFC datacenter-manager 5/5] pdm-api-types: calculate upwards trending datastore usage property
2025-10-27 14:25 [pdm-devel] [RFC datacenter-manager 0/5] show uptrending datastores in dashboard panel Christian Ebner
` (3 preceding siblings ...)
2025-10-27 14:25 ` [pdm-devel] [RFC datacenter-manager 4/5] ui: dashboard: show datastores with upwards trend in stats panel Christian Ebner
@ 2025-10-27 14:25 ` Christian Ebner
4 siblings, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2025-10-27 14:25 UTC (permalink / raw)
To: pdm-devel
To allow filtering of PBS datastore resources with upwards trending
storage usage. Calculate base on the current system time.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
lib/pdm-api-types/src/resource.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index 10ea123..c7f24c2 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -1,4 +1,5 @@
use std::convert::Infallible;
+use std::time::{SystemTime, UNIX_EPOCH};
use anyhow::{bail, Error};
use serde::{Deserialize, Serialize};
@@ -122,6 +123,17 @@ impl Resource {
if r.usage > PBS_DATASTORE_CRITICAL_USAGE_THRESHOLD {
properties.push("critical-usage".to_string());
}
+ if let Some(estimated_full) = r.estimated_full_date {
+ if let Ok(now) = SystemTime::now().duration_since(UNIX_EPOCH) {
+ let threshold = now.as_secs() + PBS_DATASTORE_FILLUP_THRESHOLD;
+ if estimated_full > 0
+ && (estimated_full as u64) > now.as_secs()
+ && (estimated_full as u64) < threshold
+ {
+ properties.push("uptrendig-usage".to_string());
+ }
+ }
+ }
}
properties.join(",")
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread