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

collectd-logo

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.


1
#setenforce 0

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


1
2
3
4
5
6
7
8
9
10
11
# 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.
SELINUX=disabled
# 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.
SELINUXTYPE=targeted

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

EPEL repo installed via the command below


1
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


1
# 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 "10.1.0.202"
Port "2003"
Prefix "collectd."
#Postfix ""
Protocol "tcp"
#Protocol "udp"
#LogSendErrors false
EscapeCharacter "_"
SeparateInstances true
StoreRates false
AlwaysAppendDS false
</Node>
</Plugin>
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
</Plugin>
<LoadPlugin virt>
Globals false
</LoadPlugin>
<Plugin "virt">
Connection "qemu:///system"
RefreshInterval 60
Domain "dom0"
BlockDevice "name:device"
InterfaceDevice "name:interface"
IgnoreSelected true
HostnameFormat "name"
</Plugin>
LoadPlugin interface
<Plugin interface>
Interface "lo"
IgnoreSelected true
</Plugin>
Include "/etc/collectd.d"

view raw
collectd.conf
hosted with ❤ by GitHub

We now need to enable and start collectd


1
2
#systemctl enable collect
#systemctl start collectd 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.