Table of Contents
Installing collectd/collectd-web is pretty easy (if we dont dive into the deep water). So the whole installation is basically installing several packages + few config modifications.
# Installing Collectd
# Install Centos 7 epel repository
# yum install epel-release.noarch
# Install collectd + rrd support
# yum install collectd collectd-rrdtool
# Uncomment some lines in collectd config file (/etc/collectd.conf)
# vim /etc/collectd.conf
Uncomment the following lines:
Hostname "localhost"
FQDNLookup true
BaseDir "/var/lib/collectd"
PIDFile "/var/run/collectd.pid"
PluginDir "/usr/lib64/collectd"
TypesDB "/usr/share/collectd/types.db"
With this configuration, the RRD files would be stored in the following directory: /var/lib/collectd/localhost/$plugin
, where $plugin would be the name of the plugin, whose data is stored.
# Restart collectd so , the new settings will apply
# systemctl restart collectd
I don’t think that collectd-web is something you should use in production for some huge graphings, but it is pretty handy, to just check whats happening with your collectd stats.
So here is the easiest way to get it running.
# Installing Collectd-Web
First we would need some additional packages:
# Installing packages
# yum install git rrdtool rrdtool-devel rrdtool-perl perl-HTML-Parser perl-JSON
The installation of collectd-web would be inside: /usr/local/collectd-web
# Download and untar collectd-web
# cd /usr/local/ # git clone https://github.com/httpdss/collectd-web.git # chmod +x collectd-web/cgi-bin/graphdefs.cgi
# Customizing port/ip which collectd-web will be listening
By default collectd-web server will listen only on 127.0.0.1 and port 8888.
If you want you to be able to access the server by using some public ip. you should change this inside the python script for the server.
By modifying the file: /usr/local/collectd-web/runserver.py
, you can change these settings.
If you want Collectd-web to listen on all interface, you can do the following
# sed -i -re "s/127.0.0.1/0.0.0.0/g" /usr/local/collectd-web/runserver.py
By changing 0.0.0.0 to some public ip, you could bind the server to just one IP address.
Also inside runserver.py you could change the port, which collectd-web will you to listen to.
# Create collectd-web config
Before we finish, we need to tell collectd-web, where are the rrd files for the hosts/plugins it is going to show graphs about.
So this is done by doing the following:
# mkdir -p /etc/collectd/ # echo 'datadir: "/var/lib/collectd/rrd"' > /etc/collectd/collection.conf
# Restart and running
# Enable and restart collects
# systemctl enable collectd # systemctl start collectd
# Start Collectd-web server
# python /usr/local/collectd-web/runserver.py
You may need to open tcp port 8888 for inbound connections, so you would be able to access your collectd-web instance.
Now you can access your collectd-web server by accesing the following address in your web browser:
http://your_server_ip:8888