diff options
author | Mark D. Studebaker <mdsxyz123@yahoo.com> | 2005-04-24 19:50:37 +0000 |
---|---|---|
committer | Mark D. Studebaker <mdsxyz123@yahoo.com> | 2005-04-24 19:50:37 +0000 |
commit | 65d7993fc08a9bf55c8cd9b772fc56720fa734d1 (patch) | |
tree | a0d230117fa75e3de56c92d85a5a25cd7c19e55a /prog/rrd | |
parent | f922d716074b5996a194deebff4cf0798e102327 (diff) | |
download | lm-sensors-git-65d7993fc08a9bf55c8cd9b772fc56720fa734d1.tar.gz |
support 2.6 kernels
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2982 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'prog/rrd')
-rw-r--r-- | prog/rrd/Makefile | 11 | ||||
-rw-r--r-- | prog/rrd/README | 3 | ||||
-rwxr-xr-x | prog/rrd/sens_update_rrd | 115 |
3 files changed, 91 insertions, 38 deletions
diff --git a/prog/rrd/Makefile b/prog/rrd/Makefile index 46ad79ba..0190418a 100644 --- a/prog/rrd/Makefile +++ b/prog/rrd/Makefile @@ -2,19 +2,24 @@ # Edit the following for your setup # USER=apache +# CRONTAB not used #CRONTAB=/var/spool/cron/tabs/$(USER) RRDPATH=/usr/local/rrdtool/bin BINPATH=/usr/local/bin RRDDIR=/var/lib/sensors-rrd APACHE=/var/www/html APACHDIR=$(APACHE)/senspix -SENSDEV=bmc-ipmi-0000 MACH=`uname -n` -# +# 2.4 kernels +#SENSDEV=w83781d-isa-0290 +#SENSDIR=/proc/sys/dev/sensors/$(SENSDEV) +# 2.6 kernels +SENSDEV=0-0290 +SENSDIR=/sys/bus/i2c/devices/$(SENSDEV) +################################################ # Everything below here should be fine # RRDB=$(RRDDIR)/sensors.rrd -SENSDIR=/proc/sys/dev/sensors/$(SENSDEV) all: sens_day.cgi sens_week.cgi summ_week.cgi $(SENSDIR) diff --git a/prog/rrd/README b/prog/rrd/README index 71817b7d..460fbadc 100644 --- a/prog/rrd/README +++ b/prog/rrd/README @@ -63,7 +63,8 @@ INSTALLATION INSTRUCTIONS APACHDIR=$(APACHE)/senspix The sensor device in your system (isa recommended over i2c if both are available) - SENSDEV=w83781d-isa-0290 + SENSDEV=w83781d-isa-0290 (2.4 kernel - look in /proc/sys/dev/sensors) + SENSDEV=0-0290 (2.6 kernel - look in /sys/i2c/bus/devices) - make - (as root) make install, which does the following. If you don't want it to do this, install by hand!!! diff --git a/prog/rrd/sens_update_rrd b/prog/rrd/sens_update_rrd index a6e60a20..e8b28b6b 100755 --- a/prog/rrd/sens_update_rrd +++ b/prog/rrd/sens_update_rrd @@ -8,7 +8,7 @@ # ################################################################# # -# Copyright 2001 Mark D. Studebaker <mdsxyz123@yahoo.com> +# Copyright 2001,2005 Mark D. Studebaker <mdsxyz123@yahoo.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,53 +29,100 @@ if [ $# -ne 2 ] then echo "usage: $0 database.rrd sensor" - echo " sensor example: w83781d-isa-0290" + echo " sensor example: w83781d-isa-0290 (2.4) or 0-0290 (2.6)" exit 1 fi # RRDPATH=/usr/local/rrdtool/bin RRDB=$1 -# + SENSDIR=/proc/sys/dev/sensors -# +SDIR=/sys/bus/i2c/devices +if [ ! -d $SENSDIR ] +then + if [ ! -d $SDIR ] + then + echo $0: 'No sensors found! (modprobe sensor modules?)' + exit 1 + else + SYSFS=1 + SENSDIR=$SDIR + fi +fi + SENSDEV=$2 SENS=$SENSDIR/$SENSDEV if [ ! -r $SENS ] then + echo $0: 'No sensors found! (modprobe sensor modules?)' exit 1 fi STRING=N -# -# Get the second value from these sensor files -# -SENSORS="fan1 fan2 fan3" -for i in $SENSORS -do - V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" - if [ $? -ne 0 ] - then - STRING="${STRING}:U" - else - V="`echo $V | cut -d ' ' -f 2`" - STRING="${STRING}:${V}" - fi -done -# -# Get the third value from these sensor files -# -SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" -for i in $SENSORS -do - V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" - if [ $? -ne 0 ] - then - STRING="${STRING}:U" - else - V="`echo $V | cut -d ' ' -f 3`" - STRING="${STRING}:${V}" - fi -done +if [ "$SYSFS" = "1" ] +then + # + # Get the value from these sensor files (/sys) + # + SENSORS="fan1 fan2 fan3" + for i in $SENSORS + do + V="`cat $SENSDIR/$SENSDEV/${i}_input 2> /dev/null`" + if [ $? -ne 0 ] + then + STRING="${STRING}:U" + else + STRING="${STRING}:${V}" + fi + done + # + # Get the value from these sensor files (/sys) and divide by 1000 + # + SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" + for i in $SENSORS + do + V="`cat $SENSDIR/$SENSDEV/${i}_input 2> /dev/null`" + if [ $? -ne 0 ] + then + STRING="${STRING}:U" + else + V=`echo "3k0 ${V/-/_} 1000/p"|dc` + STRING="${STRING}:${V}" + fi + done +else + # + # Get the second value from these sensor files (/proc) + # + SENSORS="fan1 fan2 fan3" + for i in $SENSORS + do + V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" + if [ $? -ne 0 ] + then + STRING="${STRING}:U" + else + V="`echo $V | cut -d ' ' -f 2`" + STRING="${STRING}:${V}" + fi + done + # + # Get the third value from these sensor files (/proc) + # + SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" + for i in $SENSORS + do + V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" + if [ $? -ne 0 ] + then + STRING="${STRING}:U" + else + V="`echo $V | cut -d ' ' -f 3`" + STRING="${STRING}:${V}" + fi + done +fi + # # Get the first value from these /proc files # |