Use direct smartctl with CAP_SYS_RAWIO instead of sudo
All checks were successful
Build and Release / build-and-release (push) Successful in 1m9s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m9s
This commit is contained in:
@@ -426,8 +426,9 @@ impl DiskCollector {
|
||||
async fn get_smart_data(&self, drive_name: &str) -> Result<SmartData, CollectorError> {
|
||||
use tracing::info;
|
||||
|
||||
let output = Command::new("sudo")
|
||||
.args(&["smartctl", "-a", &format!("/dev/{}", drive_name)])
|
||||
// Use direct smartctl (no sudo) - service has CAP_SYS_RAWIO capability
|
||||
let output = Command::new("smartctl")
|
||||
.args(&["-a", &format!("/dev/{}", drive_name)])
|
||||
.output()
|
||||
.map_err(|e| CollectorError::SystemRead {
|
||||
path: format!("SMART data for {}", drive_name),
|
||||
|
||||
Reference in New Issue
Block a user