xref: /openbmc/ipmitool/contrib/create_rrds.sh (revision c18ec02f)
1#!/bin/bash
2#
3#  Copyright (c) 2003 Fredrik Ohrn.  All Rights Reserved.
4#
5#  See the included COPYING file for license details.
6#
7
8# Edit the variables
9
10hostname=$HOSTNAME
11
12ipmi_cmd="/usr/local/bin/ipmitool -I open"
13rrd_dir="/some/dir/rrd"
14
15# No need to edit below this point.
16
17IFS="
18"
19
20for line in `eval $ipmi_cmd -c -v sdr list full` ; do
21
22	IFS=,
23
24	split=($line)
25
26	file="$rrd_dir/$hostname-${split[0]}.rrd"
27
28	if [ -e "$file" ] ; then
29		echo "Skipping existing file $file"
30		continue
31	fi
32
33	echo "Creating file $file"
34
35	rrdtool create "$file" \
36		--step 300 DS:var:GAUGE:900:${split[16]}:${split[17]} \
37		RRA:AVERAGE:0.5:1:288 \
38		RRA:AVERAGE:0.5:6:336 \
39		RRA:AVERAGE:0.5:12:720
40done
41