Created
December 7, 2020 02:56
-
-
Save WanpengQian/2407057f3dc2512b5812d4ffecb01228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# -*- sh -*- | |
# | |
# Plugin to monitor NVMe harddrive temperatures through nvmecontrol. | |
# | |
#%# family=contrib | |
if [ "$1" = "autoconf" ]; then | |
if [ -x "/sbin/nvmecontrol" ]; then | |
echo yes | |
exit 0 | |
else | |
echo no | |
exit 0 | |
fi | |
fi | |
drives=`/sbin/nvmecontrol devlist | grep : | awk -F: '{print $1}'` | |
if [ "$1" = "config" ]; then | |
echo 'graph_title NVMe temperature' | |
echo 'graph_args --base 1000 -l 0' | |
echo 'graph_vlabel Degrees Celsius' | |
echo 'graph_category sensors' | |
for a in $drives ; do echo "$a.label $a"; done | |
exit 0 | |
fi | |
for a in $drives ; do printf '%s.value %s\n' "$a" `/sbin/nvmecontrol logpage -p2 "$a" | grep "^Temperature:" | awk '{ print $2 - 273.15 }'` ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment