NVMe 2 sensors with the same name result in 1 metric

Hi folks, I’m new to Telegraf and InfluxDB, so please bare with me :slight_smile:

My setup:

  • Telegraf on Debian (Proxmox) sending data to InfluxDB in the local network.
  • Metrics are being sent to InfluxDB as intended on 3 different Proxmox node

Issue:
One node has 2 NVMe drives and each has a sensor:

nvme-pci-0200
Adapter: PCI adapter
Composite:    +47.9°C  (low  =  -5.2°C, high = +83.8°C)
                       (crit = +87.8°C)

nvme-pci-0400
Adapter: PCI adapter
Composite:    +41.9°C  (low  =  -0.1°C, high = +76.8°C)
                       (crit = +79.8°C)

but in Influx DB I only see 1 nvme_composite metrics

When I run:

telegraf -config /etc/telegraf/telegraf.conf -test

I get the following output (truncated):

> temp,host=pve1,sensor=nvme_composite temp=48.85 1721506434000000000
> temp,host=pve1,sensor=nvme_composite temp=41.85 1721506434000000000

The sensor names are both nvme_composite , which might be why I only see one temperature reading.

Is there a way to tag/rename these sensors without messing too much with my PVE node?
Thanks!

I found a workaround: Use temperature from smartctl as it exports much more details like disk serial number, name etc. which allows to differentiate between multiple drives.

Solution:

On PVE and PBS I had to do the following:

  1. Install nvme-cli:
    apt install nvme-cli 
    nvme list
    
  2. Install sudo and add an entry to the visudo file.
    apt install sudo
    sudo visudo
    
  3. Add after line “Cmnd alias specification”:
    # Cmnd alias specification
    Cmnd_Alias SMARTCTL = /usr/sbin/smartctl
    telegraf  ALL=(ALL) NOPASSWD: SMARTCTL
    Defaults!SMARTCTL !logfile, !syslog, !pam_session
    
  4. Added to telegram.conf:
    # Configuration for smartctl metrics
    [[inputs.smart]]
      ## On most platforms used cli utilities requires root access.
      ## Setting 'use_sudo' to true will make use of sudo to run smartctl or nvme-cli.
      ## Sudo must be configured to allow the telegraf user to run smartctl or nvme-cli
      ## without a password.
      use_sudo = true
    
  5. Test telegraf config:
    sudo telegraf -config /etc/telegraf/telegraf.conf -test
    
  6. Restart telegraf:
    systemctl restart telegraf
    systemctl status telegraf