diff --git a/Cargo.lock b/Cargo.lock index b9769da..25df4df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.267" +version = "0.1.268" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.267" +version = "0.1.268" dependencies = [ "anyhow", "async-trait", @@ -325,7 +325,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.267" +version = "0.1.268" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 6bc6e57..cf0728f 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.267" +version = "0.1.268" edition = "2021" [dependencies] diff --git a/agent/src/collectors/backup.rs b/agent/src/collectors/backup.rs index c85c0b4..7512d55 100644 --- a/agent/src/collectors/backup.rs +++ b/agent/src/collectors/backup.rs @@ -21,7 +21,7 @@ impl BackupCollector { } } - /// Scan directory for all backup status files + /// Scan directory for backup status file (nfs-backup.toml) async fn scan_status_files(&self) -> Result, CollectorError> { let status_path = Path::new(&self.status_dir); @@ -30,30 +30,15 @@ impl BackupCollector { return Ok(Vec::new()); } - let mut status_files = Vec::new(); - - match fs::read_dir(status_path) { - Ok(entries) => { - for entry in entries { - if let Ok(entry) = entry { - let path = entry.path(); - if path.is_file() { - if let Some(filename) = path.file_name().and_then(|n| n.to_str()) { - if filename.starts_with("backup-status-") && filename.ends_with(".toml") { - status_files.push(path); - } - } - } - } - } - } - Err(e) => { - warn!("Failed to read backup status directory: {}", e); - return Ok(Vec::new()); - } + // Look for nfs-backup.toml (new NFS-based backup) + let nfs_backup_file = status_path.join("nfs-backup.toml"); + if nfs_backup_file.exists() { + return Ok(vec![nfs_backup_file]); } - Ok(status_files) + // No backup status file found + debug!("No nfs-backup.toml found in {}", self.status_dir); + Ok(Vec::new()) } /// Read a single backup status file @@ -76,7 +61,7 @@ impl BackupCollector { /// Calculate backup status from TOML status field fn calculate_backup_status(status_str: &str) -> Status { match status_str.to_lowercase().as_str() { - "success" => Status::Ok, + "success" | "completed" => Status::Ok, "warning" => Status::Warning, "failed" | "error" => Status::Critical, _ => Status::Unknown, diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 7bb41b9..8bbcdcc 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.267" +version = "0.1.268" edition = "2021" [dependencies] diff --git a/shared/Cargo.toml b/shared/Cargo.toml index f93f3c7..668ed24 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.267" +version = "0.1.268" edition = "2021" [dependencies]