#------------------------------------------------------------------------------ # OPT_RRDTOOL /etc/rc.d/rc940.rrdtool __FLI4LVER__ # Creation: bastard # Last Update: $Id$ #------------------------------------------------------------------------------ if [ "$OPT_RRDTOOL" = "yes" ] then begin_script RRDTOOL "starting rrdtool..." 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 map2persistent RRDTOOL_DB_PATH mkdir -p $RRDTOOL_DB_PATH/$HOSTNAME/ # replace dbpath marker with real $RRDTOOL_DB_PATH for f in /srv/www/include/rrd-*.inc do sed -i $f -e "s#{dbpath}#$RRDTOOL_DB_PATH/$HOSTNAME#" done sed -i /etc/rrd/settings.inc -e "s#{dbpath}#$RRDTOOL_DB_PATH/$HOSTNAME#" # 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 10" echo "LoadPlugin syslog" if [ "$RRDTOOL_NET" = "yes" ] then echo "LoadPlugin network" echo "" if [ "x$RRDTOOL_NET_PORT" = "x" ] then echo "Server \"$RRDTOOL_NET_HOST\"" else echo "Server \"$RRDTOOL_NET_HOST\" \"$RRDTOOL_NET_PORT\"" fi echo "" fi echo "LoadPlugin conntrack" echo "LoadPlugin cpu" if [ -e /sys/devices/system/cpu/cpu0/cpufreq ] then echo "LoadPlugin cpufreq" fi echo "LoadPlugin df" echo "" for fs in `df | cut -c 57- | grep -v "Mounted" | sort -u` do if [ "$fs" != "/var/lib/persistent" ] then echo "MountPoint \"$fs\"" fi done echo "" #echo "LoadPlugin disk" #echo "" #echo "Disk \"/^[hs]d[a-f][0-9]?$/\"" #echo "IgnoreSelected false" #echo "" echo "LoadPlugin entropy" #echo "LoadPlugin interface" echo "LoadPlugin irq" echo "LoadPlugin load" echo "LoadPlugin memory" echo "LoadPlugin netlink" echo "" echo "Interface \"All\"" if [ "$OPT_QOS" = "yes" ] then if [ "$OPT_QOS_IFB" = "yes" ] then for i in $(seq ${QOS_INTERNET_DEV_N:-0}) do eval extint=\$QOS_INTERNET_DEV_$i ifbint=$(sed -n "s/^$extint \(.*\)$/\1/p" $QOS_CONFIG_DIR/qos.devices) for classidx in $(seq $((${QOS_CLASS_N:-0}+1))) do # normally, this would be 10:${classidx}, but our # collectd is patched such that QoS also works on FAT # volumes (see collectd-netlink-store.patch), hence '_' # instead of ':' class="htb-10_${classidx}" eval local direction=\$QOS_CLASS_${classidx}_DIRECTION case "$direction" in up) echo "Class \"$extint\" \"${class}\"" ;; down) echo "Class \"$ifbint\" \"${class}\"" ;; '') # this is the root class echo "Class \"$extint\" \"${class}\"" echo "Class \"$ifbint\" \"${class}\"" ;; esac done done else for cl in `tc class list dev imq0 | cut -d " " -f 3 | tr '[:]' '[_]'` do echo "Class \"imq0\" \"htb-${cl}\"" done for cl in `tc class list dev imq1 | cut -d " " -f 3 | tr '[:]' '[_]'` do echo "Class \"imq1\" \"htb-${cl}\"" done fi fi echo "" if [ "$OPT_NTP" = "yes" ] then echo "LoadPlugin ntpd" #echo "" #echo "Host \"localhost\"" #echo "Port 123\"" #echo "ReverseLookups false" #echo "" fi if [ "$OPT_WLAN" = "yes" ] then wlan=false for i in `ls -l /var/run/wlan_wlan*_idx.conf | cut -d "_" -f2` do mode=`grep WLAN_MODE /var/run/wlan_"$i".conf | cut -d "'" -f2` if [ "$mode" = "managed" -o "$mode" = "ad-hoc" ] then wlan=true fi done if [ "$wlan" == "true" ] then echo "LoadPlugin wireless" fi fi if [ "0$RRDTOOL_PING_N" -gt 0 ] then echo "LoadPlugin ping" echo "" for rrdtool_idx in `seq 1 $RRDTOOL_PING_N` do eval rrdtool_tmp='$RRDTOOL_PING_'$rrdtool_idx echo "Host \"$rrdtool_tmp\"" done if [ "$OPT_IPV6" != "yes" ] then echo "SourceAddress \"$HOSTNAME\"" fi echo "TTL \"255\"" echo "Interval \"5\"" echo "MaxMissed \"5\"" echo "" fi if [ "0$RRDTOOL_PEERPING_N" -gt 0 ] then echo LoadPlugin exec echo "" echo "Exec \"nobody\" \"/etc/collectd/peerping.sh\"" echo "" fi if [ "$RRDTOOL_UNIXSOCK" = "yes" ] then echo "LoadPlugin unixsock" echo "" echo "SocketFile \"/var/run/collectd.sock\"" echo "SocketGroup \"root\"" echo "SocketPerms \"0777\"" echo "" fi echo "LoadPlugin processes" echo "LoadPlugin rrdcached" echo "" echo "DaemonAddress \"$RRDCACHED_SOCKET\"" echo "DataDir \"$RRDTOOL_DB_PATH\"" echo "CreateFiles true" echo "CreateFilesAsync true" echo "#CollectStatistics true" echo "" echo "#LoadPlugin rrdtool" echo "#" echo "#CacheTimeout 300" echo "#" if [ -f /etc/sensors3.conf ] then echo "LoadPlugin sensors" #echo "" #echo "Sensor \"it8712-isa-0290/temperature-temp1\"" #echo "Sensor \"it8712-isa-0290/fanspeed-fan3\"" #echo "Sensor \"it8712-isa-0290/voltage-in8\"" #echo "IgnoreSelected false" #echo "" fi #echo "LoadPlugin tcpconns" #echo "" #echo "ListeningPorts false" #echo "LocalPort \"25\"" #echo "RemotePort \"25\"" #echo "" # if [ "$OPT_OPENVPN" = "yes" ] # then # echo "LoadPlugin openvpn" # echo "" # # StatusFile "/etc/openvpn/openvpn-status.log" # echo "" # fi if [ "$RRDTOOL_OWFS" = "yes" ] then echo "LoadPlugin onewire" echo "" echo "Interval 5" echo "Device \"-s $RRDTOOL_OWFS_HOST:$RRDTOOL_OWFS_PORT\"" echo "" fi if [ "$RRDTOOL_APCUPS" = "yes" ] then echo "LoadPlugin apcups" echo "" echo "Host \"$RRDTOOL_APCUPS_HOST\"" echo "Port \"$RRDTOOL_APCUPS_PORT\"" echo "" fi echo "LoadPlugin uptime" }>/etc/collectd.conf ping_used=no #save configvars for peerping if [ "0$RRDTOOL_PEERPING_N" -gt 0 ] then grep RRDTOOL_PEERPING /etc/rc.cfg > /var/run/rrdtool_peerping.conf fi # save configvars for ping-cgi if [ "0$RRDTOOL_PING_N" -gt 0 ] then grep RRDTOOL_PING /etc/rc.cfg > /var/run/rrdtool_ping.conf fi #################################################################### # code to move rrd-Datebases from interface-Plugin to netlink-Plugin #################################################################### old_pwd=`pwd` cd $RRDTOOL_DB_PATH/$HOSTNAME for d in interface-* do if [ -d "$d" ] then i=${d#*-} if [ ! -d netlink-$i ] then mv interface-$i netlink-$i fi fi done cd $old_pwd ##### # end ##### # create dir in ramdisk for the rrdcached-journal to reduces write to # harddisk like compactdisk, usb-stick,sd-card, ... mkdir -p /var/run/rrdcached log_info "starting rrdcached" # Valid options are: # -l
Socket address to listen to. # Default: unix:/tmp/rrdcached.sock # -P Sets the permissions to assign to all following sockets # -w Interval in which to write data. # -z Delay writes up to seconds to spread load # -t Number of write threads. # -f Interval in which to flush dead data. # -p Location of the PID-file. # -b Base directory to change to. # -B Restrict file access to paths within -b # -g Do not fork and run in the foreground. # -j Directory in which to create the journal files. # -F Always flush all updates at shutdown # -s Group owner of all following UNIX sockets # (the socket will also have read/write permissions for that group) # -m File permissions (octal) of all following UNIX sockets if [ "x$RRDTOOL_CACHETIME" != "x" ] then rrdcached -j /var/run/rrdcached -t 2 -F -z 5 -w $RRDTOOL_CACHETIME -f $((RRDTOOL_CACHETIME*2)) -l $RRDCACHED_SOCKET else rrdcached -j /var/run/rrdcached -t 2 -F -z 5 -l $RRDCACHED_SOCKET fi # wait some time, rrdcached need time to initalize sleep 5 log_info "starting collectd" # start colletd daemon to sample all available data collectdmon end_script fi