CollectD is one of the best daemons for regularly collecting system metrics. Today we will focus on installing and running CollectD the easy way on Linux Redhat’s CentOS and Fedora.
Install CollectD
Since we will compile CollectD from source, we need a compiler:
1 2 | sudo yum install -y bzip2 wget sudo yum install -y make automake gcc gcc-c++ kernel-devel perl-devel |
Next we download CollectD 5.5.0:
1 2 3 4 | cd /tmp/ wget https://collectd.org/files/collectd-5.5.0.tar.bz2 tar -jxf collectd-5.5.0.tar.bz2 cd collectd-5.5.0 |
The Fedora compiler might yield warnings as errors like these:
error: #warning “_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE” [-Werror=cpp]
If so you will need to disable warnings as errors first before you run ./configure
1 | export CFLAGS="-Wno-error" |
Now compile and install:
1 2 | sudo ./configure sudo make all install |
Start CollectD on Startup
The easy way to manage CollectD on CentOS and Fedora is by using systemd.
1 2 3 | cd /etc/systemd/system/ sudo wget https://raw.githubusercontent.com/martin-magakian/collectd-script/master/collectd.service sudo chmod +x collectd.service |
CollectD will now run at startup, but you can still manage it manually:
1 2 3 4 | systemctl start collectd.service systemctl stop collectd.service systemctl status collectd.service systemctl restart collectd.service |
By default you will find:
- The configuration file at /opt/collectd/etc/collectd.conf
- The collectd binary at /opt/collectd/sbin/collectd
Send Metrics to Database
To use CollectD You need to send its metrics frequently to a database for monitoring:
System and App Monitoring with CollectD
By default CollectD only monitors CPU, memory, interface and load.
You can configure CollectD to monitor much more:
Monitor & detect anomalies with Anomaly.io
SIGN UP