elastic / beats-docker

Official Beats Docker images
166 stars 55 forks source link

Heartbeat requires network capabilities for ICMP #2

Closed kvalev closed 7 years ago

kvalev commented 7 years ago

Starting an ICMP monitor when running the heartbeat docker image results in the following error:

2017/02/24 02:53:36.459997 loop.go:330: INFO IPv4 ICMP not supported: listen ip4:icmp : socket: operation not permitted 2017/02/24 02:53:36.460013 loop.go:330: INFO IPv6 ICMP not supported: listen ip6:ipv6-icmp : socket: operation not permitted 2017/02/24 02:53:36.460129 manager.go:125: ERR failed to load monitor tasks: failed to initiate IPv4 support when initializing monitor icmp(0)

This can be fixed by setting the network capabilities not only for packetbeat, but also for heartbeat.

As a workaround, the following custom docker image can be used:

FROM docker.elastic.co/beats/heartbeat:5.2.1
USER root
RUN setcap cap_net_raw,cap_net_admin=eip /usr/share/heartbeat/heartbeat
USER heartbeat
jarpy commented 7 years ago

Thanks for the high-quality report!

This is fixed in 022eef2 and a new image has been pushed for docker.elastic.co/beats/heartbeat:5.2.1.

kvalev commented 7 years ago

Thanks for the quick fix. I would suggest to also update the README by giving a short explanation/example (similar to the Packetbeat one) on how to configure Heartbeat.

jarpy commented 7 years ago

Good idea, thanks. The README will be replaced with formal documentation soon, but it's a great place to capture things that need to make it into the docs.