collectd
collectd is a daemon that regularly collects, transfers, and stores system information. It is typically used for collecting performance information and other system data like disk, memory, and network usage, and from many other sources using a number of plugins. Other software can then be used to read databases of collected information to plot it and analyze it.
Installation
USE Flags
USE flags for app-metrics/collectd Collects system statistics and provides mechanisms to store the values
+filecaps
|
When set collectd daemon will have set required capabilities to run most plugins even if run as unprivileged user |
contrib
|
Install user-contributed files in the doc directory |
debug
|
Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces |
java
|
Must be set (workaround for java-pkg-opt-2 eclass limitation) when you want java or genericjmx plugin |
perl
|
Add optional support/bindings for the Perl language |
selinux
|
!!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur |
static-libs
|
Build static versions of dynamic libraries as well |
udev
|
Enable optional udev usage in disk plugin; Required for smart plugin |
xfs
|
Enable optional capability to filter on XFS file system in df plugin; Requires XFS headers from sys-fs/xfsprogs |
Emerge
First, determine which plugins you want on your system. The collectd wiki contains a list of plugins, or check the collectd man page. These plugins are specified as USE flags with a collectd_plugins_
prefix, though these can also be specified with a COLLECTD_PLUGINS
variable in /etc/portage/make.conf:
*/* COLLECTD_PLUGINS: load memory syslog
collectd requires a plugin to enable any sort of logging. Make sure you enable the syslog plugin and/or the logfile plugin.
To write data, you need to enable write plugins. The rrdtool plugin is a common plugin. Data can be written to other collectd daemons using the network plugin.
To install:
root #
emerge --ask app-metrics/collectd
Configuration
With collectd and some plugins installed, enable them in the configuration file by uncommenting them, for instance, the syslog plugin:
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
rrdtool plugin
Default location for saving the rrd files by collectd is BaseDir but that will mix the rrdtool's files with other plugins. So redefine it.
<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"
</Plugin>
Service
To start collectd on start-up:
root #
rc-update add collectd default
Troubleshooting
Check the logs for errors after starting up to make sure everything is going smoothly.
Plotting front-end packages
Also see the full list of front-ends known by collectd.