While testing GWMCE 5.2 I noticed that all Nagios checks using check_fping were not working, turned out that it couldn't find the fping executable:
[
root@magma2 ~]# /usr/local/groundwork/nagios/libexec/check_fping -H 80.248.41.134 -w 500.0,20% -c 10000.0,90% -n 3 -v
/usr/local/groundwork/sbin -b 56 -c 3 80.248.41.134
FPING UNKNOWN - 80.248.41.134
I fixed it by recompiling check_fping from the upstream nagios-plugins-1.4.10 tarball:
[
root@magma2 nagios-plugins-1.4.10]# ./plugins/check_fping -H 80.248.41.134 -w 500.0,20% -c 10000.0,90% -n 3 -v
/usr/local/groundwork/sbin/fping -b 56 -c 3 80.248.41.134
80.248.41.134 : [0], 84 bytes, 18.6 ms (18.6 avg, 0% loss)
80.248.41.134 : [1], 84 bytes, 18.5 ms (18.6 avg, 0% loss)
80.248.41.134 : [2], 84 bytes, 18.0 ms (18.4 avg, 0% loss)
80.248.41.134 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 18.0/18.4/18.6
FPING OK - 80.248.41.134 (loss=0%, rta=18.400000 ms)|loss=0%;20;90;0;100 rta=0.018400s;0.500000;10.000000;0.000000
The nagios plugins were configured with:
./configure --prefix=/usr/local/groundwork/nagios --with-nagios-user=nagios --with-nagios-grp=nagios --with-fping-command=/usr/local/groundwork/sbin/fping
-bash-3.1$ id
uid=100(nagios) gid=1985(nagios) groups=1985(nagios)
-bash-3.1$ ./check-host.pl | less
Checking amf-ricoh (195.18.117.16)
Exec: /usr/local/groundwork/nagios/libexec/check_fping -H 195.18.117.16 -w 500.0,20% -c 10000.0,90% -n 3 -v
/usr/local/groundwork/sbin/fping -b 56 -c 3 195.18.117.16
This program can only be run by root, or it must be setuid root.
FPING WARNING - 195.18.117.16
So we have to make fping setuid root, and after this change the nagios user can successfully run the check_fping Nagios check command and the fping binary it depends on:
-bash-3.1$ ls -l /usr/local/groundwork/sbin/fping
-rwsr-sr-x 1 root root 28301 Mar 19 00:13 /usr/local/groundwork/sbin/fping
-bash-3.1$ ./check-host.pl | less
Checking amf-ricoh (195.18.117.16)
Exec: /usr/local/groundwork/nagios/libexec/check_fping -H 195.18.117.16 -w 500.0,20% -c 10000.0,90% -n 3 -v
/usr/local/groundwork/sbin/fping -b 56 -c 3 195.18.117.16
195.18.117.16 : [0], 84 bytes, 9.31 ms (9.31 avg, 0% loss)
195.18.117.16 : [1], 84 bytes, 7.86 ms (8.58 avg, 0% loss)
195.18.117.16 : [2], 84 bytes, 8.05 ms (8.40 avg, 0% loss)
195.18.117.16 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 7.86/8.40/9.31
FPING OK - 195.18.117.16 (loss=0%, rta=8.400000 ms)|loss=0%;20;90;0;100 rta=0.008400s;0.500000;10.000000;0.000000