文档章节

Enabling (Almost All) Collectd Plugins on CentOS 6

一号男嘉宾
 一号男嘉宾
发布于 2016/10/08 13:52
字数 927
阅读 57
收藏 0

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.

© 著作权归作者所有

共有 人打赏支持
一号男嘉宾
粉丝 133
博文 28
码字总数 40512
作品 0
成都
物理机性能监控―基于collectd插件编写

  【IT168 技术】目前在做一个对物理机的性能指标监控的项目。在业内实现方式主要有如下两种方案:   1、在物理机中部署agent程序,实现对数据指标的采集。此方案在采集数据和容错处理上...

it168网站
2016/11/01
0
0
聊聊 Statsd 和 Collectd 那点事!

StatsD 是由 Etsy 开发并发布的汇总和总结应用指标的一个简单的守护进程,近些年来发展迅速,已经变成了一个用于收集应用性能指标的统一的协议。 关于 Statsd 的使用已经有很多文章介绍过,所...

OneAPM蓝海讯通
2015/12/10
266
0
collectd 5.6.0 发布,系统监控和统计工具

collectd 5.6.0 发布了,主要更新如下: Build system: An option to to avoid building the DF plugin against XFS has been added. Thanks to Ruben Kerkhof. #1878 Build system: Autoco......

局长
2016/09/12
1K
2
collectd 5.7.2 发布,系统监控和统计工具

collectd 5.7.2 发布了,collectd 是一个守护(daemon)进程,用来收集系统性能和提供各种存储方式来存储不同值的机制。比如以 RRD 文件形式。当系统运行和存储信息的时候,Collectd 会周期性统...

达尔文
2017/06/07
588
0
collectd 5.5.3 发布,系统监控和统计工具

collectd 5.5.3 发布了,这将是十二月份 5.7 发布之前 5.5.x的最后一个修正版。 主要更新如下: collectd: Write threads are stopped before shutdown callbacks are called. Thanks to Fl...

两味真火
2016/11/29
1K
1

没有更多内容

加载失败,请刷新页面

加载更多

下一页

7 个致命的 Linux 命令

导读 如果你是一个 Linux 新手,在好奇心的驱使下,可能会去尝试从各个渠道获得的命令。以下是 7 个致命的 Linux 命令,轻则使你的数据造成丢失,重则使你的系统造成瘫痪,所以,你应当竭力避...

问题终结者
今天
0
0
设计模式:工厂方法模式(工厂模式)

工厂方法模式才是真正的工厂模式,前面讲到的静态工厂模式实际上不能说是一种真正意义上的设计模式,只是一种变成习惯。 工厂方法的类图: 这里面涉及到四个种类: 1、抽象产品: Product 2、...

京一
今天
0
0
区块链和数据库,技术到底有何区别?

关于数据库和区块链,总会有很多的困惑。区块链其实是一种数据库,因为他是数字账本,并且在区块的数据结构上存储信息。数据库中存储信息的结构被称为表格。但是,区块链是数据库,数据库可不...

HiBlock
今天
0
0
react native 开发碰到的问题

react-navigation v2 问题 问题: static navigationOptions = ({navigation, navigationOptions}) => ({ headerTitle: ( <Text style={{color:"#fff"}}>我的</Text> ), headerRight: ( <View......

罗培海
今天
0
0
Mac Docker安装流程

久仰Docker大名已久,于是今天趁着有空,尝试了一下Docker 先是从docker的官网上下载下来mac版本的docker安装包,安装很简易,就直接拖图标就好了。 https://www.docker.com/products/docker...

writeademo
今天
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部