udp proxy - 192.168.48.112
cat > /etc/collectd_25801.conf << EOF
Hostname "kvm-48-112"
ReadThreads 5
WriteThreads 5
LoadPlugin network
LoadPlugin rrdcached
LoadPlugin unixsock
<Plugin network>
Listen "127.0.0.1" "25801"
Forward true
</Plugin>
<Plugin rrdcached>
DaemonAddress "unix:/tmp/rrdcached.sock"
DataDir "/opt/rrd"
CreateFiles true
CreateFilesAsync true
CollectStatistics true
</Plugin>
<Plugin unixsock>
SocketFile "/var/run/collectd.sock"
SocketGroup "root"
SocketPerms "0644"
DeleteSocket false
</Plugin>
EOF
cat > /etc/collectd_25802.conf << EOF
Hostname "kvm-48-112"
ReadThreads 5
WriteThreads 5
LoadPlugin network
LoadPlugin rrdcached
LoadPlugin unixsock
<Plugin network>
Listen "127.0.0.1" "25802"
Forward true
</Plugin>
<Plugin rrdcached>
DaemonAddress "unix:/tmp/rrdcached.sock"
DataDir "/opt/rrd"
CreateFiles true
CreateFilesAsync true
CollectStatistics true
</Plugin>
<Plugin unixsock>
SocketFile "/var/run/collectd.sock"
SocketGroup "root"
SocketPerms "0644"
DeleteSocket false
</Plugin>
EOF
collectd -C /etc/collectd_25801.conf -P /var/run/collectd_25801.pid
collectd -C /etc/collectd_25802.conf -P /var/run/collectd_25802.pid
#nginx.conf
stream {
upstream collectd {
#hash $remote_addr;
least_conn;
server 127.0.0.1:25801;
server 127.0.0.1:25802;
}
server {
listen 25826 udp;
proxy_pass collectd;
#proxy_responses 1;
proxy_timeout 1s;
#error_log /var/log/nginx/error.log info;
}
}
collectd proxy - 192.168.48.113
cat > /etc/collectd.conf << EOF
Hostname "kvm-48-113"
ReadThreads 10
WriteThreads 5
LoadPlugin aggregation
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin tcpconns
<Plugin aggregation>
<Aggregation>
Plugin "cpu"
Type "cpu"
SetPlugin "cpu"
SetPluginInstance "all"
GroupBy "Host"
GroupBy "TypeInstance"
CalculateAverage true
</Aggregation>
</Plugin>
<Plugin df>
FSType rootfs
FSType ext3
FSType ext4
FSType xfs
IgnoreSelected false
</Plugin>
<Plugin disk>
Disk "/^[hsv]d[a-z]+$/"
IgnoreSelected false
</Plugin>
<Plugin load>
ReportRelative true
</Plugin>
<Plugin memory>
ValuesAbsolute true
ValuesPercentage false
</Plugin>
<Plugin network>
Listen "192.168.48.113" "25826"
Server "192.168.48.112" "25826"
Forward true
</Plugin>
<Plugin "interface">
Interface "lo"
Interface "sit0"
IgnoreSelected true
</Plugin>
<Plugin "tcpconns">
ListeningPorts false
AllPortsSummary true
</Plugin>
Include "/etc/collectd.d"
EOF
host - 192.168.48.114
cat > /etc/collectd.conf << EOF
Hostname "kvm-48-114"
ReadThreads 10
WriteThreads 5
LoadPlugin aggregation
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin tcpconns
<Plugin aggregation>
<Aggregation>
Plugin cpu
Type cpu
SetPlugin cpu
SetPluginInstance all
GroupBy Host
GroupBy TypeInstance
CalculateAverage true
</Aggregation>
</Plugin>
<Plugin df>
FSType rootfs
FSType ext3
FSType ext4
FSType xfs
IgnoreSelected false
</Plugin>
<Plugin disk>
Disk "/^[hsv]d[a-z]+$/"
IgnoreSelected false
</Plugin>
<Plugin load>
ReportRelative true
</Plugin>
<Plugin memory>
ValuesAbsolute true
ValuesPercentage false
</Plugin>
<Plugin network>
Server "192.168.48.113" "25826"
</Plugin>
<Plugin interface>
Interface lo
Interface sit0
IgnoreSelected true
</Plugin>
<Plugin tcpconns>
ListeningPorts false
AllPortsSummary true
</Plugin>
Include "/etc/collectd.d"
EOF