diff --git a/CHANGES b/CHANGES index b5e1c5ba..32367431 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ SVN HEAD Library: Clean up pwm symbol names translation Add dme1737 support Program isadump: Detect when address bit 7 is a busy flag + Program sens_update_rrd: Support only hwmon class devices Program sensors: Drop ddcmon and eeprom support Add dme1737 support Program sensors-detect: Stop Super-I/O probe after first family success diff --git a/prog/rrd/sens_update_rrd b/prog/rrd/sens_update_rrd index e8b28b6b..65920531 100755 --- a/prog/rrd/sens_update_rrd +++ b/prog/rrd/sens_update_rrd @@ -2,9 +2,9 @@ # sens_update_rrd - # Update a sensors rrd database. # Sample usage: -# sens_update_rrd /var/lib/database.rrd w83781d-isa-0290 +# sens_update_rrd /var/lib/database.rrd hwmon0 # Sample cron entry: -# */5 * * * * /usr/local/bin/sens_update_rrd /var/lib/sensors-rrd/sensors.rrd w83781d-isa-0290 +# */5 * * * * /usr/local/bin/sens_update_rrd /var/lib/sensors-rrd/sensors.rrd hwmon0 # ################################################################# # @@ -26,102 +26,60 @@ # ################################################################# # -if [ $# -ne 2 ] +if [ $# -lt 1 -o $# -gt 2 ] then - echo "usage: $0 database.rrd sensor" - echo " sensor example: w83781d-isa-0290 (2.4) or 0-0290 (2.6)" + echo "usage: $0 database.rrd [hwmonN]" exit 1 +elif [ $# -eq 2 ] +then + HWMON=$2 +else + HWMON=hwmon0 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 +SENSDIR=/sys/class/hwmon +SENS=$SENSDIR/$HWMON/device -SENSDEV=$2 -SENS=$SENSDIR/$SENSDEV -if [ ! -r $SENS ] +if [ ! -d $SENS ] then - echo $0: 'No sensors found! (modprobe sensor modules?)' + echo "No sensors found in: $SENS" + echo "(modprobe sensor modules?)" exit 1 fi STRING=N -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 value from these sensor files (/sys) +# +SENSORS="fan1 fan2 fan3" +for i in $SENSORS +do + V="`cat $SENS/${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 $SENS/${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 # # Get the first value from these /proc files