Install Collectd On Ubuntu Server 13.10

Introduction

Collectd is an open source that use to collect, transfer and store the data information of the machine and network devices.

Server Installation

Install Apache2:

apt-get update
apt-get install apache2

Install other dependencies:

apt-get install perl libconfig-general-perl librrds-perl libregexp-common-perl collectd-core libhtml-parser-perl librrd2-dev libsnmp-dev

Install collectd

apt-get install collectd

Edit main configuration file,

vi /etc/collectd/collectd.conf

with the content:

Hostname "server001"
FQDNLookup true
BaseDir "/var/lib/collectd"
PIDFile "/var/run/collectd.pid"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"
Interval 10
# Monitoring on Services
LoadPlugin cpu
LoadPlugin load
LoadPlugin disk
LoadPlugin memory
LoadPlugin processes
LoadPlugin swap
LoadPlugin users
LoadPlugin interface
LoadPlugin rrdtool
LoadPlugin syslog
# Server
LoadPlugin network
<Plugin network>
Listen "*" "12345"
</Plugin>
<Plugin interface>
Interface "eth0"
</Plugin>
<Target "write">
Plugin "rrdtool"
</Target>
<Plugin syslog>
LogLevel info
</Plugin>
<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"
</Plugin>
Include "/etc/collectd/filters.conf"
Include "/etc/collectd/thresholds.conf"

Restart service collectd.

service collectd restart

Download the latest version of collectd.

cd /tmp
wget http://collectd.org/files/collectd-5.4.1.tar.gz

Extract:

tar -xvf collectd-5.4.1.tar.gz

Go to folder,

cd collectd-5.4.1

Create Graphs:

cp -r /tmp/collectd-5.4.1/contrib/collection3 /var/www/
cp /tmp/collectd-5.4.1/contrib/collection.cgi /usr/lib/cgi-bin/

Change ownership:

chown -R www-data:www-data /var/www/collection3

Create Virtualhost,

vi /etc/apache2/sites-available/collection3.conf
with content:

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName collectd.unixmen.com
ServerAlias www.collectd.unixmen.com
DocumentRoot /var/www
<Directory /usr/lib/cgi-bin/>
Options +ExecCGI
AddHandler cgi-script .cgi
AllowOverride All
</Directory>
AddHandler cgi-script .cgi .pl
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
CustomLog /var/log/apache2/collectd.log combined
ScriptAlias /collection3/bin/ "/var/www/collection3/bin/"
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/collection3
RewriteCond %{REQUEST_URI} !^/collection3/share
RewriteRule !/collection3/bin/(graph|index|json)\.cgi$ /collection3/bin/index.cgi [R=301,L]
</VirtualHost>

Enable site and modules.

a2ensite collection3.conf
a2enmod rewrite
a2enmod cgi

Restart service apache2.

service apache2 restart

If you have the Internal DNS add it and access:

http://collectd.unixmen.com/collection3/

1

Client Installation

Install update:

 apt-get update

Install Collectd:

apt-get install collectd

Edit main configuration file,

vi /etc/collectd/collectd.conf

with content:

Hostname "server002"
FQDNLookup true
BaseDir "/var/lib/collectd"
PIDFile "/var/run/collectd.pid"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"
Interval 10
#Timeout 5
ReadThreads 5
LoadPlugin network
<Plugin network>
Server "collectd.unixmen.com" "12345"
</Plugin>
# Monitoring on Services
LoadPlugin cpu
LoadPlugin load
LoadPlugin disk
LoadPlugin df
LoadPlugin memory
LoadPlugin processes
LoadPlugin swap
LoadPlugin users
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"
</Plugin>
Include "/etc/collectd/filters.conf"
Include "/etc/collectd/thresholds.conf"

Restart service colletcd.

service collectd restart

2

Enjoy, Add other  service or devices info for monitoring.