Skip to content

Instantly share code, notes, and snippets.


jshufro/ Secret

Last active Sep 11, 2022
What would you like to do?
nvme-cli temp in grafana

Install dependencies:

sudo apt install nvme-cli

Create script

Use an editor to create a file named in your home directory, containing

TEMP=$(/usr/sbin/nvme smart-log /dev/nvme0 | /usr/bin/grep temperature | /usr/bin/head -1 | /usr/bin/sed -E 's/^temperature *: ([0-9]+).C$/\1/g')

echo "# HELP nvme_temperature Temperature of the first nvme reported by nvme-cli"
echo "# TYPE nvme_temperature gauge"
echo "nvme_temperature $TEMP"

Make the script executable

chmod u+x

Add the script to your cron tab

Run sudo crontab -e to edit your cron tab. Select an editor, if requested to. Add a line to the bottom: * * * * * /home/[your username]/ > /var/lib/node_exporter/textfile_collector/nvme.prom Be sure to replace [your username].

Add metrics to grafana

After a few minutes, you should be able to query the new metric in grafana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment