Page 1 of 1

nrpe check_disk

Posted: Tue Aug 13, 2019 4:38 am
by crechet51
Hello.
I have a ubuntu-server that I want to use as a monitoring server.

I installed nagios and nrpe on it.

Code: Select all

# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15
I need to check the remaining disk space on remote PCs.

Locally, the command looks something like this:

Code: Select all

# /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
DISK OK - free space: / 14223 MB (72.35% inode=94%);| /=5433MB;15738;17705;0;19673
However, on the remote host (with nagios + nrpe installed):

Code: Select all

# ./check_nrpe -H remotehost -t 30 -c check_disk -a '30 10 /'
CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).
Wherein:

Code: Select all

# /usr/local/nagios/libexec/check_nrpe -H remotehost
NRPE v2.15
That is, nrpe on the remote pc responds on server's requests.

I think that the matter is in the disk check command. How exactly does the check_disk call happen? Do I need an alias for this? Or what? :roll:

Thank you in advance.

Re: nrpe check_disk

Posted: Tue Aug 13, 2019 6:42 am
by crechet51
Found a problem.

It turns out that I did not describe the commands in commands.cfg
However, now a second problem has appeared - on the monitoring web page:

Code: Select all

NRPE: Command 'check_disk' not defined

Re: nrpe check_disk

Posted: Tue Aug 13, 2019 10:24 am
by scottwilkerson
Can you show the check_disk command you defined in the nrpe.cfg on the remote server?

Re: nrpe check_disk

Posted: Tue Aug 13, 2019 10:29 am
by mbellerue
Excellent that you got it moved forward! Can you post your command definition, and your service definition? We'll see if there's something in there stopping it from running correctly.

Re: nrpe check_disk

Posted: Thu Aug 15, 2019 2:41 am
by crechet51
Hello scottwilkerson and mbellerue.

Both on the server and on the remote PC, nagios.cfg pulls the commands from commands.cfg

In the commands.cfg check_disk is:

Code: Select all

define command {
    command_name    check_disk
    command_line    /usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /
}
Am I doing something wrong?

Re: nrpe check_disk

Posted: Thu Aug 15, 2019 7:13 am
by scottwilkerson
crechet51 wrote:Both on the server and on the remote PC, nagios.cfg pulls the commands from commands.cfg
that's not how check_nrpe works

When you run

Code: Select all

./check_nrpe -H remotehost -t 30 -c check_disk
the nagios server reaches out to remotehost on port 5666 (the NRPE port) and asks it to execute the command defined in it's nrpe.cfg that starts like

Code: Select all

command[check_disk]=...
If it is not found, you will get an error like

Code: Select all

NRPE: Command 'check_disk' not defined
It will often look something like this

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
you would execute this like

Code: Select all

./check_nrpe -H remotehost -t 30 -c check_disk -a '-w 20% -c 10% -p /'

Re: nrpe check_disk

Posted: Thu Aug 15, 2019 8:29 am
by crechet51
Yes! Thanks guys, you're right.

I just needed to enter the command in nrpe.cfg

Thanks a lot! :D

Re: nrpe check_disk

Posted: Thu Aug 15, 2019 8:53 am
by scottwilkerson
crechet51 wrote:Yes! Thanks guys, you're right.

I just needed to enter the command in nrpe.cfg

Thanks a lot! :D
Glad you got it working!

Locking thread