1 collectd on Debian
2 ==================
4 General notes:
5 --------------
7 - Some plugins require additional libraries. To prevent you from having to
8 install dozens of further packages that you don't actually need, there is no
9 strict dependency on those libraries. Rather, they are listed as recommenda-
10 tions ("collectd" package) or suggestions ("collectd-core" package"). See
11 /usr/share/doc/collectd-core/README.Debian.plugins for details.
13 Configuring collectd:
14 ---------------------
16 - See collectd.conf(5) for details about configuring collectd.
18 Access the collected data:
19 --------------------------
21 collectd is able to write data to CSV (comma separated list) and RRD (round
22 robin database - see http://oss.oetiker.ch/rrdtool/) files. However it does
23 not create graphs from these files. This package contains two sample scripts
24 in /usr/share/doc/collectd/examples/ which can be used for this purpose. They
25 are meant to be a starting point for your own experiments - more sophisticated
26 solutions are welcome.
28 - collectd2html.pl: This script by Vincent Stehlé will search for RRD files in
29 "/var/lib/collectd/" and generate a static HTML file and a directory
30 containing several PNG files which are graphs of the RRD files found.
32 - collection.cgi: Sample CGI script that creates graphs on the fly. The Perl
33 modules "RRDs" (package librrds-perl), "URI:Escape" (package liburi-perl),
34 "HTML::Entities" (package libhtml-parser-perl) and a CGI capable web server
35 (e.g. apache2 or boa) are required for this script to run. Simply install
36 the (gunzip'ed) script to a place where the webserver will treat it as a CGI
37 script (/usr/lib/cgi-bin/ by default) and visit that page in a browser
38 (http://localhost/cgi-bin/collection.cgi by default). Please refer to your
39 webserver's documentation for more details.
41 Starting with version 4, collection.cgi requires a small config file, which
42 is installed to /etc/collectd/collection.conf. You should not need to change
43 anything there.
45 - collection3: A graphing front-end for the RRD files created by and filled
46 with collectd. See /usr/share/doc/collectd/examples/collection3/README for
47 details. This is a successor for collection.cgi.
49 Building your own plugins:
50 --------------------------
52 - Originally, plugins for collectd had to be written in C and linked as shared
53 objects. Starting with version 4.0.0, it is also possible to use plugins
54 written in the scripting language Perl or implemented as separate processes.
55 See collectd-perl(5) and collectd-exec(5) for details.
57 - If you want to contribute plugins to the official distribution you should
58 read http://collectd.org/dev-info.shtml.
60 - If you want to build C plugins for your personal use only simply install the
61 collectd-dev package and use /usr/share/doc/collectd-dev/examples/myplugin.c
62 as a starting point (Note: This is already a working example, though it does
63 not collect any useful data).
65 The resulting file can be compiled as follows:
67 gcc -DHAVE_CONFIG_H -shared -fPIC -o myplugin.so myplugin.c
69 Copy myplugin.so to /usr/lib/collectd and add the following line to your
70 collectd config file:
72 LoadPlugin myplugin
74 Restart collectd and you're done.
76 - The collectd-dev package also provides an example Perl plugin that can be
77 used as a starting point for your own development. It can be found in
78 /usr/share/doc/collectd-dev/examples/MyPlugin.pm (Note: This is already a
79 working example, though it does not collect any useful data).
81 To enable the plugin, copy it to a place where Perl can find it (i.e. a
82 subdirectory named "Collectd/Plugin" of a directory listed in @INC) and add
83 the following line to the perl plugin section in your config file:
85 LoadPlugin "Collectd::Plugin::MyPlugin"
87 or
89 BaseName "Collectd::Plugin"
90 LoadPlugin MyPlugin
92 Restart collectd and you're done.
94 Examples:
95 ---------
97 - SpamAssassin/: This directory contains a SpamAssassin plugin which passes
98 statistics to collectd using the email plugin. See the embedded POD
99 documentation for information about setup and configuration: perldoc
100 Collectd.pm.
102 - iptables/: This directory contains a script which will setup iptables to do
103 global logging of all traffic going in and out of an interface. This
104 information can then be collected by collectd's iptables plugin.
106 - collectd-network.py: Python module implementing the collectd network
107 protocol in pure Python. It currently supports to receive data and
108 notifications from collectd.
110 - collectd-unixsock.py: Python module providing an interface to collect's
111 unixsock plugin.
113 - cussh.pl: "Collectd Unix Socket SHell" is a small, interactive front-end for
114 the unixsock plugin. See the embedded POD documentation for details: perldoc
115 cussh.pl.
117 - exec-munin.px: Script to be used with the exec-plugin (see collectd-exec(5)
118 for details) which executes munin plugins, parses the output and translates
119 it to a format the exec-plugin understands. The features are limited -
120 changing the munin plugins to use the output format understood by the
121 exec-plugin is recommended. See the embedded POD documentation for more
122 details: perldoc exec-munin.px.
124 - exec-smartctl: Sample script for the exec plugin. Please refer to the
125 documentation in the file - you will have to adapt it to your needs anyway.
127 - network-proxy.py: A simple unicast proxy for collectd traffic.
129 - snmp-data.conf: Sample configuration for the SNMP plugin. This config
130 includes a few standard <Data ..> definitions that you can include in your
131 own config using the `Include' statement (available since version 4.2.0).
132 The config includes some data that is defined in the IF-MIB, e. g. octet or
133 packet counters, UPS-MIB and whatever people have send in. If you have some
134 more definitions please send them in, so others can profit from it.
136 - snmp-probe-host.px: Script to be used to automatically generate SNMP
137 configuration snippets for the "snmp" plugin. See the embedded POD
138 documentation for more details: perldoc snmp-probe-host.px.
140 Additional helper scripts:
141 --------------------------
143 - add_rra.sh: Before version 3.9.0 collectd used to create a different set of
144 RRAs. The most detailed of these old RRAs had a one minute resolution. This
145 script can be used to add three more RRAs: minimum, maximum and average with
146 a ten second resolution and 2200 rows (~6 hours). This will make hourly
147 statistics much more interesting. Please note that no sanity-checking
148 whatsoever is performed. You can seriously screw up your RRD files if you
149 don't know what you're doing.