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

Node Name #21

Open
ChewyChop opened this issue Nov 9, 2022 · 7 comments
Open

Node Name #21

ChewyChop opened this issue Nov 9, 2022 · 7 comments

Comments

@ChewyChop
Copy link

Issue with having multiple home assistant servers in multiple locations, the node name reports 0d869efa-prometheus-node-exporter for all node names.

@loganmarchione
Copy link
Owner

Hmmm, never thought about that. Mine is the same name as yours, so it must be the hash of the container or something? I'll have to see if I can change that. Not sure if you can set a hostname inside a container...

In the meantime, try changing the label on your Prometheus server. Here is a sample from my prometheus.yml file...

  - job_name: 'homeassistant'
    static_configs:
      - targets: ['hass02.internal.mydomain.com:9100']
        labels:
          nodename: 'homeassistant'

@ChewyChop
Copy link
Author

Got it! Thanks!

@sjthespian
Copy link

Any more thoughts on this one? I'm trying to have a single scraper config for all of my hosts, so overriding it on the prometheus side of things is problematic. I've been digging around the node_exporter docs, and I don't see anything obvious that will do it there...

@loganmarchione
Copy link
Owner

I haven't found a way to override the hostname via the container 🤷🏻‍♂️

@mateuszdrab
Copy link

What about something like mounting the /etc/hostname file into the container?

@loganmarchione
Copy link
Owner

Still no updates here. I posted in the HA discord asking for help. Everything I do to /etc/hostname does nothing for node exporter. Right now the best way is to still override it on the Prometheus server side.

@mateuszdrab
Copy link

mateuszdrab commented Dec 13, 2023

Are you bind mounting the host file system in a sub path in the container and then setting the appropriate flags when starting node exporter?

prometheus/node_exporter#1237

I never was affected by this issue because I do manually relabel the metrics but I can see the node name label is wrong indeed.

The below is just a copy from the docker compose file so it will need to be adapted the volume mounts need to go into the addon manifest and the command flags need to go into the addon run script.

volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--path.rootfs=/host'
      - '--collector.filesystem.ignored-mount-points="^(/rootfs|/host|)/(sys|proc|dev|host|etc)($$|/)"'
      - '--collector.filesystem.ignored-fs-types="^(sys|proc|auto|cgroup|devpts|ns|au|fuse\.lxc|mqueue)(fs|)$$"'

I'm not sure if you can mount rootfs from an addon based on below document
https://developers.home-assistant.io/docs/add-ons/configuration/
I think the map option only allows predefined paths.

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

No branches or pull requests

4 participants