目录

监控 | collectd | 代理 |验证

准备环境

yum install rrdtool

514  yum install rrdtool-devel.x86_64
515  yum install rrdtool
517  make ;make install
551  yum install libgcrypt-devel -y

监控机器配置(机器可能有很多)

Hostname    "192.168.16.140"
FQDNLookup   true
WriteThreads  5
LoadPlugin logfile
<Plugin logfile>
        LogLevel info
        File "/opt/collectd/collectd.log"
        Timestamp true
</Plugin>
LoadPlugin cpu
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin rrdtool
<Plugin network>
<Server "192.168.16.143">
    SecurityLevel "Sign"
    Username "fang"
    Password "123"
  </Server>
</Plugin>
Include "/etc/collectd.d"
<Plugin rrdtool>
	DataDir "/opt/collectd/rrd"
</Plugin>

中转代理机器配置(机器较少,减轻结果展示机器的负载)

Hostname    "192.168.16.143"
FQDNLookup   true
WriteThreads  5
LoadPlugin logfile
<Plugin logfile>
        LogLevel info
        File "/opt/collectd/collectd.log"
        Timestamp true
</Plugin>
LoadPlugin cpu
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin rrdtool
<Plugin network>
<Listen "192.168.16.143">  #监听本机
            SecurityLevel "Sign"
            AuthFile "/opt/collectd/auth_file"
            
#[root@localhost ~]# cat /opt/collectd/auth_file 
#fang: 123  格式非常简单 账号: 密码

</Listen>
<Server "192.168.16.142"> #所有请求发送到服务器
    SecurityLevel "Sign"
    Username "fang"
    Password "123"
</Server>
Forward true   #开启代理,别人发给我的数据我一律转发到192.168.16.142主机
</Plugin>
Include "/etc/collectd.d"
<Plugin rrdtool>
	DataDir "/opt/collectd/rrd"  #rrd文件的存放目录
</Plugin>

结果展示机器(机器最少)

FQDNLookup   true
WriteThreads  5
LoadPlugin logfile
<Plugin logfile>
	LogLevel info
	File "/opt/collectd/collectd.log"
	Timestamp true
</Plugin>
LoadPlugin network
LoadPlugin rrdtool
<Plugin network>
	<Listen "192.168.16.142">
	    SecurityLevel "Sign"
	    AuthFile "/opt/collectd/auth_file"
	</Listen>
</Plugin>
Include "/etc/collectd.d"
<Plugin rrdtool>
	DataDir "/opt/collectd/rrd"
</Plugin>