Enabling (Almost All) Collectd Plugins on CentOS 6
Enabling (Almost All) Collectd Plugins on CentOS 6
一号男嘉宾 发表于1年前
Enabling (Almost All) Collectd Plugins on CentOS 6
  • 发表于 1年前
  • 阅读 46
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

Introduction

There are a variety of ways to extract system resource information from a Linux server. Some of these utilities are triggered by cron, such as sysstat, while others are based on a predefined check interval, such as Nagios. Others are meant to be used interactively, such as htop or vmstat.

collectd is another utility that gathers system metrics on a given system. It is written in C, giving it great performance. Its versatility, however, comes from the almost 100 plugins that is bundled with the daemon. These plugins include various read and write plugins. Some of the read plugins collect the standard Linux subsystem metrics, such as CPU, Disk, Memory and Network, while other read plugins are more specialized, such as reading Apache httpd or DNS metrics.

collectd gathers these metrics, but where are they stored? collectd has a handful of write plugins that allow you either store the metrics in local round-robin databases (RRDs) or externally to another collector, such as Graphite.

The collectd package in the EPEL 6 repository package is out of date. Often, users opt to compile collectd from source to obtain a newer, more recent version. The process of compiling collectd can be somewhat daunting at times because the more plugins that are available, the more dependencies are necessary.

The goal of this guide is to list the necessary packages for building collectd from source with most of the plugins enabled. These dependencies can all be found in the CentOS Base and EPEL repositories.

 

Prerequisites

Compiling any package from source requires a compiler. If you don't already have one installed, go ahead and install the GNU GCC compiler:

sudo yum install gcc

For this exercise, you will also need kernel and the C library header files:

sudo yum install kernel-headers glibc-headers

 

Downloading collectd

A link to the collectd source is hosted on the main page of the collectd website. Download and untar the the latest source tarball. At the time of this writing, version 5.5.0 is the latest stable version.

curl --progress https://collectd.org/files/collectd-5.5.0.tar.gz | tar xz

 

Configuring collectd

After downloading and extracting the source files, change to that directory:

cd collectd-5.5.0

This package can be configured, built and installed with the typical configure && make && make install sequence of commands.

Start by running the configure step so that we can have a look at the available plugins:

./configure

This command will output quite a bit to the screen, checking your system for the presence of various libraries, header files and binaries in the process. Have a look at the summary at the end, for example:

Configuration:
  Libraries:
    intel mic . . . . . . no (MicAccessApi not found)
    libaquaero5 . . . . . no (libaquaero5.h not found)
    libatasmart . . . . . no (atasmart.h not found)
    libcurl . . . . . . . no (curl-config failed)
    libdbi  . . . . . . . no (dbi/dbi.h not found)
    libesmtp  . . . . . . no (libesmtp not found)
    libganglia  . . . . . no (gm_protocol.h not found)
[...output truncated...]
  Modules:
    aggregation . . . . . yes
    amqp    . . . . . . . no
    apache  . . . . . . . no
    apcups  . . . . . . . yes
    apple_sensors . . . . no
    aquaero . . . . . . . no
    ascent  . . . . . . . no
    barometer . . . . . . no
[...output truncated...]

The summary at the end shows the various plugins and whether or not the configure step was able to locate the necessary prerequisites to build each plugin.

Even though the configure step was not able to find many libraries or modules, collectd will still compile successfully, albeit without these plugins. Often, you would like to enable several plugins at compile time, for example:

./configure --enable-java --enable-python

Without the appropriate package dependencies installed, the configure step will output the following line at the very end:

configure: error: "Some plugins are missing dependencies - see the summary
above for details"

Use the two tables below to install the appropriate RPM packages for the plugins you would like to enable.

 

Libaries

The following table shows the collectd libraries and their corresponding RPM package dependencies:

Library RPM Package(s)
libatasmart libatasmart-devel
libcurl libcurl-devel
libdbi libdbi-devel
libesmtp libesmtp-devel
libganglia ganglia-devel
libgcrypt libgcrypt-devel
libhal hal-devel
libhiredis hiredis-devel
libiptc iptables-devel
libjvm java-1.8.0-openjdk-devel
libldap openldap-devel
liblvm2app lvm2-devel
libmemcached libmemcached-devel
libmnl libmnl-devel
libmodbus libmodbus-devel
libmysql mysql-devel
libnetsnmp net-snmp-devel
libnotify libnotify-devel
libopenipmi OpenIPMI-devel
liboping liboping-devel
libpcap libpcap-devel
libperl perl-devel, perl-ExtUtils-Embed
libpq postgresql-devel
librabbitmq librabbitmq-devel
librrd rrdtool-devel
libsensors lm_sensors-devel
libstatgrab libstatgrab-devel
libudev libudev-devel
libupsclient nut-devel
libvarnish varnish-libs-devel
libvirt libvirt-devel
libxml2 libxml2-devel
libyajl yajl-devel
protobuf-c protobuf-c-devel
python python-devel

 

Modules

The following table shows the collectd modules and their corresponding RPM package dependencies:

Module RPM Package(s)
amqp librabbitmq-devel
apache libcurl-devel
bind libcurl-devel, libxml2-devel
ceph yajl-devel
curl libcurl-devel
curl_json libcurl-devel, yajl-devel
curl_xml libcurl-devel, libxml2-devel
dbi libdbi-devel
dns libpcap-devel
gmond ganglia-devel
ipmi OpenIPMI-devel
iptables iptables-devel
java java-1.8.0-openjdk-devel
log_logstash yajl-devel
lvm lvm2-devel
memcachec libmemcached-devel
mysql mysql-devel
netlink libmnl-devel
nginx libcurl-devel
notify_desktop libnotify-devel
notify_email libesmtp-devel
nut nut-devel
openldap openldap-devel
perl perl-devel, perl-ExtUtils-Embed
ping liboping-devel
postgresql postgresql-devel
python python-devel
redis hiredis-devel
rrdtool rrdtool-devel
smart libatasmart-devel, libudev-devel
snmp net-snmp-devel
varnish varnish-libs-devel
virt libvirt-devel, libxml2-devel
write_http libcurl-devel
write_redis hiredis-devel

 

Notes

Not all plugin dependencies were available from the CentOS Base and EPEL repositories. For these particular plugins, you would either have to:

  • configure another YUM repository that has the necessary RPMs
  • download and install the individual RPM from a third-party site
  • build your own RPM
  • compile the dependency from source

With regards to the java plugin, the 1.6.0 and 1.7.0 openjdk versions, in addition to the 1.8.0 version listed above, are able to satisfy the java dependency.

 

Conclusion

Once the plugin dependencies are sorted out, the make and make install steps typically go without a hitch. In a future post, I will outline how to build the collectd RPMs using the latest available version.

共有 人打赏支持
粉丝 131
博文 27
码字总数 40512
×
一号男嘉宾
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: