File: i2c_fan.in

package info (click to toggle)
munin 1.2.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,940 kB
  • ctags: 98
  • sloc: sh: 4,215; makefile: 452; perl: 135
file content (46 lines) | stat: -rwxr-xr-x 1,194 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# NOTE: This plugins is outdated. Use the sensors_ wildcard plugin instead.
#
# $Log$
# Revision 1.2  2004/02/05 16:47:02  jimmyo
# Added new wildcard plugin linux/sensors_ that replaces the i2c plugins (SF#890952).
#
# Revision 1.1  2004/01/02 18:50:01  jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.5  2003/11/07 22:12:50  jimmyo
# Changed deprecated plugin options
#
# Revision 1.4  2003/11/07 17:43:16  jimmyo
# Cleanups and log entries
#
#
#%# family=contrib

STATEFILE="@@PLUGSTATE@@/plugin-i2c_temp.state"

if [ "$1" = "config" ]; then
        echo 'graph_title Fan speed'
	echo 'graph_vtitle RPM'
	echo 'graph_order fan1=i2c:fan'
	echo 'graph_args -l 0'
	echo 'fan1.label fan1'
	echo 'fan1.graph no'
        exit 0
fi

if [ -f "$STATEFILE" ]; then
	if [ $(($(date +"%s")-$(stat -c "%Z" $STATEFILE))) -gt 60 ]; then
	    sensors $chips | tee $STATEFILE | awk '/fan/ {++i; print $1 ".value", $2+0}'
	else
	    cat $STATEFILE |awk '/fan/ {++i; print $1 ".value", $2+0}'
	fi
else
	sensors $chips | tee $STATEFILE | awk '/fan/ {++i; print $1 ".value", $2+0}'
fi