5
# run from cron every 5 minutes.
6
# Don't run manually as root or else files in data/ will get
7
# root ownership then your (non-root) cron daemon won't work
9
# Copyright (C) 2001 Philip Edelbrock
11
# This program is free software; you can redistribute it and/or modify
12
# it under the terms of the GNU General Public License as published by
13
# the Free Software Foundation; either version 2 of the License, or
14
# (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
21
# You should have received a copy of the GNU General Public License
22
# along with this program; if not, write to the Free Software
23
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27
# generic tellerstats init BEGIN
29
# get config information from /etc/tellerstats.conf or wherever we are pointed
31
if [ -z "$TELLERSTATS_CONF" ]
33
TELLERSTATS_CONF=/etc/tellerstats.conf
36
export TELLERSTATS_CONF
38
if [ ! -r $TELLERSTATS_CONF ]
40
echo "$0: Could not find config file $TELLERSTATS_CONF"
48
echo "$0: data directory $DBPATH does not exist"
52
if [ ! -d $SENSORPATH ]
54
echo "$0: sensor information directory $SENSORPATH does not exist."
60
echo "$0: The root of your webserver - $HTMLROOT - does not exist..bailing out"
66
echo "$0: The place where we keep HTML files and pictures - $HTMLPATH - does not exist..bailing out"
70
if [ ! -r $GNUPLOTSCRIPT_TMPL ]
72
echo "$0: The gnuplot script template $GNUPLOTSCRIPT_TMPL does not exist..bailing out"
76
export DBPATH SENSORPATH TEMPPATH HTMLROOT HTMLPATH GNUPLOTSCRIPT_TMPL
80
echo "DBPATH = $DBPATH"
81
echo "SENSORPATH = $SENSORPATH"
82
echo "TEMPPATH = $TEMPPATH"
83
echo "HTMLROOT = $HTMLROOT"
84
echo "HTMLPATH = $HTMLPATH"
85
echo "GNUPLOTSCRIPT_TMPL = $GNUPLOTSCRIPT_TMPL"
88
# generic tellerstats init END
90
# From /etc/sensors.conf for the W83781D:
92
# compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1)
93
# compute in4 ((28/10)+1)*@ , @/((28/10)+1)
94
# compute in5 -(210/60.4)*@ , -@/(210/60.4)
95
# compute in6 -(90.9/60.4)*@ , -@/(90.9/60.4)
98
#date=yyyyMMddHHmmss, the same format gnuplot expects for the x-axis
99
DATE=`date +%Y%m%d%H%M%S`
101
T=`cat $SENSORPATH/in0 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
102
echo $DATE $T >> $DBPATH/cpu1V
104
T=`cat $SENSORPATH/in1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
105
echo $DATE $T >> $DBPATH/cpu2V
107
T=`cat $SENSORPATH/in2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
108
echo $DATE $T >> $DBPATH/ThreeVOLT
110
T=`cat $SENSORPATH/in3 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
111
T=`echo $T \* 1.68 | bc`
112
echo $DATE $T >> $DBPATH/FiveVOLT
114
T=`cat $SENSORPATH/in4 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
115
T=`echo $T \* 3.8 | bc`
116
echo $DATE $T >> $DBPATH/TwelveVOLT
118
T=`cat $SENSORPATH/in5 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
119
T=`echo $T \* -3.477 | bc`
120
echo $DATE $T >> $DBPATH/NegTwelveVOLT
122
T=`cat $SENSORPATH/in6 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
123
T=`echo $T \* -1.505 | bc`
124
echo $DATE $T >> $DBPATH/NegFiveVOLT
126
T=`cat $SENSORPATH/temp1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
127
echo $DATE $T >> $DBPATH/mb_temp
129
T=`cat $SENSORPATH/temp2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
130
echo $DATE $T >> $DBPATH/cpu_temp
132
T=`cat $SENSORPATH/fan1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
133
echo $DATE $T >> $DBPATH/fanone
135
T=`cat $SENSORPATH/fan2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
136
echo $DATE $T >> $DBPATH/fantwo
138
T=`cat $SENSORPATH/fan3 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
139
echo $DATE $T >> $DBPATH/fanthree
141
T=`cat /proc/loadavg | perl -p -e 's/^([^ ]+) .+$/$1/'`
142
echo $DATE $T >> $DBPATH/load