Icinga / docker-icinga2

Official Icinga 2 Docker images
GNU General Public License v2.0
67 stars 30 forks source link

Not able to run check_icmp: Failed to optain ICMP socket #47

Closed mcktr closed 3 years ago

mcktr commented 3 years ago

Hi,

I am facing the following situation on a fresh Icinga 2 docker container (tag: 2.13.3).

sudo docker run -ti -h i2m1 -p 5666:5665 icinga/icinga2:2.12.3 bash

[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Initializing /data as we're the init process (PID 1)
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/data/etc/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Copying "/data-init/etc/icinga2" to "/data/etc/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/data/var/cache/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Copying "/data-init/var/cache/icinga2" to "/data/var/cache/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/data/var/lib/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Copying "/data-init/var/lib/icinga2" to "/data/var/lib/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/data/var/log/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Copying "/data-init/var/log/icinga2" to "/data/var/log/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/data/var/run/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Copying "/data-init/var/run/icinga2" to "/data/var/run/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/data/var/spool/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Copying "/data-init/var/spool/icinga2" to "/data/var/spool/icinga2"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Checking "/var/lib/icinga2/certs/ca.crt"
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Looking up "dumb-init" in $PATH
[2021-01-21 10:42:54 +0000] information/DockerEntrypoint: Running "/usr/bin/dumb-init"      
icinga@i2m1:/$ /usr/lib/nagios/plugins/check_icmp -H 127.0.0.1
check_icmp: Failed to obtain ICMP socket: Operation not permitted

From a quick research this is caused by missing permission for the user. I don't know if other plugins are also affected, but I can tell that check_ping works fine for example.

icinga@i2m1:/$ /usr/lib/nagios/plugins/check_ping -H 127.0.0.1 -w 10,10% -c 20,20%
PING OK - Packet loss = 0%, RTA = 0.06 ms|rta=0.063000ms;10.000000;20.000000;0.000000 pl=0%;10;20;0

Best regards Michael

bodsch commented 3 years ago

maybe this helps: https://github.com/bodsch/docker-icinga2/pull/48