root / plugins / sensors / nvclock @ 17f78427
Historique | Voir | Annoter | Télécharger (1,25 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# plugin to monitor a nvidia graphic card temperature(s) |
| 4 |
# dynamically shows the sensor name (gpu, board...) |
| 5 |
# written by Dju |
| 6 |
# |
| 7 |
# Requirements : |
| 8 |
# - a nvidia graphic card |
| 9 |
# - a working nvclock binary |
| 10 |
# - shell commands: grep, awk, sed, cut |
| 11 |
# - root rights to execute nvclock. add in plugin-conf.d/munin-node |
| 12 |
# [nvclock] |
| 13 |
# user root |
| 14 |
# |
| 15 |
# Parameters : autoconf and config |
| 16 |
# |
| 17 |
# Version: 1.1 |
| 18 |
# |
| 19 |
#%# family=auto |
| 20 |
#%# capabilities=autoconf |
| 21 |
|
| 22 |
NVCLOCK=`which nvclock` |
| 23 |
if [ ! -z "$NVCLOCK" -a -f $NVCLOCK -a -x $NVCLOCK ]; then |
| 24 |
NVCLOCK_OK=1 |
| 25 |
temps=$($NVCLOCK -i | grep 'temperature:' | awk '{print $1,$3}' | sed 's/ /@/g' | sed 's/C$//g')
|
| 26 |
else |
| 27 |
NVCLOCK_OK=0 |
| 28 |
fi |
| 29 |
|
| 30 |
if [ "$1" = "autoconf" ]; then |
| 31 |
if [ $NVCLOCK_OK -eq 1 ]; then |
| 32 |
echo yes |
| 33 |
exit 0 |
| 34 |
else |
| 35 |
echo no |
| 36 |
exit 1 |
| 37 |
fi |
| 38 |
fi |
| 39 |
|
| 40 |
if [ "$1" = "config" ]; then |
| 41 |
echo 'graph_title Nvidia temperatures' |
| 42 |
echo 'graph_args --base 1000 -l 0' |
| 43 |
echo 'graph_vlabel temp in °C' |
| 44 |
echo 'graph_category sensors' |
| 45 |
if [ $NVCLOCK_OK -eq 1 ]; then |
| 46 |
for temp in $temps; do |
| 47 |
label=$(echo $temp | cut -d@ -f1) |
| 48 |
echo "${label}.label ${label}"
|
| 49 |
done |
| 50 |
fi |
| 51 |
exit 0 |
| 52 |
fi |
| 53 |
|
| 54 |
if [ $NVCLOCK_OK -eq 1 ]; then |
| 55 |
for temp in $temps; do |
| 56 |
label=$(echo $temp | cut -d@ -f1) |
| 57 |
value=$(echo $temp | cut -d@ -f2) |
| 58 |
echo "${label}.value ${value}"
|
| 59 |
done |
| 60 |
fi |
