Merge pull request #710 from pabsi/706-add-wait-time-between-checks

Add a wait between disks checks
master
Jason Kulatunga 1 month ago committed by GitHub
commit 0641b5e79d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,6 +15,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"strings" "strings"
"time"
) )
type MetricsCollector struct { type MetricsCollector struct {
@ -90,8 +91,9 @@ func (mc *MetricsCollector) Run() error {
//go mc.Collect(&wg, device.WWN, device.DeviceName, device.DeviceType) //go mc.Collect(&wg, device.WWN, device.DeviceName, device.DeviceType)
mc.Collect(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 if mc.config.GetInt("commands.metrics_smartctl_wait") > 0 {
//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") //mc.logger.Infoln("Main: Waiting for workers to finish")

@ -47,6 +47,7 @@ func (c *configuration) Init() error {
c.SetDefault("commands.metrics_scan_args", "--scan --json") c.SetDefault("commands.metrics_scan_args", "--scan --json")
c.SetDefault("commands.metrics_info_args", "--info --json") c.SetDefault("commands.metrics_info_args", "--info --json")
c.SetDefault("commands.metrics_smart_args", "--xall --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") //c.SetDefault("collect.short.command", "-a -o on -S on")

@ -81,6 +81,7 @@ devices:
# metrics_scan_args: '--scan --json' # used to detect devices # metrics_scan_args: '--scan --json' # used to detect devices
# metrics_info_args: '--info --json' # used to determine device unique ID & register device with Scrutiny # metrics_info_args: '--info --json' # used to determine device unique ID & register device with Scrutiny
# metrics_smart_args: '--xall --json' # used to retrieve smart data for each device. # metrics_smart_args: '--xall --json' # used to retrieve smart data for each device.
# metrics_smartctl_wait: 0 # time to wait in seconds between each disk's check
######################################################################################################################## ########################################################################################################################

Loading…
Cancel
Save