google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
17.22k stars 2.33k forks source link

v0.49.1 arm64 - Error while reading product_name: open /sys/class/dmi/id/product_name: no such file or directory #3493

Open Chippi opened 8 months ago

Chippi commented 8 months ago

Upon upgrading from version 47.2 to 0.49.1, the following lines are repeatedly logged every 5 minutes:

Errors

I0306 22:52:36.995727       1 sysinfo.go:303] Found cpu without cache information, cpuPath: [/sys/devices/system/cpu/cpu0 /sys/devices/system/cpu/cpu1 /sys/devices/system/cpu/cpu2 /sys/devices/system/cpu/cpu3]

I0306 22:52:36.995817       1 gce.go:44] Error while reading product_name: open /sys/class/dmi/id/product_name: no such file or directory

Specs

Docker compose

version: '3.8'
services:
  cadvisor:
    container_name: cadvisor
    image: gcr.io/cadvisor/cadvisor-arm64:v0.49.1
    privileged: true
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:ro
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
      - /dev/disk/:/dev/disk:ro
      - /etc/machine-id:/etc/machine-id:ro # Fixes UUID error
    ports:
      - 8080:8080
    devices:
      - /dev/kmsg
    command:
      - '-docker_only=true'
      - '-storage_duration=1m0s'
      - '-enable_metrics=cpu,memory,diskIO'
    healthcheck:
      disable: true
moto-ctrl commented 7 months ago

I just noticed the same on RPi4 - any solution to this?

stijn2911 commented 6 months ago

I'm also having the same problem. path /sys/class/dmi/ does not seem to exist on my rpi4. Does this have to do with ARM architecture?

100kimch commented 5 months ago

Mine too. same logs are shown in jetson nano.

dzonder commented 4 months ago

I'm seeing the same on RPi devices. Any way to de-verbose this? It's causing a lot of churn in the logs.

jlkDE commented 3 months ago

Seems to stem from file utils/cloudinfo/gce/gce.go:

const (
    gceProductName = "/sys/class/dmi/id/product_name"
)

...

func (provider) IsActiveProvider() bool {
    data, err := os.ReadFile(gceProductName)
    if err != nil {
        klog.V(2).Infof("Error while reading product_name: %v", err)
        return false
    }
    return strings.Contains(string(data), google)
}

The following patch suppresses the log only if the file is not found:

diff --git utils/cloudinfo/gce/gce.go utils/cloudinfo/gce/gce.go
index ee078619..20279fbb 100644
--- utils/cloudinfo/gce/gce.go
+++ utils/cloudinfo/gce/gce.go
@@ -15,6 +15,7 @@
 package gce

 import (
+       "errors"
        "os"
        "strings"

@@ -41,7 +42,9 @@ type provider struct{
 func (provider) IsActiveProvider() bool {
        data, err := os.ReadFile(gceProductName)
        if err != nil {
-               klog.V(2).Infof("Error while reading product_name: %v", err)
+               if !errors.Is(err, os.ErrNotExist) {
+                       klog.V(2).Infof("Error while reading product_name: %v", err)
+               }
                return false
        }
        return strings.Contains(string(data), google)