#------------------------------------------------------------------------------
# OPT_RRDTOOL3 /etc/rc.d/rc940.rrdtool3 __FLI4LVER__
# Creation: bastard
# Last Update: $Id$
#------------------------------------------------------------------------------
if [ "$OPT_RRDTOOL3" = "yes" ]
then
begin_script RRDTOOL3 "starting rrdtool3..."
RRDCACHED_SOCKET=unix:/var/run/rrdcached.sock
# the export won't work right now, I need to talk with jean about this
# we should create a common consense about settings the env.
export RRDCACHED_SOCKET
mkdir -p $RRDTOOL3_DB_PATH/$HOSTNAME/
# replace dbpath marker with real $RRDTOOL3_DB_PATH
# we should remove this some, everything should use /etc/rrd/settings.inc
# now
for f in /srv/www/include/rrd-*.inc
do
sed -i $f -e "s#{dbpath}#$RRDTOOL3_DB_PATH/$HOSTNAME#"
done
sed -i /etc/rrd/settings.inc -e "s#{dbpath}#$RRDTOOL3_DB_PATH/$HOSTNAME#"
ln -s /usr/lib/lua/5.1/rrd.so.0.0.0 /usr/lib/lua/5.1/rrd.so
# create config file for collectd
{
echo "Hostname \"$HOSTNAME\""
echo "FQDNLookup true"
echo "#BaseDir \"/var/lib/collectd\""
echo "#PIDFile \"/var/run/collectd.pid\""
echo "PluginDir \"/usr/lib/collectd\""
echo "TypesDB \"/usr/share/collectd/types.db\""
echo "#Interval 10"
echo "#ReadThreads 5"
echo "LoadPlugin syslog"
echo "LoadPlugin conntrack"
echo "LoadPlugin cpu"
#echo "LoadPlugin df"
echo "LoadPlugin disk"
echo ""
echo "Disk \"/^[hs]d[a-f][0-9]?$/\""
echo "IgnoreSelected false"
echo ""
echo "LoadPlugin entropy"
echo "LoadPlugin interface"
#echo ""
#echo "Interface \"eth0\""
#echo "IgnoreSelected false"
#echo ""
echo "LoadPlugin irq"
echo "LoadPlugin load"
echo "LoadPlugin memory"
#echo "LoadPlugin netlink"
#echo ""
#echo "Interface \"All\""
#echo "VerboseInterface \"All\""
# QDisc "eth0" "pfifo_fast-1:0"
# Class "ppp0" "htb-1:10"
# Filter "ppp0" "u32-1:0"
#echo "IgnoreSelected false"
#echo ""
echo "LoadPlugin network"
if [ "$OPT_NTP" = "yes" ]
then
echo "LoadPlugin ntpd"
#
#Host "localhost"
#Port 123
#ReverseLookups false
#
fi
if [ "$RRDTOOL3_PING_N" -gt 0 ]
then
echo "LoadPlugin ping"
echo ""
for rrdtool_idx in `seq 1 $RRDTOOL3_PING_N`
do
eval rrdtool_tmp='$RRDTOOL3_PING_'$rrdtool_idx
echo "Host \"$rrdtool_tmp\""
done
echo "TTL 255"
echo "Interval 30"
echo ""
fi
echo "LoadPlugin processes"
#echo ""
#echo "Process \"openvpn\""
#echo "Process \"dnsmasq\""
#echo ""
echo "LoadPlugin rrdcached"
echo ""
echo "DaemonAddress \"$RRDCACHED_SOCKET\""
echo "DataDir \"$RRDTOOL3_DB_PATH\""
echo "CreateFiles true"
echo "CollectStatistics true"
echo ""
if [ -f /etc/sensors3.conf ]
then
echo "LoadPlugin sensors"
#
# Sensor "it8712-isa-0290/temperature-temp1"
# Sensor "it8712-isa-0290/fanspeed-fan3"
# Sensor "it8712-isa-0290/voltage-in8"
# IgnoreSelected false
#
fi
#echo "LoadPlugin tcpconns"
#
# ListeningPorts false
# LocalPort "25"
# RemotePort "25"
#
# if [ "$OPT_OPENVPN" = "yes" ]
# then
# echo "LoadPlugin openvpn"
# echo ""
# # StatusFile "/etc/openvpn/openvpn-status.log"
# echo ""
# fi
echo "LoadPlugin uptime"
}>/etc/collectd.conf
# start rrd Cache daemon
rrdcached -j $RRDTOOL3_DB_PATH/$HOSTNAME -t 16 -l $RRDCACHED_SOCKET
# start colletd daemon to sample all available data
collectdmon
# saveconfig for ping-cgi
if [ "$RRDTOOL3_PING_N" -gt 0 ]
then
echo "RRDTOOL3_PING_N='$RRDTOOL3_PING_N'" > /var/run/rrdtool3_ping.conf
for rrdtool_idx in `seq 1 $RRDTOOL3_PING_N`
do
echo "RRDTOOL3_PING_$rrdtool_idx='$RRDTOOL3_PING_'$rrdtool_idx" >> /var/run/rrdtool3_ping.conf
done
fi
end_script
fi