Centos7/Rhel7 – Collectd Config for Libvirt, Carbon-Cache


The following is the collectd config that I am running on my RHEL 7 kvm hypervisor. This is not meant to be an all inclusive config for collectd, rather I am looking to gather basic performance metrics on my hypervisors and VMs.

Note that I have disabled selinux, as I am running these hypervisors in my lab. Do not do the same in your production environments.

#setenforce 0

I also edited /etc/selinux/config as shown below. Again, this is for non-prod/test envs. Do not disable in production

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.

Also note that I have already configured the EPEL repo.. again, not production.

EPEL repo installed via the command below

rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

First a couple of steps to get us up and running. We need to install packages

# yum -y install collectd collectd-virt.x86_64 collectd-rrdtool.x86_64 collectd-sensors.x86_64 collectd-smart.x86_64 collectd-netlink.x86_64 collectd-ipmi.x86_64

We also need to write our config.

You can pull my config using the gist below

#Custom Collectd Config
LoadPlugin "write_graphite"
<Plugin "write_graphite">
<Node "example">
Host ""
Port "2003"
Prefix "collectd."
#Postfix ""
Protocol "tcp"
#Protocol "udp"
#LogSendErrors false
EscapeCharacter "_"
SeparateInstances true
StoreRates false
AlwaysAppendDS false
LoadPlugin cpu
LoadPlugin load
LoadPlugin memory
LoadPlugin processes
LoadPlugin disk
<Plugin "disk">
Disk "sda1"
Disk "sdb1"
Disk "sdc1"
Disk "dm-0"
Disk "dm-2"
Disk "dm-3"
IgnoreSelected true
<LoadPlugin virt>
Globals false
<Plugin "virt">
Connection "qemu:///system"
RefreshInterval 60
Domain "dom0"
BlockDevice "name:device"
InterfaceDevice "name:interface"
IgnoreSelected true
HostnameFormat "name"
LoadPlugin interface
<Plugin interface>
Interface "lo"
IgnoreSelected true
Include "/etc/collectd.d"

view raw
hosted with ❤ by GitHub

We now need to enable and start collectd

#systemctl enable collect
#systemctl start collectd