[SOLVED] ID: nagios -> ping: socket: Operation not permitted

mailinglists

Renowned Member
Mar 14, 2012
643
70
93
Hi,

i have a PM 5.
I have nagios nrpe agent installed.
I monitor lots of things and it works.
The only thing I can not monitor is reach-ability using ICMP.
Looks like user nagios has no such permissions.
How can this be? I don't want to sudo just to do a simple ping.
Please advise.
Code:
nagios@server1:/etc/nagios$ wget google.com -O /dev/null
--2019-11-08 14:31:39--  http://google.com/
Resolving google.com (google.com)... 2a00:1450:4002:800::200e, 216.58.206.78
Connecting to google.com (google.com)|2a00:1450:4002:800::200e|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2019-11-08 14:31:39--  http://www.google.com/
Resolving www.google.com (www.google.com)... 2a00:1450:4002:807::2004, 216.58.206.36
Connecting to www.google.com (www.google.com)|2a00:1450:4002:807::2004|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘/dev/null’

/dev/null                                              [ <=>                                                                                                          ]  11.82K  --.-KB/s    in 0.009s  

2019-11-08 14:31:39 (1.30 MB/s) - ‘/dev/null’ saved [12105]

nagios@server1:/etc/nagios$ exit
exit
root@server1:/etc/nagios# ping goole.com
PING goole.com (217.160.0.201) 56(84) bytes of data.
64 bytes from goole.com (217.160.0.201): icmp_seq=1 ttl=58 time=19.6 ms
^C
--- goole.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 19.670/19.670/19.670/0.000 ms
root@server1:/etc/nagios# su -s /bin/bash nagios
nagios@server1:/etc/nagios$ ping goole.com
ping: socket: Operation not permitted
nagios@server1:/etc/nagios$
 
hm - try to set cap_net_raw capability on the ping binary (IIRC that was missing in a few older PVE ISOs):
Code:
setcap cap_net_raw+p /bin/ping

hope this helps!
 
  • Like
Reactions: mailinglists
Glad that worked out! please mark the post as 'SOLVED' - it helps others
Thanks!