node_exporter icon indicating copy to clipboard operation
node_exporter copied to clipboard

[Question] Can node_exporter support Android?

Open thiagosanches opened this issue 1 year ago • 19 comments

I was wondering if node_exporter was able to run on Android, so I've downloaded the latest version (arm64) and tried to run it through termux, it started! However, as soon I asked for the metrics I got a huge exception.

image

It would be cool if that was possible to run and plug the device metrics into grafana.

thiagosanches avatar Feb 27 '23 00:02 thiagosanches

I would love to be able to support Android. But I have no idea what that crash it about.

Go has a specific GOOS=android target, so it may be needed for everything to work.

SuperQ avatar Feb 27 '23 17:02 SuperQ

node_exporter works fine when I start as ROOT, maybe you can try that too.

OfficialBoyfriend avatar Nov 02 '23 03:11 OfficialBoyfriend

Has anyone tried to run exporter in termux?

pfk-beta avatar Feb 06 '24 11:02 pfk-beta

Yeap, @pfk-beta my screenshot is an output from termux!

thiagosanches avatar Feb 06 '24 11:02 thiagosanches

Didn't read carefully posts... @thiagosanches Did you manage to find problematic metrics which failed node_exporter? I have run following command to enable only wifi, and it works:

./node_exporter --collector.disable-defaults --collector.wifi

--edit--

Following command gives me some metrics. If you have idea how to add more collectors, it would be great (e.g. network, battery)

./node_exporter \
 --collector.disable-defaults \
 --collector.drm \
 --collector.edac \
 --collector.lnstat \
 --collector.meminfo \
 --collector.mountstats \
 --collector.perf \
 --collector.selinux \
 --collector.sysctl \
 --collector.thermal_zone \
 --collector.time \
 --collector.uname \
 --collector.filesystem

In /metrics some of these collectors are marked as successfull, but they didn't produce any output.

pfk-beta avatar Feb 06 '24 14:02 pfk-beta

More detailed stacktrace in attachment stacktrace.txt

pfk-beta avatar Feb 06 '24 17:02 pfk-beta

More detailed stacktrace in attachment stacktrace.txt

I'll check on my side and I'll share my findings soon.

thiagosanches avatar Feb 06 '24 20:02 thiagosanches

Hey @pfk-beta , sorry for my delay.

I ran node_exporter as you asked me and as soon I look at /metrics the node_exporter process didn't die!!! Which is good. image

I do see some data on /metrics but I have to take a deep look to see if those values makes sense. image

Did you get something similar as I got?

thiagosanches avatar Feb 08 '24 00:02 thiagosanches

Yeah, I have got many similar items. Few of collectors are marked as working, but they did produce nothing. I need to check exporter with rooted devices (even TV :P)

pfk-beta avatar Feb 08 '24 07:02 pfk-beta

@pfk-beta right now, I can't root my device, but if you can share with us what you got on a rooted device, so @OfficialBoyfriend was right since the beginning 🤣.

thiagosanches avatar Feb 08 '24 11:02 thiagosanches

@thiagosanches AndroidTV with root gives me a lot more information :)

pfk-beta avatar Feb 09 '24 14:02 pfk-beta

That's cool @pfk-beta ! How did you manage to root your TV? That's another topic, but I'm curious about it.

thiagosanches avatar Feb 09 '24 14:02 thiagosanches

@thiagosanches I'm an employee of TV Manufacturer :P

pfk-beta avatar Feb 09 '24 15:02 pfk-beta

@pfk-beta Now I'm curious, any plans to use the node-exporter in these TVs in general or are you just playing around with it?

discordianfish avatar Feb 10 '24 10:02 discordianfish

@discordianfish in general I have created platform for benchmark deep learning models on android devices. One part of the system is monitoring devices.

pfk-beta avatar Feb 11 '24 12:02 pfk-beta

@discordianfish I have created simple collector: https://github.com/pfk-beta/node_exporter/commit/6a160db9f0818ef955d52ff8f889fc38c19423f9 , building node_exporter for android is pretty simple. Sorry for quality of my code, but I have learned to code in Go today :P

pfk-beta avatar Feb 13 '24 21:02 pfk-beta

@pfk-beta Neat, but, we don't allow use of "os/exec" in the node_exporter.

SuperQ avatar Feb 14 '24 21:02 SuperQ

@SuperQ I was expecting that. So I didn't create PR, but posted as community commit :) If I would rewrite it to parse system files, it will be more prometheus-friendly?

pfk-beta avatar Feb 15 '24 07:02 pfk-beta

@pfk-beta I'm not too familiar with android but if these metrics are exposed in /proc, you can add support to https://github.com/prometheus/procfs and then use them here. If this is exposed via other APIs, it might make sense to use a android specific external library to do the heavy lifting and use it here.

discordianfish avatar Feb 16 '24 15:02 discordianfish