handle case where WWN not detected for a device (print error messages, but skip device collection & uploading).

This commit is contained in:
Jason Kulatunga
2022-05-05 23:03:06 -07:00
parent 3dbe59781c
commit fabc629e40
3 changed files with 11 additions and 1 deletions
+4
View File
@@ -107,6 +107,10 @@ func (mc *MetricsCollector) Validate() error {
//func (mc *MetricsCollector) Collect(wg *sync.WaitGroup, deviceWWN string, deviceName string, deviceType string) {
func (mc *MetricsCollector) Collect(deviceWWN string, deviceName string, deviceType string) {
//defer wg.Done()
if len(deviceWWN) == 0 {
mc.logger.Errorf("no device WWN detected for %s. Skipping collection for this device (no data association possible).\n", deviceName)
return
}
mc.logger.Infof("Collecting smartctl results for %s\n", deviceName)
args := []string{"-x", "-j"}