8

there is a very simple question: What is best place from where run node-exporter? Directly inside the host or from a container?

What is the pros and cons of both solutions? What is the best practice from the developers? From the usage guidelines is not clear for me!

5
  • Have you checked this: github.com/prometheus/node_exporter#using-docker?
    – tgogos
    Commented Oct 30, 2018 at 9:31
  • 1
    Yes, they write It's not recommended to deploy it as a Docker container because it requires access to the host system but after that they explain how to run it from inside a container... so I'm a little bit confused! Is best from outside container or not ? What is the difference ?
    – Elia
    Commented Oct 30, 2018 at 10:03
  • 2
    Just a side note: a container is nothing more than a process with a chroot. Both run on "the host".
    – Mike Doe
    Commented Oct 30, 2018 at 10:03
  • 1
    Ummm speaking about where the process is running ok but there are some differences when you attempt to use system calls and other platform specific functionality... I don't think that you can monitor completely the system from inside a container in the same manner as you were directly on the host (but this my guess)
    – Elia
    Commented Oct 30, 2018 at 10:08
  • 1
    Interesting read: github.com/prometheus/node_exporter/pull/672.
    – tgogos
    Commented Oct 30, 2018 at 11:27

1 Answer 1

5

I would definitely say on the host. This is the recommended way, because node exporter needs access to certain metrics which are not available within the container. It's true that you still have access to various host metrics even when running in a container if you expose /proc and /sys, but you run the risk of scraping the container-related metrics instead of the host nonetheless.

One example are the network-related metrics. By default containers run in their own network namespace (and this is how you'd want them to run under normal circumstances), so given this default, you're going to scrape information related only to that container instead of that of host, despite the fact that you're exposing the aforementioned pseudo-filesystems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.