lukasmalkmus / rpi_exporter

A Raspberry Pi CPU temperature exporter.
Apache License 2.0
79 stars 17 forks source link

Exporter does not work with RPI4 with Ubuntu arm64 #13

Closed lukehoersten closed 4 years ago

lukehoersten commented 4 years ago

May 05 17:35:37 rpi-ubuntu rpi_exporter[53712]: time="2020-05-05T17:35:37-05:00" level=error msg="gpu collector failed after 0.002819s: fork/exec /opt/vc/bin/vcgencmd: no such file or directory" source="collector.go:142"

The Ubuntu arm64 image allows for 64bit rpi applications though the /opt/vc/ is not something that's available.

Maybe need an alternate approach like this: https://askubuntu.com/questions/15832/how-do-i-get-the-cpu-temperature

https://github.com/lukasmalkmus/rpi_exporter/blob/8bef384ed5eaa5e0666e6f8289b898881270dcbc/collector/gpu.go#L38 for reference

lukasmalkmus commented 4 years ago

Yes, in theory we could change how we collect the temperate on different systems.

Just for reference: https://github.com/lukasmalkmus/rpi_exporter/issues/11 and https://github.com/carlosedp/docker-arm_exporter/issues/4. Is it possible to install libraspberrypi-bin?

I don't have a Pi4 at my hands so I either need to make a fire and forget approach and hope it works without testing it on a live Pi or we iterate together on another branch. If you feel confident you could check out that branch, build from source and test that for me.

gclawes commented 4 years ago

On a side note, is it possible to combine these 2 projects (carlosedp/docker-arm_exporter and lukasmalkmus/rpi_exporter)? Going back and forth between for these issues is a bit annoying. @lukasmalkmus @carlosedp

lukehoersten commented 4 years ago

I can definitely compile from source to test on the pi4 ubuntu amd64. Just let me know what to try. I don't know Go but I can certainly figure out how to build and run it.

lukehoersten commented 4 years ago

https://www.reddit.com/r/raspberry_pi/comments/ggym7f/ubuntu_2004_lts_for_raspberry_pi/fq6evk6/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

Looks like can just query the file system

lukasmalkmus commented 4 years ago

@gclawes I wouldn't mind that, however @carlosedp did all the work on the Docker stuff. He's also the owner of the DockerHub repo. But maybe we can use GitHub Actions to get something going? Let's wait for his opinion.

lukasmalkmus commented 4 years ago

@lukehoersten Sounds good. But give some time to iterate, bit busy atm. I try to bring up something...

lukasmalkmus commented 4 years ago

@lukehoersten I looked at the link and we are actually reading from that file: https://github.com/lukasmalkmus/rpi_exporter/blob/5372e0aa9edb1466e9abe031237c3ec632bbacf8/collector/cpu.go#L41

It is just the GPU collector that fails in your case. Can you check https://github.com/carlosedp/docker-arm_exporter/issues/4 again? There have been some comments and updates to the Docker image? How are you running the exporter? Binary or Docker image?

gclawes commented 4 years ago

Does anyone know how vcgencmd reads the GPU temperature? I don't think it's exported in sysfs, it seems to rely on /dev/vchiq

lukehoersten commented 4 years ago

@lukasmalkmus ah you're right - the links I provided were for CPU temp which I incorrectly assumed would provide a method to read GPU temp as well.

I looked at the docker issue and it seems they've closed the issue as the problem lies with the underlying rpi_exporter bin we are discussing here. I do not believe they discovered any resolution. I run the binary directly.

@gclawes I think this is the crux of the issue: how do we read the GPU temp?

We could simply gracefully degrade and not report a GPU temp if it's not available to read. That would solve my issue which is that the logs are getting flooded every time it tries and fails to read the GPU temp. It looks like there's a metric for reporting whether the GPU temp was read rpi_scrape_collector_success{collector="gpu"} 0 which would be enough for me.

lukasmalkmus commented 4 years ago

@lukehoersten If that is the only reason, you might get away with setting --collector.gpu=false till we find a better solution for collecting GPU temp on Ubuntu.

gclawes commented 4 years ago

@lukasmalkmus with regards to the docker repo and github actions, you can use Github Actions to build and push to either Github Packge docker registry, or open your own Docker Hub repository. I don't think Docker Hub automated build support arm images, but I think there's ways to do it in Github Actions.

If you want, I can fork this repo and take a crack at it.

carlosedp commented 4 years ago

I don't get the need for forking either repo. My DockerHub repo (https://hub.docker.com/r/carlosedp/arm_exporter) contains the image and has more than 5M pulls. Why the need to fork? I just pull the latest code from here, build and pack into an image. Let me know if there are improvements required to it.

gclawes commented 4 years ago

In my mind it's generally easier to build code + docker all in the same repo, in the same CI pipeline. Just my 2 cents.

lukehoersten commented 4 years ago

The docker repo discussion is a bit off-topic form the exporter binary not working on arm64.

I don't use docker and don't care to see issues related here. There are many different packaging tools and many different ways to package with the same tool. Keeping the docker repo separate with @carlosedp allows for that separation of concerns.

lukehoersten commented 4 years ago

@lukehoersten If that is the only reason, you might get away with setting --collector.gpu=false till we find a better solution for collecting GPU temp on Ubuntu.

@lukasmalkmus I tried that but it doesn't seem to parse:

 /usr/local/bin/rpi_exporter --collector.gpu=false
 rpi_exporter: error: unexpected false, try --help
carlosedp commented 4 years ago

I agree, and also there is no problems related to the Docker image itself.

lukasmalkmus commented 4 years ago

@lukehoersten Sorry, I didn't double check it on my system, that command came from my mind. Try ./rpi_exporter --no-collector.gpu. This is node-exporter inspired, it works the same.

Collectors are enabled by providing a --collector. flag. Collectors that are enabled by default can be disabled by providing a --no-collector. flag.

lukehoersten commented 4 years ago

--no-collector.gpu worked - thanks!

lukasmalkmus commented 4 years ago

I close this issue. The problem of the OP has been resolved. Since I don't think this is a case of "not working", I won't take action atm. I think this is an edge case. If this really becomes a problem for whatever reason, we can still decide to work around the problem by detecting the exact OS, first.

lukehoersten commented 4 years ago

sounds good.

On Wed, May 13, 2020 at 1:50 PM Lukas Malkmus notifications@github.com wrote:

I close this issue. The problem of the OP has been resolved. Since I don't think this is a case of "not working", I won't take action atm. I think this is an edge case. If this really becomes a problem for whatever reason, we can still decide wo work around the problem by detecting the exact OS, first.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lukasmalkmus/rpi_exporter/issues/13#issuecomment-628178271, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAFZ25AJDCOW6FEV2SFZDRRLTVVANCNFSM4MZ6ZAIA .