From a1f02e959b687513fe5628ce78b625647f57788d Mon Sep 17 00:00:00 2001 From: Dju Date: Thu, 14 Jan 2010 03:34:35 +0100 Subject: [PATCH] Initial version --- plugins/other/nvclock | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 plugins/other/nvclock diff --git a/plugins/other/nvclock b/plugins/other/nvclock new file mode 100755 index 00000000..c15e59b7 --- /dev/null +++ b/plugins/other/nvclock @@ -0,0 +1,60 @@ +#!/bin/sh +# +# plugin to monitor a nvidia graphic card temperature(s) +# dynamically shows the sensor name (gpu, board...) +# written by Dju +# +# Requirements : +# - a nvidia graphic card +# - a working nvclock binary +# - shell commands: grep, awk, sed, cut +# - root rights to execute nvclock. add in plugin-conf.d/munin-node +# [nvclock] +# user root +# +# Parameters : autoconf and config +# +# Version: 1.1 +# +#%# family=auto +#%# capabilities=autoconf + +NVCLOCK=`which nvclock` +if [ ! -z "$NVCLOCK" -a -f $NVCLOCK -a -x $NVCLOCK ]; then + NVCLOCK_OK=1 + temps=$($NVCLOCK -i | grep 'temperature:' | awk '{print $1,$3}' | sed 's/ /@/g' | sed 's/C$//g') +else + NVCLOCK_OK=0 +fi + +if [ "$1" = "autoconf" ]; then + if [ $NVCLOCK_OK -eq 1 ]; then + echo yes + exit 0 + else + echo no + exit 1 + fi +fi + +if [ "$1" = "config" ]; then + echo 'graph_title Nvidia temperatures' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel temp in °C' + echo 'graph_category sensors' + if [ $NVCLOCK_OK -eq 1 ]; then + for temp in $temps; do + label=$(echo $temp | cut -d@ -f1) + echo "${label}.label ${label}" + done + fi + exit 0 +fi + +if [ $NVCLOCK_OK -eq 1 ]; then + for temp in $temps; do + label=$(echo $temp | cut -d@ -f1) + value=$(echo $temp | cut -d@ -f2) + echo "${label}.value ${value}" + done +fi