Can node exporter differentiate between a virtual machine and bare metal server

990 views
Skip to first unread message

Ashish Jain

unread,
Feb 21, 2016, 11:10:38 AM2/21/16
to Prometheus Developers
Hi,

Does node exporter expose any metrics which indicates if the metrics is coming from Virtual Machine or a Bare Metal Server?

Regards
Ashish

Julius Volz

unread,
Feb 21, 2016, 11:22:54 AM2/21/16
to Ashish Jain, Prometheus Developers
Hi,

While there are a number of heuristics to detect whether you're running in a VM or not, I'm not aware of any metrics we export that would give you that information. Of course it could be that some of the node_exporter metric labels could contain clues (device names etc.), but there's nothing explicit. You could of course use the textfile collector module for that.

Cheers,
Julius

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Kochie

unread,
Feb 21, 2016, 2:59:09 PM2/21/16
to Julius Volz, Ashish Jain, Prometheus Developers
We could probably parse /proc/cpuinfo and expose a number of metrics.  Googling around it looks like the kernel will add `hypervisor` to the CPU flags list.

We could expose something like this:
node_cpuinfo_flags{label="fpu",label="lm",label="hypervisor",...} 1

I don't know how often different cores have different flag lists, but we might have to expose all of them separately with cpu="x" labels.

Ashish Jain

unread,
Feb 22, 2016, 3:26:23 AM2/22/16
to Prometheus Developers
So there are 2 solutions:

1) Use the node_exporter textfile collector - Write a custom script which populates the textfile collector with data on VM or Bare Metal. Ben has already pointed out using the flags set in cpuinfo to use that. This could be a short term solution

2) Node_Exporter exposing another metrics for that (as suggested by Ben), this may be a long term solution

BTW I am using the docker image for node_exporter and somehow I am unable to find this directory "/var/lib/node_exporter/textfile_collector/ "
inside my running docker container

Regards
Ashish

Richard Hartmann

unread,
Feb 22, 2016, 3:45:24 AM2/22/16
to Ben Kochie, Prometheus Developers, Julius Volz, Ashish Jain

No idea how useful this is, but if we do this I would argue that it should be abstracted away so there's one well-defined way to get this info.

Now we are plain in the middle of host system detection, though. Xen exposes a host UUID. What do others do?

Richard

Sent by mobile; excuse my brevity.

Reply all
Reply to author
Forward
0 new messages