root/lm-sensors/branches/lm-sensors-3.0.0/prog/tellerstats/gather.sh @ 5163

Revision 5163, 3.9 KB (checked in by khali, 6 years ago)

Patch from Aurelien Jarno:

I have just noticed that the FSF address is the old one in all files
except COPYING. Please find a patch below to fix that.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/bin/bash
2#
3#    gather.sh
4#       gather the data.
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
8#
9#    Copyright (C) 2001  Philip Edelbrock
10#
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.
15#
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.
20#
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,
24#    MA 02110-1301 USA.
25#
26
27# generic tellerstats init BEGIN
28
29# get config information from /etc/tellerstats.conf or whereever we are pointed
30
31if [ -z "$TELLERSTATS_CONF" ]
32then
33   TELLERSTATS_CONF=/etc/tellerstats.conf
34fi   
35
36export TELLERSTATS_CONF
37
38if [ ! -r $TELLERSTATS_CONF ]
39then
40   echo "$0: Could not find config file $TELLERSTATS_CONF"
41   exit 1
42fi   
43
44. $TELLERSTATS_CONF
45
46if [ ! -d $DBPATH ]
47then
48   echo "$0: data directory $DBPATH does not exist"
49   exit 1
50fi
51
52if [ ! -d $SENSORPATH ]
53then
54   echo "$0: sensor information directory $SENSORPATH does not exist."
55   exit 1
56fi
57
58if [ ! -d $HTMLROOT ]
59then
60   echo "$0: The root of your webserver - $HTMLROOT - does not exist..bailing out"
61   exit 1
62fi
63
64if [ ! -d $HTMLPATH ]
65then
66   echo "$0: The place where we keep HTML files and pictures - $HTMLPATH - does not exist..bailing out"
67   exit 1
68fi
69
70if [ ! -r $GNUPLOTSCRIPT_TMPL ]
71then
72   echo "$0: The gnuplot script template $GNUPLOTSCRIPT_TMPL does not exist..bailing out"
73   exit 1
74fi
75
76export DBPATH SENSORPATH TEMPPATH HTMLROOT HTMLPATH GNUPLOTSCRIPT_TMPL
77
78if [ -n "$DEBUG" ]
79then
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"
86fi
87
88# generic tellerstats init END
89
90# From /etc/sensors.conf for the W83781D:
91#
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)
96#
97
98#date=yyyyMMddHHmmss, the same format gnuplot expects for the x-axis
99DATE=`date +%Y%m%d%H%M%S`
100
101T=`cat $SENSORPATH/in0   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
102echo $DATE $T >> $DBPATH/cpu1V
103
104T=`cat $SENSORPATH/in1   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
105echo $DATE $T >> $DBPATH/cpu2V
106
107T=`cat $SENSORPATH/in2   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
108echo $DATE $T >> $DBPATH/ThreeVOLT
109
110T=`cat $SENSORPATH/in3   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
111T=`echo $T \* 1.68 | bc`
112echo $DATE $T >> $DBPATH/FiveVOLT
113
114T=`cat $SENSORPATH/in4   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
115T=`echo $T \* 3.8 | bc`
116echo $DATE $T >> $DBPATH/TwelveVOLT
117
118T=`cat $SENSORPATH/in5   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
119T=`echo $T \* -3.477 | bc`
120echo $DATE $T >> $DBPATH/NegTwelveVOLT
121
122T=`cat $SENSORPATH/in6   | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
123T=`echo $T \* -1.505 | bc`
124echo $DATE $T >> $DBPATH/NegFiveVOLT
125
126T=`cat $SENSORPATH/temp1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
127echo $DATE $T >> $DBPATH/mb_temp
128
129T=`cat $SENSORPATH/temp2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
130echo $DATE $T >> $DBPATH/cpu_temp
131
132T=`cat $SENSORPATH/fan1  | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
133echo $DATE $T >> $DBPATH/fanone
134
135T=`cat $SENSORPATH/fan2  | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
136echo $DATE $T >> $DBPATH/fantwo
137
138T=`cat $SENSORPATH/fan3  | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
139echo $DATE $T >> $DBPATH/fanthree
140
141T=`cat /proc/loadavg     | perl -p -e 's/^([^ ]+) .+$/$1/'`
142echo $DATE $T >> $DBPATH/load
143
144exit 0
Note: See TracBrowser for help on using the browser.