| 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 <mdsxyz123@yahoo.com> |
|---|
| 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., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 22 | # |
|---|
| 23 | RRDPATH=/usr/local/rrdtool/bin |
|---|
| 24 | RRDB=$1 |
|---|
| 25 | #Heartbeat 15 minutes |
|---|
| 26 | HB=900 |
|---|
| 27 | #Rows 12 * 24 * 7 = 1 week of every 5 minutes |
|---|
| 28 | RW=2016 |
|---|
| 29 | |
|---|
| 30 | if [ $# -ne 1 ] |
|---|
| 31 | then |
|---|
| 32 | echo usage: $0 database.rrd |
|---|
| 33 | exit 1 |
|---|
| 34 | fi |
|---|
| 35 | |
|---|
| 36 | DIR=`dirname $1` |
|---|
| 37 | if [ ! -w $DIR ] |
|---|
| 38 | then |
|---|
| 39 | echo $0: directory $DIR not present or not writable |
|---|
| 40 | exit 1 |
|---|
| 41 | fi |
|---|
| 42 | |
|---|
| 43 | $RRDPATH/rrdtool create $RRDB --step 300 \ |
|---|
| 44 | DS:fan1:GAUGE:${HB}:0:12000 \ |
|---|
| 45 | DS:fan2:GAUGE:${HB}:0:12000 \ |
|---|
| 46 | DS:fan3:GAUGE:${HB}:0:12000 \ |
|---|
| 47 | DS:temp1:GAUGE:${HB}:-25:250 \ |
|---|
| 48 | DS:temp2:GAUGE:${HB}:-25:250 \ |
|---|
| 49 | DS:temp3:GAUGE:${HB}:-25:250 \ |
|---|
| 50 | DS:in0:GAUGE:${HB}:-25:25 \ |
|---|
| 51 | DS:in1:GAUGE:${HB}:-25:25 \ |
|---|
| 52 | DS:in2:GAUGE:${HB}:-25:25 \ |
|---|
| 53 | DS:in3:GAUGE:${HB}:-25:25 \ |
|---|
| 54 | DS:in4:GAUGE:${HB}:-25:25 \ |
|---|
| 55 | DS:in5:GAUGE:${HB}:-25:25 \ |
|---|
| 56 | DS:in6:GAUGE:${HB}:-25:25 \ |
|---|
| 57 | DS:loadavg:GAUGE:${HB}:0:U \ |
|---|
| 58 | RRA:AVERAGE:0.5:1:$RW |
|---|
| 59 | |
|---|