65 lines
1.3 KiB
Bash
Executable File
65 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Simple RRD setup
|
|
# Netowrk traffic in bytes/sec
|
|
# Disk reads/writes in bytes/sec
|
|
# Load average as reported by /proc/loadavg
|
|
# Needs: sysstat iostat
|
|
|
|
CONFIGDIR=$(pwd)
|
|
sed "3i . ${CONFIGDIR}/rrd_config" update_graphs.sh > update_graphs.sh
|
|
|
|
. ${CONFIGDIR}/rrd_config
|
|
|
|
if [ ! -d "$RRDDIR" ]; then
|
|
mkdir -p $RRDDIR
|
|
fi
|
|
|
|
cd $RRDDIR
|
|
|
|
# Create RRDs for network interfaces
|
|
for i in "${INTERFACES[@]}"
|
|
do
|
|
if [ ! -f ${i}_day.rrd ]; then
|
|
$RRDTOOL create ${i}_day.rrd \
|
|
--step 15 \
|
|
DS:RXBytes:DERIVE:240:0:1000000000000000 \
|
|
DS:TXBytes:DERIVE:240:0:1000000000000000 \
|
|
RRA:AVERAGE:0.5:1:576 \
|
|
RRA:AVERAGE:0.5:6:672 \
|
|
RRA:AVERAGE:0.5:24:732 \
|
|
RRA:AVERAGE:0.5:144:1460
|
|
fi
|
|
done
|
|
|
|
# Create RRDs for disks
|
|
for i in "${DISKS[@]}"
|
|
do
|
|
if [ ! -f {i}.rrd ]; then
|
|
$RRDTOOL create ${i}.rrd \
|
|
--step 15 \
|
|
DS:reads:DERIVE:30:0:1000000000000000 \
|
|
DS:writes:DERIVE:30:0:1000000000000000 \
|
|
RRA:AVERAGE:0.5:1:576 \
|
|
RRA:AVERAGE:0.5:6:672 \
|
|
RRA:AVERAGE:0.5:24:732 \
|
|
RRA:AVERAGE:0.5:144:1460
|
|
fi
|
|
done
|
|
|
|
# Create load average RRD
|
|
if [ ! -f loadavg.rrd ]; then
|
|
$RRDTOOL create loadavg.rrd \
|
|
--step 15 \
|
|
DS:one:GAUGE:30:0:100 \
|
|
DS:five:GAUGE:30:0:100 \
|
|
DS:fifteen:GAUGE:30:0:100 \
|
|
RRA:AVERAGE:0.5:1:576 \
|
|
RRA:AVERAGE:0.5:6:672 \
|
|
RRA:AVERAGE:0.5:24:732 \
|
|
RRA:AVERAGE:0.5:144:1460
|
|
fi
|
|
|
|
|
|
|