adding ability to write a log file with all output from collector. Executing commands will now log be logged (and when debug is enabled, their output's are also logged).

This commit is contained in:
Jason Kulatunga
2020-09-19 18:51:35 -06:00
parent 67d1c592a5
commit 297f0a51c5
8 changed files with 51 additions and 9 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ func (mc *MetricsCollector) Collect(wg *sync.WaitGroup, deviceWWN string, device
}
args = append(args, fmt.Sprintf("%s%s", detect.DevicePrefix(), deviceName))
result, err := common.ExecCmd("smartctl", args, "", os.Environ())
result, err := common.ExecCmd(mc.logger, "smartctl", args, "", os.Environ())
resultBytes := []byte(result)
if err != nil {
if exitError, ok := err.(*exec.ExitError); ok {