顯示具有 collectd 標籤的文章。 顯示所有文章
顯示具有 collectd 標籤的文章。 顯示所有文章

2015年2月8日 星期日

Collcted Plugin Development and Compiling (AREAWELL AW-2111A Plugin)

下載 collectd 原始碼
$ wget https://github.com/collectd/collectd/archive/collectd-5.4.1.tar.gz
$ tar zxf collectd-5.4.1.tar.gz

下載 Collectd AREAWELL AW-2111A plugin
$ git clone https://github.com/a0726h77/cloudPower-collectd-plugin.git

將 AW-2111A plugin 複製到 Collectd 原始碼資料夾
$ cp -r cloudPower-collectd-plugin/* collectd-collectd-5.4.1/src/

修改編譯設定,加入 plugin
$ cd collectd-collectd-5.4.1/
$ vi configure.ac
....
AC_PLUGIN([cloudpower], [yes], [cloudpower statistics])
....
$ vi src/Makefile.am
....
if BUILD_PLUGIN_CLOUDPOWER
pkglib_LTLIBRARIES += cloudpower.la
cloudpower_la_SOURCES = cloudpower.c
cloudpower_la_LDFLAGS = -module -avoid-version
cloudpower_la_LIBADD = -L. -lcloudPowerManagerTool
collectd_LDADD += "-dlopen" cloudpower.la
collectd_DEPENDENCIES += cloudpower.la
endif
....
$ vi src/types.db
....
electric        value:GAUGE:U:U
....

* Makefile.am 裏需指定模組對 libcloudPowerManagerTool.a 使用靜態連結

安裝相依套件
# apt-get install build-essential automake bison flex autoconf pkg-config libtool libgcrypt20-dev libltdl-dev libglib2.0-dev lib32z1-dev gcc-4.9-multilib

編譯 & 安裝
$ ./build.sh
$ ./configure CFLAGS="-m32" --prefix=/opt/collectd
CFLAGS="-m32"  編譯 collectd 成 32 位元執行檔,因爲官方給的
libcloudPowerManagerTool.a 只有 32 位元版本
--prefix  指定安裝路徑
$ make
# make all install

載入模組
# vi /opt/etc/collectd.conf
....
LoadPlugin cloudpower
....
<Plugin cloudpower>
        <Node "1F">
                Host "192.168.x.x"
        </Node>
</Plugin>
....

執行
# /opt/collectd-5.4.1/sbin/collectd -C /opt/collectd-5.4.1/etc/collectd.conf -f




References :
First steps - collectd Wiki
Plugin architecture - collectd Wiki
AREAWELL NETWORKS

Compile Collectd plugin with static link library

* 可參考 iptables plugin 的設定


$ cp libfact.a src/
$ vi src/Makefile.am
if BUILD_PLUGIN_MYPLUGIN
....
myplugin_la_LIBADD = -L. -lfact
....
endif
$ make




References :
Plugin:IPTables - collectd Wiki

Compile 32 bit Collectd on 64 bit system


$ ./build.sh
$ ./configure CFLAGS="-m32"
$ make

plugin_dispatch_values: Dataset not found check your types.db!

add your custome plugin type define to TypesDB

# vi /usr/share/collectd/types.db




References :
Question on apple_sensors plugin - Monitoring Collectd
[collectd] Thought about exec and types.db
types.db(5) – collectd – The system statistics collection daemon

2015年2月7日 星期六

Compile Collectd from source

$ git clone https://github.com/collectd/collectd.git
$ cd collectd
$ ./build.sh
$ ./configure
$ make
# make all install 


Error :
$ ./build.sh
WARNING: `lex' not found!
Please make sure that `lex' is installed and is in one of the
directories listed in the PATH environment variable.
WARNING: `yacc' not found!
Please make sure that `yacc' is installed and is in one of the
directories listed in the PATH environment variable.
Solution :
# apt-get install byacc flex
# apt-get install bison


Error :
$ ./build.sh
configure.ac:1909: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
Solution :
# apt-get install libgcrypt20-dev





References :

Development Information – collectd – The system statistics collection daemon
First steps - collectd Wiki

how to install Lex and Yacc in Ubuntu? - Stack Overflow 
[collectd] Compile git clone
使用collectd与visage收集kvm虚拟机性能实时图形 - - 博客频道 - CSDN.NET

2015年1月16日 星期五

Collectd Installation

Install : 
# apt-get install collectd

Configuration :
# vi /etc/collectd/collectd.conf
Hostname "XXX"
BaseDir "/var/lib/collectd"
PIDFile "/var/run/collectd.pid"
PluginDir "/usr/local/lib/collectd"
TypesDB "/usr/local/share/collectd/types.db"
Interval 10
# 停用 rrdtool
# LoadPlugin rrdtool

# 啓用輸出到 graphite

LoadPlugin write_graphite





Host "localhost"
Port "2003"
Protocol "tcp"
LogSendErrors true
Prefix "collectd."
StoreRates true
AlwaysAppendDS false
EscapeCharacter "_"
# /etc/init.d/collectd restart



References :
How To Configure Collectd to Gather System Metrics for Graphite on Ubuntu 14.04 | DigitalOcean