delete obsolete temp.chart.sh - it has been replaced with sensors.chart.sh
Costa Tsaousis (ktsaou) committed
Oct 4, 2015 at 00:09 UTC
e3ba9b015d714d75d317b618e56624f0f064ef75
1 file changed
-108
charts.d/temp.chart.sh
deleted
-108
@@ -1,108 +0,0 @@
1
-#!/bin/sh
2
-
3
-# if this chart is called X.chart.sh, then all functions and global variables
4
-# must start with X_
5
-
6
-# _update_every is a special variable - it holds the number of seconds
7
-# between the calls of the _update() function
8
-temp_update_every=
9
-
10
-temp_find_all_files() {
11
- find $1 -name temp\?_input -o -name temp 2>/dev/null
12
-}
13
-
14
-temp_find_all_dirs() {
15
- temp_find_all_files $1 | while read
16
- do
17
- dirname $REPLY
18
- done | sort -u
19
-}
20
-
21
-# _check is called once, to find out if this chart should be enabled or not
22
-temp_check() {
23
-
24
- # this should return:
25
- # - 0 to enable the chart
26
- # - 1 to disable the chart
27
-
28
- [ ! -z "$( temp_find_all_files /sys/devices/ )" ] && return 0
29
- return 1
30
-}
31
-
32
-# _create is called once, to create the charts
33
-temp_create() {
34
- local path= dir= name= x= file= lfile= labelname= labelid= device= subsystem= id= type=
35
-
36
- echo >$TMP_DIR/temp.sh "temp_update() {"
37
-
38
- for path in $( temp_find_all_dirs /sys/devices/ | sort -u )
39
- do
40
- dir=$( basename $path )
41
- device=
42
- subsystem=
43
- id=
44
- type=
45
- name=
46
-
47
- [ -h $path/device ] && device=$( readlink -f $path/device )
48
- [ ! -z "$device" ] && device=$( basename $device )
49
- [ -z "$device" ] && device="$dir"
50
-
51
- [ -h $path/subsystem ] && subsystem=$( readlink -f $path/subsystem )
52
- [ ! -z "$subsystem" ] && subsystem=$( basename $subsystem )
53
- [ -z "$subsystem" ] && subsystem="$dir"
54
-
55
- [ -f $path/name ] && name=$( cat $path/name )
56
- [ -z "$name" ] && name="$dir"
57
-
58
- [ -f $path/type ] && type=$( cat $path/type )
59
- [ -z "$type" ] && type="$dir"
60
-
61
- id="$( fixid "$device.$subsystem.$dir" )"
62
-
63
- echo >&2 "charts.d: temperature sensors on path='$path', dir='$dir', device='$device', subsystem='$subsystem', id='$id', name='$name'"
64
-
65
- echo "CHART temperature.${id} '' '${name} Temperature' 'Temperature' 'Celcius Degrees' '' line 6000 $temp_update_every"
66
- echo >>$TMP_DIR/temp.sh "echo \"BEGIN temperature.${id} \$1\""
67
-
68
- for x in $( temp_find_all_files $path | sort -u )
69
- do
70
- file="$x"
71
- fid="$( fixid "$file" )"
72
- lfile="$( basename $file | sed "s|_input$|_label|g" )"
73
- labelname="$( basename $file )"
74
-
75
- if [ ! "$path/$lfile" = "$file" -a -f "$path/$lfile" ]
76
- then
77
- labelname="$( cat "$path/$lfile" )"
78
- fi
79
-
80
- echo "DIMENSION $fid '$labelname' absolute 1 1000"
81
- echo >>$TMP_DIR/temp.sh "printf \"SET $fid = \"; cat $file "
82
-
83
- # echo >&2 "charts.d: temperature sensor on file='$file', label='$labelname'"
84
- done
85
-
86
- echo >>$TMP_DIR/temp.sh "echo END"
87
- done
88
-
89
- echo >>$TMP_DIR/temp.sh "}"
90
- . $TMP_DIR/temp.sh
91
-
92
- return 0
93
-}
94
-
95
-# _update is called continiously, to collect the values
96
-temp_update() {
97
- # the first argument to this function is the microseconds since last update
98
- # pass this parameter to the BEGIN statement (see bellow).
99
-
100
- # do all the work to collect / calculate the values
101
- # for each dimension
102
- # remember: KEEP IT SIMPLE AND SHORT
103
-
104
-# . $TMP_DIR/temp.sh $1
105
-
106
- return 0
107
-}
108
-