Add torrent copy operation monitoring
All checks were successful
Build and Release / build-and-release (push) Successful in 1m46s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m46s
Add real-time monitoring of torrent copy operations when completed downloads are copied from SSD to HDD storage. Changes: - Add marker file tracking during rsync operations - Monitor active copy operations via /tmp/torrent-copy-active - Display copy status as sub-service under openvpn-vpn-download - Show currently copying torrent name in dashboard The copy status appears as an informational sub-service while rsync is actively copying completed torrents to permanent storage, providing visibility into potentially long-running file transfer operations.
This commit is contained in:
@@ -178,6 +178,18 @@ impl SystemdCollector {
|
||||
service_type: "torrent_stats".to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
// Add active torrent copy status
|
||||
if let Some(torrent_name) = self.get_active_torrent_copy() {
|
||||
let metrics = Vec::new();
|
||||
|
||||
sub_services.push(SubServiceData {
|
||||
name: format!("Copy: {}", torrent_name),
|
||||
service_status: Status::Info,
|
||||
metrics,
|
||||
service_type: "torrent_copy".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if service_name == "nftables" && status_info.active_state == "active" {
|
||||
@@ -1088,6 +1100,18 @@ impl SystemdCollector {
|
||||
|
||||
Some((active_count, download_mbps, upload_mbps))
|
||||
}
|
||||
|
||||
/// Check if torrent copy script is actively running
|
||||
/// Returns: Some(torrent_name) if copy is in progress, None otherwise
|
||||
fn get_active_torrent_copy(&self) -> Option<String> {
|
||||
let marker_path = "/tmp/torrent-copy-active";
|
||||
|
||||
// Check if marker file exists and read torrent name
|
||||
std::fs::read_to_string(marker_path)
|
||||
.ok()
|
||||
.map(|content| content.trim().to_string())
|
||||
.filter(|name| !name.is_empty())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
||||
Reference in New Issue
Block a user