Debian Codegraph @

prog/rrd/sens_create_rrd

raw
1 #!/bin/sh
2 #
3 # sens_create_rrd -
4 # Create a sensors rrd database of 14 sensor readings
5 # at 5 minute intervals for 1 week.
6 #
7 # Copyright 2001 Mark D. Studebaker <[email protected]>
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 # MA 02110-1301 USA.
23 #
24 RRDPATH=/usr/bin
25 RRDB=$1
26 #Heartbeat 15 minutes
27 HB=900
28 #Rows 12 * 24 * 7 = 1 week of every 5 minutes
29 RW=2016
30
31 if [ $# -ne 1 ]
32 then
33 echo usage: $0 database.rrd
34 exit 1
35 fi
36
37 DIR=`dirname $1`
38 if [ ! -w $DIR ]
39 then
40 echo $0: directory $DIR not present or not writable
41 exit 1
42 fi
43
44 $RRDPATH/rrdtool create $RRDB --step 300 \
45 DS:fan1:GAUGE:${HB}:0:12000 \
46 DS:fan2:GAUGE:${HB}:0:12000 \
47 DS:fan3:GAUGE:${HB}:0:12000 \
48 DS:temp1:GAUGE:${HB}:-25:250 \
49 DS:temp2:GAUGE:${HB}:-25:250 \
50 DS:temp3:GAUGE:${HB}:-25:250 \
51 DS:in0:GAUGE:${HB}:-25:25 \
52 DS:in1:GAUGE:${HB}:-25:25 \
53 DS:in2:GAUGE:${HB}:-25:25 \
54 DS:in3:GAUGE:${HB}:-25:25 \
55 DS:in4:GAUGE:${HB}:-25:25 \
56 DS:in5:GAUGE:${HB}:-25:25 \
57 DS:in6:GAUGE:${HB}:-25:25 \
58 DS:loadavg:GAUGE:${HB}:0:U \
59 RRA:AVERAGE:0.5:1:$RW
60