hubblo-org / scaphandre

⚡ Energy consumption metrology agent. Let "scaph" dive and bring back the metrics that will help you make your systems and applications more sustainable !
Apache License 2.0
1.65k stars 109 forks source link

Running scaphandre_linux returns "0 W" #351

Open ionutbalosin opened 10 months ago

ionutbalosin commented 10 months ago

Please see below the full details.

$ scaphandre_linux_amd64 -s powercap_rapl stdout

Scaphandre stdout exporter
Sending ⚡ metrics
Measurement step is: 2s
Host:   0 W
    package     core        uncore
Top 5 consumers:
Power       PID Exe
No processes found yet or filter returns no value.
------------------------------------------------------------

Host:   0 W
    package     core        uncore
Top 5 consumers:
Power       PID Exe
0 W 2599    "gnome-shell"
0 W 4704    "gnome-terminal-"
0 W 796 "systemd-oomd"
0 W 3612    "Xwayland"
0 W 1   "systemd"
------------------------------------------------------------

Host:   0 W
    package     core        uncore
Top 5 consumers:
Power       PID Exe
0 W 2599    "gnome-shell"
0 W 848 "dbus-daemon"
0 W 1116    "containerd"
0 W 4704    "gnome-terminal-"
0 W 1   "systemd"
------------------------------------------------------------
...

$ powercap-info -p intel-rapl

enabled: 1
Zone 0
  name: package-0
  enabled: 1
  max_energy_range_uj: 262143328850
  Constraint 0
    name: long_term
    power_limit_uw: 200000000
    time_window_us: 31981568
    max_power_uw: 55000000
  Constraint 1
    name: short_term
    power_limit_uw: 30000000
    time_window_us: 2440
    max_power_uw: 0
  Constraint 2
    name: peak_power
    power_limit_uw: 246000000
    max_power_uw: 0
  Zone 0:0
    name: core
    enabled: 0
    max_energy_range_uj: 262143328850
    Constraint 0
      name: long_term
      power_limit_uw: 0
      time_window_us: 976
  Zone 0:1
    name: uncore
    enabled: 0
    max_energy_range_uj: 262143328850
    Constraint 0
      name: long_term
      power_limit_uw: 0
      time_window_us: 976
Zone 1
  name: psys
  enabled: 1
  max_energy_range_uj: 262143328850
  Constraint 0
    name: long_term
    power_limit_uw: 280000000
    time_window_us: 999424
  Constraint 1
    name: short_term
    power_limit_uw: 280000000
    time_window_us: 976

$ cat /proc/cpuinfo

model       : 183
model name  : 13th Gen Intel(R) Core(TM) i9-13900HX

$ uname -a Linux ubuntu 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Is this not supported on my CPU?

Thanks Ionut Balosin

jnioche commented 10 months ago

Same here on Linux Mint running on

model name : 12th Gen Intel(R) Core(TM) i7-12700H

jnioche commented 9 months ago

Version 1.0 gives a useful error message

scaphandre::sensors: Could'nt read record from /sys/class/powercap/intel-rapl:0/energy_uj, error was: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

Changing the rights with sudo chmod -R a+r /sys/class/powercap/intel-rapl fixed the issue See https://github.com/mlco2/codecarbon/issues/244

@bpetit I will check the README and docs later on + submit a PR to add the instructions if missing

edit - I can see now that the init.sh script exists for that very purpose and that its use is documented both in sensor-powercap_rapl.md and troubleshooting.md

@ionutbalosin can you please check whether calling init.sh fixes the issue for you?

JMLX42 commented 4 months ago

@jnioche I am running scaphandre on a K8S cluster following this documentation:

https://hubblo-org.github.io/scaphandre-documentation/tutorials/kubernetes.html

I have followed this workaround: https://github.com/mlco2/codecarbon/issues/244

Yet, even if my user can now read the file:

$ cat /sys/class/powercap/intel-rapl:0/energy_uj
13956425892

I still get an error in the logs of the scaphandre pod:

$ kubectl logs scaphandre-tfldv -n monitoring --timestamps=true -f
2024-07-23T13:49:31.418916867Z scaphandre::sensors: Sysinfo sees 24
2024-07-23T13:49:31.422281808Z Scaphandre prometheus exporter
2024-07-23T13:49:31.422291908Z Sending ⚡ metrics
2024-07-23T13:49:31.422294098Z Press CTRL-C to stop scaphandre
2024-07-23T13:50:25.034472133Z scaphandre::sensors: Could'nt read record from /sys/class/powercap/intel-rapl:0/energy_uj, error was: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
maxence974 commented 2 months ago

hi !

any updates please ? same issue on cluster K8s !

nothing change with "sudo chmod -R a+r /sys/class/powercap/intel-rapl", access isstill denied

my proc: Intel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz

thanks in advance!

CalmaIndustry commented 2 months ago

Hello

I fixed using privileged:true in my container https://github.com/hubblo-org/scaphandre/pull/391 could you please review