the famous "tellerstats" package of Phil's with updates

from me and Hans Ecke <hans@ecke.ws>.
      Intent is a simple package which can be customized, configured,
      and installed easily.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1051 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2001-03-31 04:50:25 +00:00
1 parent cf3d81cc76
commit c231b53a57
6 files changed
+511

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
This is tellerstats Version 1.9.2
Author: Phil Edelbrock <phil@netroedge.com>
with Changes by
Mark D. Studebaker <mdsxyz123@yahoo.com> and
Hans Ecke <hans@ecke.ws>
Send requests to the lm_sensors mailing list sensors@stimpy.netroedge.com.
Required Utilities and Packages:
apache or other web server
'convert' from ImageMagick or X11
http://www.imagemagick.org
'bc' command line calculator
gnuplot
http://www.gnuplot.org
lm_sensors
perl
Follow those steps to install tellerstats:
* Put the following line into your /etc/crontab file
*/5 * * * * root /usr/local/install/tellerstats/gather.sh
(change the directory to reflect where you installed gather.sh)
* Link tellerstats.sh to /etc/cron.hourly/tellerstats.sh
* move index.shtml into a directory accessible with a webbrowser
and configure your webserver for SSI (server side includes)
* move tellerstats.conf to /etc and edit it to reflect correct directories
+143
View File
@@ -0,0 +1,143 @@
#!/bin/bash
#
# gather.sh
# gather the data.
# run from cron every 5 minutes.
# Don't run manually as root or else files in data/ will get
# root ownership then your (non-root) cron daemon won't work
#
# Copyright 2001 The lm_sensors group
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# generic tellerstats init BEGIN
# get config information from /etc/tellerstats.conf or whereever we are pointed
if [ -z "$TELLERSTATS_CONF" ]
then
TELLERSTATS_CONF=/etc/tellerstats.conf
fi
export TELLERSTATS_CONF
if [ ! -r $TELLERSTATS_CONF ]
then
echo "$0: Could not find config file $TELLERSTATS_CONF"
exit 1
fi
. $TELLERSTATS_CONF
if [ ! -d $DBPATH ]
then
echo "$0: data directory $DBPATH does not exist"
exit 1
fi
if [ ! -d $SENSORPATH ]
then
echo "$0: sensor information directory $SENSORPATH does not exist."
exit 1
fi
if [ ! -d $HTMLROOT ]
then
echo "$0: The root of your webserver - $HTMLROOT - does not exist..bailing out"
exit 1
fi
if [ ! -d $HTMLPATH ]
then
echo "$0: The place where we keep HTML files and pictures - $HTMLPATH - does not exist..bailing out"
exit 1
fi
if [ ! -r $GNUPLOTSCRIPT_TMPL ]
then
echo "$0: The gnuplot script template $GNUPLOTSCRIPT_TMPL does not exist..bailing out"
exit 1
fi
export DBPATH SENSORPATH TEMPPATH HTMLROOT HTMLPATH GNUPLOTSCRIPT_TMPL
if [ -n "$DEBUG" ]
then
echo "DBPATH = $DBPATH"
echo "SENSORPATH = $SENSORPATH"
echo "TEMPPATH = $TEMPPATH"
echo "HTMLROOT = $HTMLROOT"
echo "HTMLPATH = $HTMLPATH"
echo "GNUPLOTSCRIPT_TMPL = $GNUPLOTSCRIPT_TMPL"
fi
# generic tellerstats init END
# From /etc/sensors.conf for the W83781D:
#
# compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1)
# compute in4 ((28/10)+1)*@ , @/((28/10)+1)
# compute in5 -(210/60.4)*@ , -@/(210/60.4)
# compute in6 -(90.9/60.4)*@ , -@/(90.9/60.4)
#
#date=yyyyMMddHHmmss, the same format gnuplot expects for the x-axis
DATE=`date +%Y%m%d%H%M%S`
T=`cat $SENSORPATH/in0 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/cpu1V
T=`cat $SENSORPATH/in1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/cpu2V
T=`cat $SENSORPATH/in2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/ThreeVOLT
T=`cat $SENSORPATH/in3 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
T=`echo $T \* 1.68 | bc`
echo $DATE $T >> $DBPATH/FiveVOLT
T=`cat $SENSORPATH/in4 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
T=`echo $T \* 3.8 | bc`
echo $DATE $T >> $DBPATH/TwelveVOLT
T=`cat $SENSORPATH/in5 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
T=`echo $T \* -3.477 | bc`
echo $DATE $T >> $DBPATH/NegTwelveVOLT
T=`cat $SENSORPATH/in6 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
T=`echo $T \* -1.505 | bc`
echo $DATE $T >> $DBPATH/NegFiveVOLT
T=`cat $SENSORPATH/temp1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/mb_temp
T=`cat $SENSORPATH/temp2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/cpu_temp
T=`cat $SENSORPATH/fan1 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/fanone
T=`cat $SENSORPATH/fan2 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/fantwo
T=`cat $SENSORPATH/fan3 | perl -p -e 's/^.+ ([^ ]+)$/$1/'`
echo $DATE $T >> $DBPATH/fanthree
T=`cat /proc/loadavg | perl -p -e 's/^([^ ]+) .+$/$1/'`
echo $DATE $T >> $DBPATH/load
exit 0
+79
View File
@@ -0,0 +1,79 @@
set term $PLOTTERMINAL
set timefmt "%Y%m%d%H%M%S"
set notime
set autoscale xy
set size 2,2
set data style lp
set xlabel "Time"
set xdata time
set ylabel "Voltage (V)"
set output "$TEMPPATH/cpu1V.$PLOTFORMAT"
plot "$DBPATH/cpu1V" using 1:2 title '' w lp lw $LINEWIDTH, \
2.1 title 'min' w lp lw $LINEWIDTH, \
2.3 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/cpu2V.$PLOTFORMAT"
plot "$DBPATH/cpu2V" using 1:2 title '' w lp lw $LINEWIDTH, \
2.1 title 'min' w lp lw $LINEWIDTH, \
2.3 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/ThreeVOLT.$PLOTFORMAT"
plot "$DBPATH/ThreeVOLT" using 1:2 title '' w lp lw $LINEWIDTH, \
3.0 title 'min' w lp lw $LINEWIDTH, \
3.6 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/FiveVOLT.$PLOTFORMAT"
plot "$DBPATH/FiveVOLT" using 1:2 title '' w lp lw $LINEWIDTH, \
4.85 title 'min' w lp lw $LINEWIDTH, \
5.15 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/TwelveVOLT.$PLOTFORMAT"
plot "$DBPATH/TwelveVOLT" using 1:2 title '' w lp lw $LINEWIDTH, \
11.3 title 'min' w lp lw $LINEWIDTH, \
12.7 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/NegTwelveVOLT.$PLOTFORMAT"
plot "$DBPATH/NegTwelveVOLT" using 1:2 title '' w lp lw $LINEWIDTH, \
-12.7 title 'min' w lp lw $LINEWIDTH, \
-11.3 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/NegFiveVOLT.$PLOTFORMAT"
plot "$DBPATH/NegFiveVOLT" using 1:2 title '' w lp lw $LINEWIDTH, \
-5.25 title 'min' w lp lw $LINEWIDTH, \
-4.75 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/voltages.$PLOTFORMAT"
plot "$DBPATH/cpu1V" using 1:2 title '1V' w lp lw $LINEWIDTH,\
"$DBPATH/cpu2V" using 1:2 title '2V' w lp lw $LINEWIDTH,\
"$DBPATH/ThreeVOLT" using 1:2 title '3V' w lp lw $LINEWIDTH,\
"$DBPATH/FiveVOLT" using 1:2 title '5V' w lp lw $LINEWIDTH,\
"$DBPATH/TwelveVOLT" using 1:2 title '12V' w lp lw $LINEWIDTH,\
"$DBPATH/NegTwelveVOLT" using 1:2 title '-12V' w lp lw $LINEWIDTH,\
"$DBPATH/NegFiveVOLT" using 1:2 title '-5V' w lp lw $LINEWIDTH
set ylabel "Temperature (Degree C)"
set output "$TEMPPATH/mb_temp.$PLOTFORMAT"
plot "$DBPATH/mb_temp" using 1:2 title '' w lp lw $LINEWIDTH, \
50 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/cpu_temp.$PLOTFORMAT"
plot "$DBPATH/cpu_temp" using 1:2 title '' w lp lw $LINEWIDTH, \
50 title 'max' w lp lw $LINEWIDTH
set output "$TEMPPATH/temps.$PLOTFORMAT"
plot "$DBPATH/mb_temp" using 1:2 title 'motherboard' w lp lw $LINEWIDTH, \
"$DBPATH/cpu_temp" using 1:2 title 'CPU' w lp lw $LINEWIDTH
set ylabel "Fan Speed (RPM)"
set output "$TEMPPATH/fanone.$PLOTFORMAT"
plot "$DBPATH/fanone" using 1:2 title '' w lp lw $LINEWIDTH, \
3000 title 'min' w lp lw $LINEWIDTH
set output "$TEMPPATH/fantwo.$PLOTFORMAT"
plot "$DBPATH/fantwo" using 1:2 title '' w lp lw $LINEWIDTH, \
3000 title 'min' w lp lw $LINEWIDTH
set output "$TEMPPATH/fanthree.$PLOTFORMAT"
plot "$DBPATH/fanthree" using 1:2 title '' w lp lw $LINEWIDTH, \
3000 title 'min' w lp lw $LINEWIDTH
set ylabel "Load Average"
set output "$TEMPPATH/load.$PLOTFORMAT"
plot "$DBPATH/load" using 1:2 title '' w lp lw $LINEWIDTH
exit
+48
View File
@@ -0,0 +1,48 @@
<html>
<META HTTP-EQUIV="expires" CONTENT="300">
<META HTTP-EQUIV="Refresh" CONTENT="3600;URL=http:index.shtml">
<title>Computer Hardware Statistics</title>
<body bgcolor=FFFFFF>
<center><font size=5>Computer Hardware Statistics</font><br>
<font size=4>Running 48 Hour Window</font><p>
<!--#config timefmt="%c" -->
These plots were generated <!--#echo var="LAST_MODIFIED" -->
<br>
<table border=2>
<tr>
<td valign=center align=center><a href=voltagesB.png><img src=voltages.png width=320 height=240><br>All Voltages</a></td>
<td valign=center align=center><a href=tempsB.png><img src=temps.png width=320 height=240><br>All Temps</td>
<td valign=center align=center><a href=loadB.png><img src=load.png width=320 height=240><br>System Loading</td>
</tr>
<tr>
<td valign=center align=center><a href=TwelveVOLTB.png><img src=TwelveVOLT.png width=320 height=240><br>+12 Volt Supply</td>
<td valign=center align=center><a href=NegFiveVOLTB.png><img src=NegFiveVOLT.png width=320 height=240><br>-5 Volt Supply</td>
<td valign=center align=center><a href=NegTwelveVOLTB.png><img src=NegTwelveVOLT.png width=320 height=240><br>-12 Volt Supply</td>
</tr>
<tr>
<td valign=center align=center><a href=cpu1VB.png><img src=cpu1V.png width=320 height=240><br>CPU1 Core Voltage</td>
<td valign=center align=center><a href=cpu2VB.png><img src=cpu2V.png width=320 height=240><br>CPU2 Core Voltage</td>
<td valign=center align=center><a href=ThreeVOLTB.png><img src=ThreeVOLT.png width=320 height=240><br>+3.3 Volt Supply</td>
</tr>
<tr>
<td valign=center align=center><a href=FiveVOLTB.png><img src=FiveVOLT.png width=320 height=240><br>+5 Volt Supply</td>
<td valign=center align=center><a href=cpu_tempB.png><img src=cpu_temp.png width=320 height=240><br>CPU Temperature (degrees C)</td>
<td valign=center align=center><a href=mb_tempB.png><img src=mb_temp.png width=320 height=240><br>Motherboard Temperature (degrees C)</td>
</tr>
<tr>
<td valign=center align=center><a href=fanoneB.png><img src=fanone.png width=320 height=240><br>Fan #1 Speed (RPM)</td>
<td valign=center align=center><a href=fantwoB.png><img src=fantwo.png width=320 height=240><br>Fan #2 Speed (RPM)</td>
<td valign=center align=center><a href=fanthreeB.png><img src=fanthree.png width=320 height=240><br>Fan #3 Speed (RPM)</td>
</tr>
</table><p>
This page generated with drivers and the tellerstats scripts from
<a href="http://www.lm-sensors.nu/">The lm_sensors drivers</a>.
<p>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
# this is the tellerstats config file. Please be sure to
# edit these for your setup!!!
# where we keep the log of sensor data
DBPATH="/var/local/LM78DB/data"
# where we get the sensor data from
SENSORPATH="/proc/sys/dev/sensors/w83781d-isa-0290"
# where temporary plots and files are kept
TEMPPATH="/usr/tmp/lm78plots"
# the root of the webserver
HTMLROOT="/home/httpd/html"
# where all the web-visible files are
HTMLPATH="$HTMLROOT/tellerstats"
# the template of the gnuplot script
GNUPLOTSCRIPT_TMPL=/usr/local/install/tellerstats/gnuplotscript.tmpl
# linewidth of the plots
LINEWIDTH=5
# format (fileextensions) for primary plots
PLOTFORMAT=ps
# terminal and options for primary plots (should match above) as give to gnuplot.
# Please see gnuplot online help for "set terminal"
PLOTTERMINAL="postscript eps enhanced color \"Helvetica\" 22"
+165
View File
@@ -0,0 +1,165 @@
#!/bin/bash
#
# tellerstats.sh 3
# generate graphs from the data
#
# Copyright 2001 The lm_sensors group
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# generic tellerstats init BEGIN
# get config information from /etc/tellerstats.conf or whereever we are pointed
if [ -z "$TELLERSTATS_CONF" ]
then
TELLERSTATS_CONF=/etc/tellerstats.conf
fi
export TELLERSTATS_CONF
if [ ! -r $TELLERSTATS_CONF ]
then
echo "$0: Could not find config file $TELLERSTATS_CONF"
exit 1
fi
. $TELLERSTATS_CONF
if [ ! -d $DBPATH ]
then
echo "$0: data directory $DBPATH does not exist"
exit 1
fi
if [ ! -d $SENSORPATH ]
then
echo "$0: sensor information directory $SENSORPATH does not exist."
exit 1
fi
if [ ! -d $HTMLROOT ]
then
echo "$0: The root of your webserver - $HTMLROOT - does not exist..bailing out"
exit 1
fi
if [ ! -d $HTMLPATH ]
then
echo "$0: The place where we keep HTML files and pictures - $HTMLPATH - does not exist..bailing out"
exit 1
fi
if [ ! -r $GNUPLOTSCRIPT_TMPL ]
then
echo "$0: The gnuplot script template $GNUPLOTSCRIPT_TMPL does not exist..bailing out"
exit 1
fi
export DBPATH SENSORPATH TEMPPATH HTMLROOT HTMLPATH GNUPLOTSCRIPT_TMPL
if [ -n "$DEBUG" ]
then
echo "DBPATH = $DBPATH"
echo "SENSORPATH = $SENSORPATH"
echo "TEMPPATH = $TEMPPATH"
echo "HTMLROOT = $HTMLROOT"
echo "HTMLPATH = $HTMLPATH"
echo "GNUPLOTSCRIPT_TMPL = $GNUPLOTSCRIPT_TMPL"
fi
# generic tellerstats init END
if [ -z "$LINEWIDTH" ]
then
LINEWIDTH=5
fi
export LINEWIDTH
if [ -z "$PLOTFORMAT" ]
then
PLOTFORMAT=ps
fi
export PLOTFORMAT
if [ -z "$PLOTTERMINAL" ]
then
PLOTTERMINAL="postscript eps enhanced color \"Helvetica\" 22"
fi
export PLOTTERMINAL
if [ -n "$DEBUG" ]
then
echo "LINEWIDTH = $LINEWIDTH"
echo "PLOTFORMAT = $PLOTFORMAT"
echo "PLOTTERMINAL = $PLOTTERMINAL"
fi
# Trim files to 48 hour window
cd $DBPATH
files="`echo *`"
for this in $files
do
tail $this -n576 > ${this}.tmp
mv ${this}.tmp $this
done
###############################################
rm -rf $TEMPPATH
mkdir -p $TEMPPATH
cd $TEMPPATH
# Update primary plots
GNUPLOTSCRIPT="$TEMPPATH/gnuplotscript"
cat $GNUPLOTSCRIPT_TMPL | perl -p -e's/\$(\w+)/$ENV{$1}/g' > $GNUPLOTSCRIPT
gnuplot < $GNUPLOTSCRIPT
rm $GNUPLOTSCRIPT
files="`echo *`"
CONVERT_OPTS_A="-interlace none -scale 320x240 -quality 100"
CONVERT_OPTS_B="-interlace none -scale 800x600 -quality 100"
for this in $files
do
prefix=`echo $this|perl -p -e's/\.\w+$//'`
convert $CONVERT_OPTS_A $TEMPPATH/$this $HTMLPATH/${prefix}.png
convert $CONVERT_OPTS_B $TEMPPATH/$this $HTMLPATH/${prefix}B.png
touch $HTMLPATH/${prefix}.png $HTMLPATH/${prefix}B.png
done
# Update timestamp
touch $HTMLPATH/index.shtml
# if this was called as a cgi script, it should redirect to the index.shtml file
if [ -n "$REMOTE_HOST" ]
then
REL_HTML=${HTMLPATH#$HTMLROOT}
echo "Location: $REL_HTML/index.shtml"
echo
fi
if [ -z "$DEBUG" ]
then
rm -rf $TEMPPATH
fi
exit 0