Remove storage info from immich, focus on connections only
This commit is contained in:
parent
322997932e
commit
c5795e3add
@ -911,9 +911,9 @@ impl ServiceCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn get_immich_info(&self) -> Option<String> {
|
async fn get_immich_info(&self) -> Option<String> {
|
||||||
// Check upload directory for photo count estimate
|
// Check HTTP connections - Immich typically runs on port 2283 or behind nginx
|
||||||
let output = Command::new("find")
|
let output = Command::new("/run/current-system/sw/bin/ss")
|
||||||
.args(["/var/lib/immich/upload", "-type", "f", "-name", "*.jpg", "-o", "-name", "*.png", "-o", "-name", "*.mp4", "-o", "-name", "*.mov"])
|
.args(["-tn", "state", "established", "dport", "= :2283"])
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
.output()
|
.output()
|
||||||
@ -922,25 +922,9 @@ impl ServiceCollector {
|
|||||||
|
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
let file_count = stdout.lines().count();
|
let connection_count = stdout.lines().count().saturating_sub(1);
|
||||||
if file_count > 0 {
|
if connection_count > 0 {
|
||||||
return Some(format!("~{} media files", file_count));
|
return Some(format!("{} connections", connection_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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user