3

I used Prometheus and node exporter a while ago and had access to node_filesystem_* metrics to monitor disk usage but I've recently fired it up on some other servers (Ubuntu Linux) and those metrics seem to be missing.

According to this https://github.com/prometheus/node_exporter those metrics should be enabled by default and available from Linux hosts. What might be causing them to not appear?

To clarify, I can get metrics for CPU, memory etc so it's not that node exporter just isn't working.

Sam
  • 183
  • 1
  • 5

2 Answers2

3

Pay your attention to /etc/default/prometheus-node-exporter: for e. g., recently I realised Ubuntu's (18.04) package cuts out by default all disks statistics:

ARGS="--collector.diskstats.ignored-devices=^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$ \

Pretty weird as to me, but at least can be adjusted.

poige
  • 9,448
  • 2
  • 25
  • 52
  • If you run `prometheus_node_exporter --help` on 18.04 you'll see that they've just duplicated the default value that is pre-compiled into the binary. That regular expression doesn't suppress all *disks*, it only suppresses all partitions, leaving the main disks to be collected still. – Harald Mar 18 '21 at 21:05
  • 1
    /dev/loop0 isn't partition. Neither /dev/ram0 is. – poige Mar 21 '21 at 10:20
1

Well it seems that v0.11 (which is all you get from Ubuntu 16.04 repos) doesn't have that functionality. Ubuntu 18.04 repos contain v0.15 (still not recent) but there you do get the functionality. No PPA available. Plenty of instructions to manually install newer versions or you can use my Ansible role:

- name: Download package
  get_url:
    url: https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
    dest: /home/yourname/nodeexporter.tar.gz

- name: Unpack tar
  unarchive:
    src: /home/yourname/nodeexporter.tar.gz
    dest: /home/yourname
    remote_src: yes

- name: Copy binary
  copy:
    src: /home/yourname/node_exporter-0.18.1.linux-amd64/node_exporter
    dest: /usr/local/bin/node_exporter
    remote_src: yes
    mode: a+x

- name: Create user
  user:
    name: node_exporter
    system: yes
    shell: /bin/false

- name: Template systemd service
  template:
    src: node_exporter.service.j2
    dest: /etc/systemd/system/node_exporter.service

- name: Template systemd service
  systemd:
    daemon_reload: yes
    name: node_exporter
    state: started

With the systemd service template:

[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target
Sam
  • 183
  • 1
  • 5