Changeset 2982

Show
Ignore:
Timestamp:
04/24/05 21:50:37 (8 years ago)
Author:
mds
Message:

support 2.6 kernels

Location:
lm-sensors/trunk/prog/rrd
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/rrd/Makefile

    r2335 r2982  
    33# 
    44USER=apache 
     5# CRONTAB not used 
    56#CRONTAB=/var/spool/cron/tabs/$(USER) 
    67RRDPATH=/usr/local/rrdtool/bin 
     
    910APACHE=/var/www/html 
    1011APACHDIR=$(APACHE)/senspix 
    11 SENSDEV=bmc-ipmi-0000 
    1212MACH=`uname -n` 
    13 # 
     13# 2.4 kernels 
     14#SENSDEV=w83781d-isa-0290 
     15#SENSDIR=/proc/sys/dev/sensors/$(SENSDEV) 
     16# 2.6 kernels 
     17SENSDEV=0-0290 
     18SENSDIR=/sys/bus/i2c/devices/$(SENSDEV) 
     19################################################ 
    1420# Everything below here should be fine 
    1521# 
    1622RRDB=$(RRDDIR)/sensors.rrd 
    17 SENSDIR=/proc/sys/dev/sensors/$(SENSDEV) 
    1823 
    1924all: sens_day.cgi sens_week.cgi summ_week.cgi $(SENSDIR) 
  • lm-sensors/trunk/prog/rrd/README

    r1955 r2982  
    6464                The sensor device in your system 
    6565                (isa recommended over i2c if both are available) 
    66                         SENSDEV=w83781d-isa-0290 
     66                        SENSDEV=w83781d-isa-0290 (2.4 kernel - look in /proc/sys/dev/sensors) 
     67                        SENSDEV=0-0290           (2.6 kernel - look in /sys/i2c/bus/devices) 
    6768        - make 
    6869        - (as root) make install, which does the following. 
  • lm-sensors/trunk/prog/rrd/sens_update_rrd

    r1052 r2982  
    99################################################################# 
    1010# 
    11 #    Copyright 2001 Mark D. Studebaker <mdsxyz123@yahoo.com> 
     11#    Copyright 2001,2005 Mark D. Studebaker <mdsxyz123@yahoo.com> 
    1212# 
    1313#    This program is free software; you can redistribute it and/or modify 
     
    3030then 
    3131        echo "usage: $0 database.rrd sensor" 
    32         echo "       sensor example: w83781d-isa-0290" 
     32        echo "       sensor example: w83781d-isa-0290 (2.4) or 0-0290 (2.6)" 
    3333        exit 1 
    3434fi 
     
    3636RRDPATH=/usr/local/rrdtool/bin 
    3737RRDB=$1 
    38 # 
     38 
    3939SENSDIR=/proc/sys/dev/sensors 
    40 # 
     40SDIR=/sys/bus/i2c/devices 
     41if [ ! -d $SENSDIR ] 
     42then 
     43        if [ ! -d $SDIR ] 
     44        then 
     45                echo $0: 'No sensors found! (modprobe sensor modules?)' 
     46                exit 1 
     47        else 
     48                SYSFS=1 
     49                SENSDIR=$SDIR 
     50        fi       
     51fi 
     52 
    4153SENSDEV=$2 
    4254SENS=$SENSDIR/$SENSDEV 
    4355if [ ! -r $SENS ] 
    4456then 
     57        echo $0: 'No sensors found! (modprobe sensor modules?)' 
    4558        exit 1 
    4659fi 
    4760 
    4861STRING=N 
    49 # 
    50 # Get the second value from these sensor files 
    51 # 
    52 SENSORS="fan1 fan2 fan3" 
    53 for i in $SENSORS 
    54 do 
    55         V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" 
    56         if [ $? -ne 0 ] 
    57         then 
    58                 STRING="${STRING}:U" 
    59         else 
    60                 V="`echo $V | cut -d ' ' -f 2`" 
    61                 STRING="${STRING}:${V}" 
    62         fi 
    63 done 
    64 # 
    65 # Get the third value from these sensor files 
    66 # 
    67 SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" 
    68 for i in $SENSORS 
    69 do 
    70         V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" 
    71         if [ $? -ne 0 ] 
    72         then 
    73                 STRING="${STRING}:U" 
    74         else 
    75                 V="`echo $V | cut -d ' ' -f 3`" 
    76                 STRING="${STRING}:${V}" 
    77         fi 
    78 done 
     62if [ "$SYSFS" = "1" ] 
     63then 
     64        # 
     65        # Get the value from these sensor files (/sys) 
     66        # 
     67        SENSORS="fan1 fan2 fan3" 
     68        for i in $SENSORS 
     69        do 
     70                V="`cat $SENSDIR/$SENSDEV/${i}_input 2> /dev/null`" 
     71                if [ $? -ne 0 ] 
     72                then 
     73                        STRING="${STRING}:U" 
     74                else 
     75                        STRING="${STRING}:${V}" 
     76                fi 
     77        done 
     78        # 
     79        # Get the value from these sensor files (/sys) and divide by 1000 
     80        # 
     81        SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" 
     82        for i in $SENSORS 
     83        do 
     84                V="`cat $SENSDIR/$SENSDEV/${i}_input 2> /dev/null`" 
     85                if [ $? -ne 0 ] 
     86                then 
     87                        STRING="${STRING}:U" 
     88                else 
     89                        V=`echo "3k0 ${V/-/_} 1000/p"|dc` 
     90                        STRING="${STRING}:${V}" 
     91                fi 
     92        done 
     93else 
     94        # 
     95        # Get the second value from these sensor files (/proc) 
     96        # 
     97        SENSORS="fan1 fan2 fan3" 
     98        for i in $SENSORS 
     99        do 
     100                V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" 
     101                if [ $? -ne 0 ] 
     102                then 
     103                        STRING="${STRING}:U" 
     104                else 
     105                        V="`echo $V | cut -d ' ' -f 2`" 
     106                        STRING="${STRING}:${V}" 
     107                fi 
     108        done 
     109        # 
     110        # Get the third value from these sensor files (/proc) 
     111        # 
     112        SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" 
     113        for i in $SENSORS 
     114        do 
     115                V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" 
     116                if [ $? -ne 0 ] 
     117                then 
     118                        STRING="${STRING}:U" 
     119                else 
     120                        V="`echo $V | cut -d ' ' -f 3`" 
     121                        STRING="${STRING}:${V}" 
     122                fi 
     123        done 
     124fi 
     125 
    79126# 
    80127# Get the first value from these /proc files