Collectd Configuration for System Monitoring

April 13, 2015 No Comments collectd

system-monitoring-collectd

When you install CollectD, its default configuration already allows it to collect a lot of metrics from your system.
Today we will review this default configuration and change it to collect even more.

Requirements

First, collectd need to be installed on your server.
Here is how to install collectd on Debian / Ubuntu.
It’s also easy to install collectd on CentOS / Fedora.

Edit CollectD Configuration

By default, the collectd configuration is located in /opt/collectd/etc/collectd.conf
Make it look like this collectd configuration example:

Let’s review this configuration.

Interval 1
Collectd will record server performance every second. The default is 10 seconds but 1 second enables quicker anomaly detection.
Running CollectD every second will require a bit more CPU, but on modern hardware this is negligible.

LoadPlugin cpu
Records CPU activity, such as user, nice, system, idle, wait, interrupt, softirq and steal.

LoadPlugin df
Collects information such as the free, reserved and used space of your filesystems (including hard drives)

LoadPlugin filecount
Collects the total size and number of files in a directory. In this configuration we track the directory /var.

LoadPlugin interface
Collect network trafic, download and upload. Records the number of octets, packets and errors for transmission and reception on all network interfaces.

LoadPlugin load
Similar to the load on a UNIX server. Records the CPU load for the last minute, last 15 minutes and last 30 minutes.

LoadPlugin memory
Collects information about the used, buffered, cached and free RAM memory.

LoadPlugin processes
Tracks the number of running, blocked, sleeping, paging, stopped and zombie processes.

LoadPlugin swap
Records the free, cached and used swap space.

LoadPlugin tcpconns
Counts the number of TCP connections on a specified port. With our configuration we record all activity on port 80 (HTTP).

LoadPlugin uptime
Tracks how long your server has been up. Convenient for detecting anomalies when your server crashes.

LoadPlugin users
Collects the number of users logged on the server

Send Metrics to Database

To use collectd you need to send its metrics frequently to a database for monitoring and visualization:

Monitor & detect anomalies with Anomaly.io

SIGN UP
help with term papers