From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/1] fix #4077: Estimated Full metric on ext4 file systems
Date: Fri, 27 May 2022 12:57:28 +0200 [thread overview]
Message-ID: <20220527105728.132412-2-d.tschlatscher@proxmox.com> (raw)
In-Reply-To: <20220527105728.132412-1-d.tschlatscher@proxmox.com>
The estimated full statistics metric no longer uses the total amount
of space on a disk, but rather the still available. Also refactored
some variable names for the 'estimated_full' calculation to make it
clearer what changed/is used now.
Note: Statistics for 'available' were not tracked in the rrdb before,
existing datastores will therefore show a somewhat incorrect value for
'estimated_full', at least until it is populated with enough new
values.
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
---
src/api2/status.rs | 14 +++++++-------
src/bin/proxmox-backup-proxy.rs | 2 ++
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/api2/status.rs b/src/api2/status.rs
index 45aa7fd7..f7d96c49 100644
--- a/src/api2/status.rs
+++ b/src/api2/status.rs
@@ -88,25 +88,25 @@ pub fn datastore_status(
let get_rrd =
|what: &str| extract_rrd_data(&rrd_dir, what, RRDTimeFrame::Month, RRDMode::Average);
- let total_res = get_rrd("total")?;
+ let avail_res = get_rrd("available")?;
let used_res = get_rrd("used")?;
- if let (Some((start, reso, total_list)), Some((_, _, used_list))) = (total_res, used_res) {
+ if let (Some((start, reso, avail_list)), Some((_, _, used_list))) = (avail_res, used_res) {
let mut usage_list: Vec<f64> = Vec::new();
let mut time_list: Vec<u64> = Vec::new();
let mut history = Vec::new();
for (idx, used) in used_list.iter().enumerate() {
- let total = if idx < total_list.len() {
- total_list[idx]
+ let available = if idx < avail_list.len() {
+ avail_list[idx]
} else {
None
};
- match (total, used) {
- (Some(total), Some(used)) if total != 0.0 => {
+ match (available, used) {
+ (Some(available), Some(used)) if available != 0.0 => {
time_list.push(start + (idx as u64) * reso);
- let usage = used / total;
+ let usage = used / available;
usage_list.push(usage);
history.push(Some(usage));
}
diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index 659f7b4a..82f40a54 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -1140,6 +1140,8 @@ fn gather_disk_stats(disk_manager: Arc<DiskManage>, path: &Path, rrd_prefix: &st
rrd_update_gauge(&rrd_key, status.total as f64);
let rrd_key = format!("{}/used", rrd_prefix);
rrd_update_gauge(&rrd_key, status.used as f64);
+ let rrd_key = format!("{}/available", rrd_prefix);
+ rrd_update_gauge(&rrd_key, status.avail as f64);
}
Err(err) => {
eprintln!("read disk_usage on {:?} failed - {}", path, err);
--
2.30.2
next prev parent reply other threads:[~2022-05-27 10:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 10:57 [pbs-devel] [PATCH proxmox-backup 1/1] ext4 filesystems no longer reserve blocks when created as a datastore Daniel Tschlatscher
2022-05-27 10:57 ` Daniel Tschlatscher [this message]
2022-05-27 11:40 ` [pbs-devel] [PATCH proxmox-backup 1/1] fix #4077: Estimated Full metric on ext4 file systems Daniel Tschlatscher
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=20220527105728.132412-2-d.tschlatscher@proxmox.com \
--to=d.tschlatscher@proxmox.com \
--cc=pbs-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.