collectd安装与部署

时间:2022-09-16 21:52:49

1、安装与启动collectd命令:sudoapt-get install collectd

  sudo /etc/init.d/collectd start(这样,就启动了collectddeamon程序)

2、部署 collectd

两台ubuntu虚拟机,一台为server,一台client。server IP:202.194.68.152,拟接收数据端口25827.
server安装,版本为collectd 4.10.1
命令:apt-get install collectd 

/etc/collectd/collectd.conf配置(主要加入network plugin和rrdtool plugin):
LoadPlugin syslog

<Plugin syslog>
LogLevel info
</Plugin>

LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin rrdtool

<Plugin network>
# # client setup:
# Server "ff18::efc0:4a42" "25826"
# <Server "239.192.74.66" "25826">
# SecurityLevel Encrypt
# Username "user"
# Password "secret"
# Interface "eth0"
# </Server>
# TimeToLive "128"
#
# # server setup:
Listen "202.194.68.152" "25827"
# <Listen "202.194.68.152" "25827">
# SecurityLevel Sign
# AuthFile "/etc/collectd/passwd"
# Interface "eth0"
# </Listen>

# MaxPacketSize 1024
#
# # proxy setup (client and server as above):
# Forward true
#
# # statistics about the network plugin itself
# ReportStats false
#
# # "garbage collection"
# CacheFlush 1800
</Plugin>

<Plugin rrdtool>
DataDir "/var/lib/collectd/rrd"

#CacheTimeout 120
#CacheFlush 900
#WritesPerSecond 30
#RandomTimeout 0
#
# The following settings are rather advanced
# and should usually not be touched:
#StepSize 10
#HeartBeat 20
#RRARows 1200
#RRATimespan 158112000
#XFF 0.1
</Plugin>

配置好保存启动:/etc/init.d/collectd start


client端配置:
安装:apt-get install collectd
同样在/etc/collectd/collectd.conf下配置:
不同的是在network插件里,配置

<Plugin network>
## client setup:

#Server "202.194.68.152" "25827"
#<Server "202.194.68.152" "25827">

#SecurityLevel Encrypt
#Username "user"
#Password "secret"
#Interface "eth0"
#</Server>
#TimeToLive "128"
#
## server setup:
#Listen "ff18::efc0:4a42" "25826"
#<Listen "239.192.74.66" "25826">
#SecurityLevel Sign
#AuthFile "/etc/collectd/passwd"
#Interface "eth0"
#</Listen>
#MaxPacketSize 1024
#
## proxy setup (client and server as above):
#Forward true
#
## statistics about the network plugin itself
#ReportStats false
#
## "garbage collection"
#CacheFlush 1800
</Plugin>
配置好后重启,/etc/init.d/collectd start

在server端,用rrdtool查看数据。collectd安装与部署