GCP:collectd[1178]: write_gcm: can not take infinite value

4 年 ago jony GCP:collectd[1178]: write_gcm: can not take infinite value已关闭评论

collectd[1178]: write_gcm: can not take infinite value

collectd[1178]: write_gcm: wg_typed_value_create_from_value_t_inline failed for swap/percent/value! Continuing.

导致这个错误的主要原因,是stackdriver-agent 使用的设定档 /etc/stackdriver/collectd.conf 载入了这一段plugin,使用swap 的值进行运算:

LoadPlugin swap
<Plugin "swap">
  ValuesPercentage true
</Plugin>

但Compute Engine 的VM 没有swap,所以会发生divide by 0 的问题,导致遇到错误。

输入 free -m 可以查询VM 的swap 资讯:

$ free -m
              total        used        free      shared  buff/cache   available
Mem:           3697         733        2090          45         873        2698
Swap:             0           0           0

只要把 /etc/stackdriver/collectd.conf 中swap 的部分删除或注解掉即可。

参考资料:GCP Stackdriver Agent: “write_gcm: can not take infinite value” Error