#########
Collectd
#########
General
=======
* Delete all ~ and other backup files in /etc/collectd.d or you get tons of "Value is too old" error messages
* Graph aggregation http://collectd.org/wiki/index.php/Plugin:Aggregation
Check config file
=================
.. code-block:: bash
collectd -ft
Debugging
=========
* Add this to your config file
.. code-block:: bash
LoadPlugin logfile
LogLevel debug
File STDOUT
* Start collectd in foreground
.. code-block:: bash
collectd -f -C /etc/collectd.conf
Example SNMP config
====================
* For single values use ``Table false``
.. code-block:: bash
Type "gauge"
Table true
Values ".1.3.6.1.4.1.34097.9.80.1.1.6.1"
Address "1.2.3.4"
Version 1
Community "public"
Collect "a_value"
Interval 5
Graphite output plugin
=======================
.. code-block:: bash
LoadPlugin "write_graphite"
Host "127.0.0.1"
Port "2003"
Protocol "tcp"
Prefix "collectd."
EscapeCharacter "_"
SeparateInstances true
StoreRates false
AlwaysAppendDS false
Mongodb output
==============
.. code-block:: bash
LoadPlugin write_mongodb
Host "localhost"
Port "27017"
Timeout 2000
StoreRates true
RRD output
============
* For using rrdcached (prefered method)
.. code-block:: bash
LoadPlugin rrdcached
DaemonAddress "unix:/var/run/rrdcached/rrdcached.sock"
DataDir "/var/lib/collectd/rrd"
CreateFiles true
* For direct rrd
.. code-block:: bash
LoadPlugin rrdtool
DataDir "/var/lib/collectd/rrd"
CacheTimeout 120
CacheFlush 900
# default 3600, 86400, 604800, 2678400, 31622400
# RRATimespan
Example tail file
=================
.. code-block:: bash
LoadPlugin tail
Instance "httpd_error"
Regex "python"
DSType "CounterInc"
Type "counter"
Instance "total"
Example exec plugin
===================
* Source of script (e.g. /usr/bin/count_lines_in_file)
.. code-block:: bash
#!/bin/bash
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
FILE=$1
while sleep "$INTERVAL"; do
VALUE=`cat $FILE | wc -l`
echo "PUTVAL \"$HOSTNAME/"`basename $FILE`"_count/counter\" interval=$INTERVAL N:$VALUE"
done
* Config for plugin
.. code-block:: bash
LoadPlugin exec
Exec "nobody" "/usr/bin/count_lines_in_file" "/var/log/httpd/error_log"