Add a wait between disks checks

This commit is contained in:
Pablo Garcia
2024-11-07 11:54:46 +01:00
parent 57dc547265
commit 56a9454730
3 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -15,6 +15,7 @@ import (
"os"
"os/exec"
"strings"
"time"
)
type MetricsCollector struct {
@@ -90,8 +91,7 @@ func (mc *MetricsCollector) Run() error {
//go mc.Collect(&wg, device.WWN, device.DeviceName, device.DeviceType)
mc.Collect(device.WWN, device.DeviceName, device.DeviceType)
// TODO: we may need to sleep for between each call to smartctl -a
//time.Sleep(30 * time.Millisecond)
time.Sleep(time.Duration(mc.config.GetInt("commands.metrics_smartctl_wait")) * time.Millisecond)
}
//mc.logger.Infoln("Main: Waiting for workers to finish")
+1
View File
@@ -47,6 +47,7 @@ func (c *configuration) Init() error {
c.SetDefault("commands.metrics_scan_args", "--scan --json")
c.SetDefault("commands.metrics_info_args", "--info --json")
c.SetDefault("commands.metrics_smart_args", "--xall --json")
c.SetDefault("commands.metrics_smartctl_wait", 0)
//c.SetDefault("collect.short.command", "-a -o on -S on")