diff --git a/devolutions-gateway/src/api/heartbeat.rs b/devolutions-gateway/src/api/heartbeat.rs index b80ebf0fb..1447b7915 100644 --- a/devolutions-gateway/src/api/heartbeat.rs +++ b/devolutions-gateway/src/api/heartbeat.rs @@ -17,6 +17,8 @@ pub(crate) struct Heartbeat { version: &'static str, /// Number of running sessions running_session_count: usize, + /// Whether the recording storage is writteable or not. + recording_storage_is_writteable: bool, /// The total space of the disk used to store recordings, in bytes. #[serde(skip_serializing_if = "Option::is_none")] recording_storage_total_space: Option, @@ -54,6 +56,18 @@ pub(super) async fn get_heartbeat( .await .map_err(HttpError::internal().err())?; + let recording_storage_is_writteable = { + let probe_file = conf.recording_path.join("probe"); + + let is_ok = std::fs::write(&probe_file, ".").is_ok(); + + if is_ok { + let _ = std::fs::remove_file(probe_file); + } + + is_ok + }; + let (recording_storage_total_space, recording_storage_available_space) = if sysinfo::IS_SUPPORTED_SYSTEM { trace!("System is supporting listing storage disks"); @@ -98,6 +112,7 @@ pub(super) async fn get_heartbeat( hostname: conf.hostname.clone(), version: env!("CARGO_PKG_VERSION"), running_session_count, + recording_storage_is_writteable, recording_storage_total_space, recording_storage_available_space, }))