sens_update_rrd: Drop support for 2.4 kernels, add support for hwmon

class devices (kernels >= 2.6.14). Original patch by Jeff Kosowsky.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4371 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-04-20 05:47:23 +00:00
1 parent bd74aa2390
commit 0aa2104341
2 files changed
+44 -85

No files matched your search

+1
View File
@@ -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
+43 -85
View File
@@ -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