# [SOLVED] nagios/nrpe problem

## kolcon

I have a strange problem with nrpe...

######

on the remote monitored host :

net-analyzer/nagios-nrpe-2.12-r102  USE="command-args ssl"

/etc/nagios/nrpe.cfg:

command[check_home]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /home

running :

/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /home

DISK WARNING - free space: /home 329711 MB (17% inode=-);| /home=1509720MB;1471544;1655487;0;1839431

######

on the "central" host:

# /usr/lib/nagios/plugins/check_nrpe -H ip_of_remote

NRPE v2.12

# /usr/lib/nagios/plugins/check_nrpe -H ip_of-remote -c check_home

NRPE: Unable to read output

Any ideas why? should I open a bug?

Thank you for any ideas...Last edited by kolcon on Wed Dec 09, 2009 8:19 am; edited 1 time in total

----------

## richard.scott

Hi,

My check_disk binary is here:

/usr/nagios/libexec/check_disk

Check the path is correct on your remote host.

Rich.

----------

## kolcon

 *richard.scott wrote:*   

> Hi,
> 
> My check_disk binary is here:
> 
> /usr/nagios/libexec/check_disk
> ...

 

libexec -> /usr/lib/nagios/plugins

it is the same thing....

----------

## richard.scott

Is there anything in the logs on the remote host?

I had something from nrpe in there when I had this problem.

----------

## kolcon

 *richard.scott wrote:*   

> Is there anything in the logs on the remote host?
> 
> I had something from nrpe in there when I had this problem.

 

Not much :

Dec  7 12:58:42 ricbhost nrpe[2867]: Connection from XXX.XXX.XXX.XXX port 47073

Dec  7 12:58:42 ricbhost nrpe[2867]: Host address is in allowed_hosts

Dec  7 12:58:42 ricbhost nrpe[2867]: Handling the connection...

Dec  7 12:58:42 ricbhost nrpe[2867]: Host is asking for command 'check_disk' to be run...

Dec  7 12:58:42 ricbhost nrpe[2867]: Running command: /usr/nagios/libexec/check_disk -w 10 -c 5 -p /

Dec  7 12:58:42 ricbhost nrpe[2867]: Command completed with return code 3 and output: 

Dec  7 12:58:42 ricbhost nrpe[2867]: Return Code: 3, Output: NRPE: Unable to read output

Dec  7 12:58:42 ricbhost nrpe[2867]: Connection from XXX.XXX.XXX.XXX closed.

----------

## richard.scott

 *kolcon wrote:*   

> libexec -> /usr/lib/nagios/plugins
> 
> it is the same thing....

 

Not if its a recent install on Gentoo.

on a recent install of nagios-plugins they all go in /usr/lib/nagios/plugins

I'd double check to make sure.

Rich.

----------

## kolcon

 *richard.scott wrote:*   

>  *kolcon wrote:*   libexec -> /usr/lib/nagios/plugins
> 
> it is the same thing.... 
> 
> Not if its a recent install on Gentoo.
> ...

 

Yes, they are there in /usr/lib/nagios/plugins, the other directory is just a symlink

# emerge -pv nagios-plugins

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] net-analyzer/nagios-plugins-1.4.14  USE="ldap mysql nagios-ping nagios-ssh samba snmp ssl suid -ipv6 -nagios-dns -nagios-game -nagios-ntp -postgres -radius -ups" 0 kB

----------

## richard.scott

 *kolcon wrote:*   

> Yes, they are there in /usr/lib/nagios/plugins, the other directory is just a symlink

 

How did you get the symlink then?

i've just emerge these:

```
 # equery list nagios

[ Searching for package 'nagios' in all categories among: ]

 * installed packages

[I--] [  ] net-analyzer/nagios-nrpe-2.12-r102 (0)

[I--] [  ] net-analyzer/nagios-plugins-1.4.13-r1 (0)
```

and I don't have a /usr/nagios/libexec symlink   :Shocked: 

```
# cd /usr/nagios/libexec

-su: cd: /usr/nagios/libexec: No such file or directory
```

What does this show on your remote system:

```
 # equery files nagios-plugins | grep disk

/usr/lib/nagios/plugins/check_disk
```

Rich

----------

## kolcon

good question about the symlink  :Wink: 

# equery files nagios-plugins | grep disk 

/usr/lib/nagios/plugins/check_disk

/usr/lib/nagios/plugins/check_disk_smb

/usr/lib/nagios/plugins/contrib/check_snmp_disk_monitor.pl

----------

## richard.scott

Perhaps NRPE doesn't like symlinks?

----------

## kolcon

 *richard.scott wrote:*   

> Perhaps NRPE doesn't like symlinks?

 

Can be, however when I change it to:

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

it still behaves the same...

When I run the command directly under root, it prints out DISK OK etc.... I wonder if it

could be permissions problem?

nrpe is running under user nagios, all the plugins are owned by nagios:nagios

----------

## richard.scott

what does this show on the remote host:

```
# cat /etc/nagios/nrpe.cfg | grep "^command"
```

----------

## kolcon

 *richard.scott wrote:*   

> what does this show on the remote host:
> 
> ```
> # cat /etc/nagios/nrpe.cfg | grep "^command"
> ```
> ...

 

# cat /etc/nagios/nrpe.cfg | grep "^command"

command_timeout=60

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10

command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20

command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1

command[check_home]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /home

command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z

command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

----------

## richard.scott

do you have allowed_hosts= set?

----------

## kolcon

 *richard.scott wrote:*   

> do you have allowed_hosts= set?

 

Yes and you can see it in the log I pasted

Dec 7 12:58:42 ricbhost nrpe[2867]: Connection from XXX.XXX.XXX.XXX port 47073

Dec 7 12:58:42 ricbhost nrpe[2867]: Host address is in allowed_hosts

----------

## richard.scott

why does that log extract from earlier show this:

/usr/nagios/libexec/check_disk

and your nrpe.cfg has this:

/usr/lib/nagios/plugins/check_disk

Rich

----------

## kolcon

 *richard.scott wrote:*   

> why does that log extract from earlier show this:
> 
> /usr/nagios/libexec/check_disk
> 
> and your nrpe.cfg has this:
> ...

 

I changed that in the nrpe.cfg based on your hint to possible symlink problem...

now it says

Dec  7 14:15:24 ricbhost nrpe[3107]: Host is asking for command 'check_disk' to be run...

Dec  7 14:15:24 ricbhost nrpe[3107]: Running command: /usr/lib/nagios/plugins/check_disk -w 10 -c 5 -p /

Dec  7 14:15:24 ricbhost nrpe[3107]: Command completed with return code 3 and output: 

Dec  7 14:15:24 ricbhost nrpe[3107]: Return Code: 3, Output: NRPE: Unable to read output

----------

## richard.scott

try this in nrpe.cfg

```
-p "$ARG3$"
```

I think the "" marks helped me?

----------

## kolcon

 *richard.scott wrote:*   

> try this in nrpe.cfg
> 
> ```
> -p "$ARG3$"
> ```
> ...

 

Thanks, good hint, however did not help

Dec  7 14:56:00 ricbhost nrpe[3209]: Host is asking for command 'check_disk' to be run...

Dec  7 14:56:00 ricbhost nrpe[3209]: Running command: /usr/lib/nagios/plugins/check_disk -w 10 -c 5 -p "/"

Dec  7 14:56:00 ricbhost nrpe[3209]: Command completed with return code 3 and output: 

Dec  7 14:56:00 ricbhost nrpe[3209]: Return Code: 3, Output: NRPE: Unable to read output

----------

## richard.scott

ok, what about this:

```
ssh remote_ip /usr/lib/nagios/plugins/check_disk -w 10 -c 5 -p "/"
```

----------

## kolcon

 *richard.scott wrote:*   

> ok, what about this:
> 
> ```
> ssh remote_ip /usr/lib/nagios/plugins/check_disk -w 10 -c 5 -p "/"
> ```
> ...

 

# ssh remote_ip /usr/lib/nagios/plugins/check_disk -w 10 -c 5 -p "/"

DISK OK - free space: / 33309 MB (55% inode=-);| /=26696MB;59996;60001;0;60006

----------

## richard.scott

try and add " 2>&1" to the end of your command definition in nrpe.cfg.

This will echo back stderr, which may tell you what's wrong.

----------

## kolcon

 *richard.scott wrote:*   

> try and add " 2>&1" to the end of your command definition in nrpe.cfg.
> 
> This will echo back stderr, which may tell you what's wrong.

 

Now THAT was a good hint.... as I though, permissions problem on the folder

/var/lib/nagios

It is fixed now...

Thank you again for your support  :Smile: 

----------

## richard.scott

 *kolcon wrote:*   

> Thank you again for your support 

 

No prob, glad its working  :Smile: 

----------

