Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/proc/stat: absolute values vs normalization by USER_HZ #52

Closed
cournape opened this issue Mar 4, 2015 · 10 comments · Fixed by #68
Closed

/proc/stat: absolute values vs normalization by USER_HZ #52

cournape opened this issue Mar 4, 2015 · 10 comments · Fixed by #68

Comments

@cournape
Copy link

cournape commented Mar 4, 2015

Would you consider reporting the cpu-related info from /proc/stat in ticks / sysconf(_SC_CLK_TCK) instead of ticks ? It would make comparison between VMs and across kernel more robust ?

@juliusv
Copy link
Member

juliusv commented Mar 4, 2015

@cournape This is already happening, no? See https://github.com/prometheus/node_exporter/blob/master/collector/stat.go#L115

We will probably get rid of that sysconf call soon though, because it needs cgo, which doesn't work with cross-compilation. We have done some research and it seems USER_HZ is 100 for all platforms that Go is available for, so it can probably just be hardcoded.

@cournape
Copy link
Author

cournape commented Mar 4, 2015

Hm, not sure why I thought it wasn't, I will have to check the data again (I got the impression from the values itself, I did not look at the code, mea culpa).

Some people change USER_HZ when compiling their kernel, and I think it is arch dependent, though that may be moot for an application written in go.

On the topic of cpu stat, would adding features on a per-process basis (based on /proc/[pid]/stat and /proc/[pid]/statm) be on topic ? I am implementing a PoC using python, but I figured that may be interesting to other node exporter users. Processes to be tracked would be defined in terms of pidfile, or /proc/[pid]/cmdline regex, etc...

@brian-brazil
Copy link
Contributor

On the topic of cpu stat, would adding features on a per-process basis (based on /proc/[pid]/stat and /proc/[pid]/statm) be on topic ?

We'd generally encourage instrumenting individual applications with prometheus and getting not just the cpu/memory stats but also other stats relevant to your services. Having such information tied to the machine rather than the service makes monitoring much trickier, and node_exporter is fundamentally about the machine.

@juliusv
Copy link
Member

juliusv commented Mar 4, 2015

Note also that when instrumenting any application via the Go client library (perhaps others already as well?), you automatically get CPU and other runtime stats included by default in that application's /metrics endpoint.

@cournape
Copy link
Author

cournape commented Mar 4, 2015

In some cases, per-service monitoring is not always practical/feasable (e.g. reverse proxies, DB). But I agree that when possible in-app monitoring is more tractable.

@brian-brazil
Copy link
Contributor

We have the haproxy_exporter, and I believe someone's working on the various relational databases.

@juliusv
Copy link
Member

juliusv commented Mar 4, 2015

Yeah. @cournape So as a guideline, we want to keep the node exporter all about things that are really tied to a machine, and keep service-specific metrics out of it (even if it's just CPU stats etc. about those services). Exceptions are for services that are really, really closely tied to a machine (like the gmond collector module). Note that you can still always export anything you want from the node exporter (if needed) using the textfile collector module.

@cournape
Copy link
Author

cournape commented Mar 4, 2015

So the idea is to have this kind of monitoring split in separate services. Makes sense.

@juliusv
Copy link
Member

juliusv commented Mar 4, 2015

Yep. Regarding USER_HZ, AFAIK it's not configurable (only CONFIG_HZ is). Do you mean they actually change the kernel sources before compiling?

If we ignore that case, it seems there are only 2 exceptions to USER_HZ == 100: http://lxr.free-electrons.com/ident?i=USER_HZ

ia64: configurable (it matches CONFIG_HZ)
alpha: 1024
all the rest: hardcoded to 100

@juliusv
Copy link
Member

juliusv commented Mar 4, 2015

(and ia64 and alpha are not platforms for which Go is available)

matthiasr pushed a commit to matthiasr/node_exporter that referenced this issue May 12, 2015
by hardcoding `USER_HZ` (aka. `_SC_CLK_TCK`) to 100, which it is for all
platforms Go supports. See prometheus#52 for discussion around this too.

Closes prometheus#52.
smarterclayton pushed a commit to smarterclayton/node_exporter that referenced this issue Feb 4, 2020
Disable cpu info metric on non x86 arches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants