powerapi-ng / hwpc-sensor

Hardware Performance Counters monitoring agent for containers.
BSD 3-Clause "New" or "Revised" License
14 stars 16 forks source link

perf: perf_event_open failed with error: Permission denied #41

Closed Urhengulas closed 1 year ago

Urhengulas commented 1 year ago

Hi,

I am following the instructions for running the HWPC sensor with docker (link).

When I am executing the docker command in the "Running the Sensor via CLI parameters" section I am getting getting following error:

I: 23-09-21 20:23:06 build: version unknown (rev: unknown)
I: 23-09-21 20:23:06 uname: Linux 6.4.15-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep  7 00:25:01 UTC 2023 x86_64
E: 23-09-21 20:23:06 perf: perf_event_open failed with error: Permission denied
E: 23-09-21 20:23:06 perf: error while testing the perf_event support

Do I need to install some perf related package or give the container more permissions?

Urhengulas commented 1 year ago

sudo to the rescue!

Running the command with sudo docker run ... solves the problem.