Remove storage info from immich, focus on connections only

This commit is contained in:
Christoffer Martinsson 2025-10-13 19:47:45 +02:00
parent 322997932e
commit c5795e3add

View File

@ -911,9 +911,9 @@ impl ServiceCollector {
}
async fn get_immich_info(&self) -> Option<String> {
// Check upload directory for photo count estimate
let output = Command::new("find")
.args(["/var/lib/immich/upload", "-type", "f", "-name", "*.jpg", "-o", "-name", "*.png", "-o", "-name", "*.mp4", "-o", "-name", "*.mov"])
// Check HTTP connections - Immich typically runs on port 2283 or behind nginx
let output = Command::new("/run/current-system/sw/bin/ss")
.args(["-tn", "state", "established", "dport", "= :2283"])
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
@ -922,25 +922,9 @@ impl ServiceCollector {
if output.status.success() {
let stdout = String::from_utf8_lossy(&output.stdout);
let file_count = stdout.lines().count();
if file_count > 0 {
return Some(format!("~{} media files", file_count));
}
}
// Fallback: check storage usage
let output = Command::new("sudo")
.args(["/run/current-system/sw/bin/du", "-sh", "/var/lib/immich/upload"])
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
.await
.ok()?;
if output.status.success() {
let stdout = String::from_utf8_lossy(&output.stdout);
if let Some(size) = stdout.split_whitespace().next() {
return Some(format!("Storage: {}", size));
let connection_count = stdout.lines().count().saturating_sub(1);
if connection_count > 0 {
return Some(format!("{} connections", connection_count));
}
}