Ping status UNKNOWN

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sergo
Posts: 7
Joined: Thu Jun 09, 2016 6:09 am

Ping status UNKNOWN

Post by sergo »

Hi, have installed nagios-4.1.1 and nagios-plugins-2.1.1. And I have problem with plugin 'check_ping'.

Servis state information is:
Current status: UNKNOWN
Status information: /bin/ping -n -U -w 10 -c 5 127.0.0.1
CRITICAL - Could not interpret output from ping command


localhost has status DOWN.

Other services as Current load, HTTP, Root Partition is ok. And file /bin/ping has 777 (-rwxrwxrwx) permissions. I tried to execute

Code: Select all

/bin/ping -n -U -w 10 -c 5 127.0.0.1

and get

Code: Select all

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.041 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.034 ms

--- 127.0.0.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.026/0.033/0.041/0.006 ms
In file commands.cfg check_ping is described as:

Code: Select all

define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
        }

In file localhost.cfg check_ping is described as:

Code: Select all

define service{
        use                            local-service         ; Name of service template to use
        host_name                      localhost
        service_description            PING
        check_command                  check_ping!100.0,20%!500.0,60%
        }
I found the same problem in googl, and everywhere it was solved by changing permissions /bin/ping, but I allready have maximum permissions of this file.
So, can anybody help me and give same advises, what shuld I do :?: :roll:
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Ping status UNKNOWN

Post by tgriep »

It looks like the superuser bit isn't set on the ping command and that could be the cause of the issue.
Login as root to the server and run the following to add the su bit to the ping command.

Code: Select all

chmod u+s /bin/ping
Try that and see if this works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sergo
Posts: 7
Joined: Thu Jun 09, 2016 6:09 am

Re: Ping status UNKNOWN

Post by sergo »

tgriep wrote:It looks like the superuser bit isn't set on the ping command and that could be the cause of the issue.
Login as root to the server and run the following to add the su bit to the ping command.

Code: Select all

chmod u+s /bin/ping
Try that and see if this works for you.
I already tried to do it. But there was no result.
sergo
Posts: 7
Joined: Thu Jun 09, 2016 6:09 am

Re: Ping status UNKNOWN

Post by sergo »

Well, I looked at commands.cfg and localhost.cfg and tried to execute this code as root user:

Code: Select all

./check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
and got this

Code: Select all

PING OK - Packet loss = 0%, RTA = 0.12 mslrta=0.118000ms;100.000000;500.000000;0.000000 pl=0%;20;60;0
It seems to work fine, is not it?

And then I became nagios user

Code: Select all

su nagios
then I did the same, and got this:

Code: Select all

/bin/ping -n -U -w -c 5  127.0.0.1
CRITICAL - Could not interpret output from ping command
Obviously my problem is hidden in permissions, but a dont know where exactly it is.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Ping status UNKNOWN

Post by rkennedy »

Can you post the permissions for us to look at?

Code: Select all

ls -la check_ping
Also, please run strace ./check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 (specifically with strace before it), as the nagios user, and also the root user. This will give us a bit of debug to see where the issue lies. Post the full output after doing so.
Former Nagios Employee
sergo
Posts: 7
Joined: Thu Jun 09, 2016 6:09 am

Re: Ping status UNKNOWN

Post by sergo »

rkennedy wrote:Can you post the permissions for us to look at?

Code: Select all

ls -la check_ping
Also, please run strace ./check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 (specifically with strace before it), as the nagios user, and also the root user. This will give us a bit of debug to see where the issue lies. Post the full output after doing so.
Permissions of the check_ping:

Code: Select all

-rwxrwxrwx  1  nagios  root  72400 Jul 19 10:58  check_ping
About strace... A installed nagios using Buildroot (cross toolchain system) because my machine has a specific architecture. So it is may be difficult or/and take a lot time to install strace in my machine.
Is there another way to find out where the problem is?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Ping status UNKNOWN

Post by tgriep »

Lets change the ownership of the user and group to nagios for that plugin
Login as root to the Nagios server and run the following to do that.
chown nagios.nagios check_ping

Then login to the server as nagios and run the plugin to see if it can be ran by the nagios user.

Code: Select all

su nagios
./check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
Try that and let us know if this works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sergo
Posts: 7
Joined: Thu Jun 09, 2016 6:09 am

Re: Ping status UNKNOWN

Post by sergo »

tgriep wrote:Lets change the ownership of the user and group to nagios for that plugin
Login as root to the Nagios server and run the following to do that.
chown nagios.nagios check_ping

Then login to the server as nagios and run the plugin to see if it can be ran by the nagios user.

Code: Select all

su nagios
./check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
Try that and let us know if this works for you.
Oh, it realy works! Thank you very much!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Ping status UNKNOWN

Post by mcapra »

Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
sergo
Posts: 7
Joined: Thu Jun 09, 2016 6:09 am

Re: Ping status UNKNOWN

Post by sergo »

mcapra wrote:Is it alright if we lock this thread and mark the issue as resolved?
Yes, it is)
Locked