在过去的几个小时里,我一直为此绞尽脑汁,所以只好在这里向你们请教。
我有一个 collectd 实例,它被设置为获取 statsd 指标并使用network
插件将它们路由到主 collectd 实例,然后通过write_graphite
插件将它们发送到 influxdb。
将指标发送到statsd
插件有效(我已经检查过tcpdump
并使用该csv
插件作为调试工具)。
network
当插件将收集到的指标发送到“主”collectd 实例时,就会出现问题。该network
插件似乎每 100 秒或重新启动时才发送一次数据(我猜它在停止时会刷新缓冲区)。
以下是客户端机器的配置:
/etc/collectd/collectd.conf
Hostname "collectd.client"
FQDNLookup false
BaseDir "/var/lib/collectd"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"
AutoLoadPlugin false
Interval 10
LoadPlugin logfile
<Plugin logfile>
LogLevel "info"
File "/var/log/collectd.log"
Timestamp true
PrintSeverity true
</Plugin>
<Include "/etc/collectd/conf.d">
Filter "*.conf"
</Include>
/etc/collectd/conf.d/network.conf
LoadPlugin network
<Plugin "network">
<Server "main-instance-ip" "25826">
SecurityLevel "Encrypt"
Username "collectd"
Password "xxxxxxxx"
</Server>
</Plugin>
/etc/collectd/conf.d/collectd.statsd.conf
LoadPlugin statsd
<Plugin statsd>
Host "0.0.0.0"
Port "8125"
</Plugin>
tcpdump
运行一段时间后的输出如下:
$ sudo tcpdump -i any udp port 25826
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
04:49:52.889504 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1337
04:51:52.889498 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1373
04:53:52.889469 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1363
04:55:42.889507 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1375
04:57:42.889504 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1368
04:59:52.889519 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1366
05:01:52.889511 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1363
05:03:42.889507 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1375
05:05:42.889485 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1363
05:07:32.889497 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1375
05:09:32.889477 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1363
05:11:22.889528 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1375
05:13:32.889503 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1395
05:15:42.889484 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1366
05:17:42.889493 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1373
05:19:42.889552 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1368
05:21:52.889502 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1361
05:23:42.889500 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1375
05:25:42.889491 IP ip-10-xxx-xx7-60.ec2.internal.43536 > ip-10-xxx-xx-7.ec2.internal.25826: UDP, length 1363
从输出来看,它现在已决定每隔约 2 分钟运行一次。
答案1
您收集了多少个值?
据我所知,network
插件在缓冲区已满时会发送数据。尝试使用MaxPacketSize 1024
指令,或收集更多数据。