collectd on Debian ================== General notes: -------------- - Some plugins require additional libraries. To prevent you from having to install dependencies that you don't actually need those libraries are recommendations rather than dependencies. See README.Debian.plugins in the "collectd" package for details. Configuring collectd: --------------------- - See collectd.conf(5) for details about configuring collectd. Access the collected data: -------------------------- collectd is able to write data to CSV (comma separated list) and RRD (round robin database - see http://oss.oetiker.ch/rrdtool/) files. However it does not create graphs from these files. This package contains two sample scripts in /usr/share/doc/collectd/examples/ which can be used for this purpose. They are meant to be a starting point for your own experiments - more sophisticated solutions are welcome. - collectd2html.pl: This script by Vincent Stehlé will search for RRD files in "/var/lib/collectd/" and generate a static HTML file and a directory containing several PNG files which are graphs of the RRD files found. - collection.cgi: Sample CGI script that creates graphs on the fly. The Perl modules "RRDs" (package librrds-perl), "URI:Escape" (package liburi-perl), "HTML::Entities" (package libhtml-parser-perl) and a CGI capable web server (e.g. apache2 or boa) are required for this script to run. Simply install the (gunzip'ed) script to a place where the webserver will treat it as a CGI script (/usr/lib/cgi-bin/ by default) and visit that page in a browser (http://localhost/cgi-bin/collection.cgi by default). Please refer to your webserver's documentation for more details. Starting with version 4, collection.cgi requires a small config file, which is installed to /etc/collectd/collection.conf. You should not need to change anything there. Building your own plugins: -------------------------- - Originally, plugins for collectd had to be written in C and linked as shared objects. Starting with version 4.0.0, it is also possible to use plugins written in the scripting language Perl or implemented as separate processes. See collectd-perl(5) and collectd-exec(5) for details. - If you want to contribute plugins to the official distribution you should read http://collectd.org/dev-info.shtml. - If you want to build C plugins for your personal use only simply install the collectd-dev package and use /usr/share/doc/collectd-dev/examples/myplugin.c as a starting point (Note: This is already a working example, though it does not collect any useful data). The resulting file can be compiled as follows: gcc -shared -fPIC -o myplugin.so myplugin.c Copy myplugin.so to /usr/lib/collectd and add the following line to your collectd config file: LoadPlugin myplugin Restart collectd and you're done. - The collectd-dev package also provides an example Perl plugin that can be used as a starting point for your own development. It can be found in /usr/share/doc/collectd-dev/examples/MyPlugin.pm (Note: This is already a working example, though it does not collect any useful data). To enable the plugin, copy it to a place where Perl can find it (i.e. a subdirectory named "Collectd/Plugin" of a directory listed in @INC) and add the following line to the perl plugin section in your config file: LoadPlugin "Collectd::Plugin::MyPlugin" or BaseName "Collectd::Plugin" LoadPlugin MyPlugin Restart collectd and you're done. Additional helper scripts: -------------------------- - The directory /usr/share/doc/collectd/examples/PerlLib/ contains Perl modules which can be used in conjunction with collectd. See the perldoc documentation of the .pm-files to find out what they're good for. - add_rra.sh: Before version 3.9.0 collectd used to create a different set of RRAs. The most detailed of these old RRAs had a one minute resolution. This script can be used to add three more RRAs: minimum, maximum and average with a ten second resolution and 2200 rows (~6 hours). This will make hourly statistics much more interesting. Please note that no sanity-checking whatsoever is performed. You can seriously screw up your RRD files if you don't know what you're doing.