OpenStack collectd的從零安裝客戶端

CL.TANG發表於2016-10-18

1.檢視是否需要增加yum 源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@node-12 ~]# yum search collectd
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.skyshe.cn
 * extras: mirrors.skyshe.cn
 * updates: mirrors.btte.net
base                                                                                                                                                                               | 3.7 kB     00:00    
extras                                                                                                                                                                             | 3.4 kB     00:00    
nailgun                                                                                                                                                                            | 1.3 kB     00:00    
updates                                                                                                                                                                            | 3.4 kB     00:00    
updates/primary_db                                                                                                                                                                 | 888 kB     00:00    
Warning: No matches found for: collectd
No Matches found
[root@node-12 ~]#

發現沒有我們需要的collectd軟體包。需要增加軟體源epel.

1
2
3
4
5
Retrieving http://mirrors.hustunique.com/epel//6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.IHCvEN: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[root@node-12 ~]# yum search collectd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                                      | 5.7 kB     00:00    
 * base: mirrors.skyshe.cn
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.skyshe.cn
 * updates: mirrors.btte.net
epel                                                                                                                                                                               | 4.1 kB     00:00    
epel/primary_db                                                                                                                                                                    | 6.4 MB     00:06    
========================================================================================= N/S Matched: collectd ==========================================================================================
collectd-apache.x86_64 : Apache plugin for collectd
collectd-dns.x86_64 : DNS traffic analysis module for collectd
collectd-email.x86_64 : Email plugin for collectd
collectd-ipmi.x86_64 : IPMI module for collectd
collectd-mysql.x86_64 : MySQL module for collectd
collectd-nginx.x86_64 : Nginx plugin for collectd
collectd-nut.x86_64 : Network UPS Tools module for collectd
collectd-ping.x86_64 : ping module for collectd
collectd-postgresql.x86_64 : PostgreSQL module for collectd
collectd-rrdtool.x86_64 : RRDTool module for collectd
collectd-sensors.x86_64 : Libsensors module for collectd
collectd-snmp.x86_64 : SNMP module for collectd
collectd-virt.x86_64 : Libvirt plugin for collectd
fedmsg-collectd.noarch : A fedmsg plugin for collectd
perl-Collectd.x86_64 : Perl bindings for collectd
collectd.i686 : Statistics collection daemon for filling RRD files
collectd.x86_64 : Statistics collection daemon for filling RRD files
collectd-web.x86_64 : Contrib web interface to viewing rrd files
python-bucky.noarch : CollectD and StatsD adapter for Graphite
 
  Name and summary matches only, use "search all" for everything.
[root@node-12 ~]#

可以知道已經有了我們需要的軟體包。

安裝collectd軟體包

1
yum install collectd collect-*

這裡可能會有下面的錯誤:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--> Finished Dependency Resolution
Error: Package: collectd-web-4.10.9-1.el6.x86_64 (epel)
           Requires: perl-HTML-Parser
Error: Package: collectd-web-4.10.9-1.el6.x86_64 (epel)
           Requires: perl(HTML::Entities)
Error: Package: collectd-rrdtool-4.10.9-1.el6.x86_64 (epel)
           Requires: rrdtool
Error: Package: collectd-ipmi-4.10.9-1.el6.x86_64 (epel)
           Requires: libOpenIPMIutils.so.0()(64bit)
Error: Package: perl-Collectd-4.10.9-1.el6.x86_64 (epel)
           Requires: perl(RRDs)
Error: Package: collectd-email-4.10.9-1.el6.x86_64 (epel)
           Requires: spamassassin
Error: Package: collectd-snmp-4.10.9-1.el6.x86_64 (epel)
           Requires: net-snmp
Error: Package: collectd-ipmi-4.10.9-1.el6.x86_64 (epel)
           Requires: libOpenIPMIpthread.so.0()(64bit)
Error: Package: collectd-web-4.10.9-1.el6.x86_64 (epel)
           Requires: perl(URI::Escape)
Error: Package: collectd-ipmi-4.10.9-1.el6.x86_64 (epel)
           Requires: libOpenIPMI.so.0()(64bit)
Error: Package: collectd-web-4.10.9-1.el6.x86_64 (epel)
           Requires: perl(RRDs)
Error: Package: collectd-web-4.10.9-1.el6.x86_64 (epel)
           Requires: rrdtool-perl
Error: Package: collectd-web-4.10.9-1.el6.x86_64 (epel)
           Requires: perl(JSON)
Error: Package: collectd-rrdtool-4.10.9-1.el6.x86_64 (epel)
           Requires: librrd_th.so.4()(64bit)
Error: Package: perl-Collectd-4.10.9-1.el6.x86_64 (epel)
           Requires: perl(URI::Escape)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

表示缺少這方面的包,如果沒有該錯誤,請跳過下面的解決辦法。

1
Requires: perl(URI::Escape)

表示perl程式沒有URI::Escape包。 將其他標準版本的Centos的映象裡的/etc/yum.repo.d/Centos-Base.repo到這臺新的計算節點。因為新的計算節點是使用的fuel-web的源,並且國內的163.sohu等源都不好用。 重新執行安裝collectd-*程式正常。

驗證collectd可用

編輯/etc/collectd.conf配置檔案

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#Hostname    "localhost"
FQDNLookup   true
#BaseDir     "/usr/var/lib/collectd"
#PIDFile     "/usr/var/run/collectd.pid"
#PluginDir   "/usr/lib/collectd"
#TypesDB     "/usr/share/collectd/types.db"
#Interval     10
#Timeout      2
#ReadThreads  5
 
LoadPlugin syslog
LoadPlugin cpu
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin libvirt
LoadPlugin network
<Plugin libvirt>
        Connection "qemu:///system"
        RefreshInterval 60
        #Domain "name"
  #BlockDevice "name:device"
  #InterfaceDevice "name:interface"
  #IgnoreSelected false
  HostnameFormat "name"
</Plugin>
<Plugin disk>
#       Disk "/^[hs]d[a-f][0-9]?$/"
#       IgnoreSelected false
</Plugin>
 
#Include "/etc/collectd.d"
 
<Plugin network>
        Server "172.17.46.3" "25826"
#       CacheTimeout 120
#       CacheFlush   900
</Plugin>

啟動服務

1
service collectd start

重新整理:http://172.17.46.3:8084/的服務,可以看到服務可libvirt監控的虛擬機器增加了。

相關文章