Created
January 13, 2016 18:37
-
-
Save halcyonardency/8d5042fcdf05c2a22450 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PKGS="collectd collectd-apache collectd-curl collectd-dns collectd-ipmi collectd-netlink collectd-ping collectd-redis collectd-write_redis" | |
/usr/bin/yum -q -y install ${PKGS} | |
CNFFILE="/etc/collectd.conf" | |
CNFDIR="/etc/collectd.d" | |
BACKUPDIR="/root/collectd.`date +%s`" | |
mkdir -p ${BACKUPDIR} | |
mv -v ${CNFDIR}/* ${BACKUPDIR}/ | |
cp -v ${CNFFILE} ${BACKUPDIR}/ | |
mkdir -p ${CNFDIR}/ | |
echo 'LoadPlugin syslog | |
<Plugin syslog> | |
LogLevel "info" | |
</Plugin> | |
Include "'${CNFDIR}'/*.conf"' > ${CNFFILE} | |
echo "Hostname \"`hostname`\"" > ${CNFDIR}/00-global.conf | |
echo 'ReadThreads 6 | |
WriteThreads 2 | |
# Limit the size of the write queue. Default is no limit. Setting up a limit is | |
# recommended for servers handling a high volume of traffic. | |
WriteQueueLimitHigh 3000000 | |
WriteQueueLimitLow 2048 | |
# XXX 10 second resolution | |
Interval 10' >> ${CNFDIR}/00-global.conf | |
echo 'LoadPlugin write_graphite | |
<Plugin write_graphite> | |
<Carbon> | |
Host "SOME_GRAPHITE_SERVER" | |
Port "2003" | |
Protocol "tcp" | |
Prefix "SOME_PREFIX." | |
Postfix "" | |
StoreRates true | |
AlwaysAppendDS false | |
EscapeCharacter "_" | |
SeparateInstances true | |
</Carbon> | |
</Plugin>' > ${CNFDIR}/10-write_graphite.conf | |
echo 'LoadPlugin contextswitch' > ${CNFDIR}/20-contextswitch.conf | |
echo 'LoadPlugin cpu' > ${CNFDIR}/20-cpu.conf | |
echo 'LoadPlugin df | |
<Plugin df> | |
FSType "ext3" | |
FSType "ext4" | |
FSType "xfs" | |
FSType "btrfs" | |
FSType "tmpfs" | |
IgnoreSelected false | |
</Plugin>' > ${CNFDIR}/20-df.conf | |
echo 'LoadPlugin disk' > ${CNFDIR}/20-disk.conf | |
echo 'LoadPlugin dns' > ${CNFDIR}/20-dns.conf | |
echo 'LoadPlugin interface' > ${CNFDIR}/20-interface.conf | |
echo 'LoadPlugin protocols' > ${CNFDIR}/20-protocols.conf | |
echo 'LoadPlugin load' > ${CNFDIR}/20-load.conf | |
echo 'LoadPlugin memory' > ${CNFDIR}/20-memory.conf | |
echo 'LoadPlugin ping | |
<Plugin ping> | |
Host "SOME_DNS_RESOLVERA" | |
Host "SOME_DNS_RESOLVERB" | |
Host "8.8.8.8" | |
Interval 5.0 | |
Timeout 1.0 | |
MaxMissed 5 | |
</Plugin>' > ${CNFDIR}/30-ping.conf | |
ps wu -C collectd | |
/sbin/service collectd restart | |
/sbin/chkconfig --add collectd | |
/sbin/chkconfig collectd on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment