diff --git a/agent/agent_unix.go b/agent/agent_unix.go index 286ba32..3156793 100644 --- a/agent/agent_unix.go +++ b/agent/agent_unix.go @@ -395,11 +395,12 @@ func (a *Agent) GetWMIInfo() map[string]interface{} { // disks block, err := ghw.Block(ghw.WithDisableWarnings()) + ignore := []string{"ram", "loop"} if err != nil { a.Logger.Errorln("ghw.Block()", err) } else { for _, disk := range block.Disks { - if disk.IsRemovable || strings.Contains(disk.Name, "ram") { + if disk.IsRemovable || contains(disk.Name, ignore) { continue } ret := fmt.Sprintf("%s %s %s %s %s %s", disk.Vendor, disk.Model, disk.StorageController, disk.DriveType, disk.Name, ByteCountSI(disk.SizeBytes)) diff --git a/agent/utils.go b/agent/utils.go index 8e596b6..f7333ca 100644 --- a/agent/utils.go +++ b/agent/utils.go @@ -311,6 +311,15 @@ func removeNewlines(s string) string { return strings.ReplaceAll(s, "\n", "") } +func contains(s string, substrs []string) bool { + for _, substr := range substrs { + if strings.Contains(s, substr) { + return true + } + } + return false +} + func stringInSlice(a string, list []string) bool { for _, b := range list { if b == a {