Page 1 of 2

NRPE: Command 'check_disk' not defined

Posted: Wed Apr 19, 2017 4:34 am
by dambaru
Hi Support,

i have recently installed NagiosXI server product in rhel-7 machine and not able to check the diskspace for remote nagios client machine . in Base installation of server NRPE version was NRPE v2.15 and with this NRPE version i was getting below error from server side then i have been suggested to upgrade the NRPE in server to NRPE v3.0.1 which is having same version as client machine , assuming below error will be resolved but not resolved . Pls suggest the way to fix the issue .

I am getting "NRPE: Command 'check_disk' not defined"

below are the steps used in nagiosxi server end to upgrade the NRPE component.

./configure --enable-command-args
make install
make install-config
make install-init
systemctl enable nrpe.service
firewall-cmd --zone=public --add-port=5666/tcp
firewall-cmd --zone=public --add-port=5666/tcp --permanent
sed -i '/^allowed_hosts=/s/$/,<IP address of Nagios server >/' /usr/local/nagios/etc/nrpe.cfg
sed -i 's/^dont_blame_nrpe=.*/dont_blame_nrpe=1/g' /usr/local/nagios/etc/nrpe.cfg

/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1

[root@XXXXXX ~]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v3.0.1
[root@XXXXXX ~]#

[root@XXXXXXX ~]# /usr/local/nagios/libexec/check_nrpe -H <Client_Name> -t 30 -c check_disk -a '-w 20% -c 10% -p /'
NRPE: Command 'check_disk' not defined
[root@XXXXXXX ~]#

Regards
DDN

Re: NRPE: Command 'check_disk' not defined

Posted: Wed Apr 19, 2017 12:19 pm
by lmiltchev
How is the check_disk command defined on the client (remote machine)? It should be in either nrpe.cfg or common.cfg file.

Do you see any clues in "/var/log/messages" file on the client?

Run the following commands on the Nagios XI server, and show the output:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <Client_Name>
/usr/local/nagios/libexec/check_nrpe -H <Client_Name> -c check_users
/usr/local/nagios/libexec/check_nrpe -H <Client_Name> -c check_users -a '-w 2 -c 5'

Re: NRPE: Command 'check_disk' not defined

Posted: Thu Apr 20, 2017 1:12 am
by dambaru
reference command argument found in nrpe.cfg file as below ..


# The following examples use hardcoded command arguments...

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200


# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$


Pls find the command output in nagiosXI server as below .

[root@NAGIOSSRV ~]# /usr/local/nagios/libexec/check_nrpe -H <Client_system>
NRPE v3.0.1
[root@NAGIOSSRV ~]#
[root@NAGIOSSRV ~]# /usr/local/nagios/libexec/check_nrpe -H <Client_system> -c check_users
USERS OK - 2 users currently logged in |users=2;5;10;0
[root@NAGIOSSRV ~]#
[root@NAGIOSSRV ~]# /usr/local/nagios/libexec/check_nrpe -H <Client_system> -c check_users -a '-w 2 -c 5'
USERS OK - 2 users currently logged in |users=2;5;10;0
[root@NAGIOSSRV ~]#


Regards
DDN

Re: NRPE: Command 'check_disk' not defined

Posted: Thu Apr 20, 2017 9:34 am
by lmiltchev
Your check_disk command in the nrpe.cfg is commented out:

Code: Select all

#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
this is why you are getting:
NRPE: Command 'check_disk' not defined
Remove the "#" in front of the line:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
Save, exit and restart nrpe service (or xinetd).

Test it by running:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <Client_Name> -t 30 -c check_disk -a 20% 10% /
Alternatively, you can place everything in one argument, for example:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
then run:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <Client_Name> -t 30 -c check_disk -a '-w 20% -c 10% -p /'
Let us know if this solved your problem.

Re: NRPE: Command 'check_disk' not defined

Posted: Thu Apr 20, 2017 12:46 pm
by dambaru
yes it is resolved .

/usr/local/nagios/libexec/check_nrpe -H <Client_Name> -t 30 -c check_disk -a 20% 10% /
DISK OK - free space: / 20307 MB (81.27% inode=100%);| /=4680MB;19989;22488;0;24987

but in NagiosServer UI i am still getting below error

DISK CRITICAL - 20% is not accessible: No such file or directory

I also face similar error for other services as well i.e. Pleasge suggest the client setting an UI setting for below error as well .

NRPE: Command 'check_init_service' not defined
NRPE: Command 'check_cpu_stats' not defined
NRPE: Command 'check_mem' not defined
NRPE: Command 'check_open_files' not defined
NRPE: Command 'check_swap' not defined

Regards
DDN

Re: NRPE: Command 'check_disk' not defined

Posted: Thu Apr 20, 2017 1:40 pm
by lmiltchev
Most probably you will need to modify your service config to match the number of arguments...

Go to the CCM->Services, click on your "problem" service, and show us a screenshot of the page under the "Common Settings" tab.

Here's a wokring example from my test XI box:

On the client:

Code: Select all

command[check_disk_new]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
On the Nagios XI server:

Code: Select all

define service {
	host_name			CentOS6-NRPE
	service_description		/ Disk Usage New
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_disk_new!-a 20% 10% /!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notifications_enabled		1
	contacts			nagiosadmin
	_xiwizard			linux-server
	register			1
	}
In the web UI:
example01.PNG

Re: NRPE: Command 'check_disk' not defined

Posted: Fri Apr 21, 2017 8:47 am
by dambaru
Thank you so much . check_disk issue got resolved as suggested after putting below argument in CCM

ARG1 - check_disk
ARG2 - -a 20% 10% /

similarly can i have solution for below issue details .

NRPE: Command 'check_cpu_stats' not defined
NRPE: Command 'check_mem' not defined
NRPE: Command 'check_open_files' not defined

Regards
DDN

Re: NRPE: Command 'check_disk' not defined

Posted: Fri Apr 21, 2017 10:39 am
by lmiltchev
First, make sure you have the needed plugin present on the client (check_cpu_stats.sh, custom_check_mem and check_open_files.pl). If you don't have them, you can download the linux-nrpe-agent.tar.gz from here:

https://assets.nagios.com/downloads/nag ... ent.tar.gz

untar it, and copy over the plugins. They will be located in "linux-nrpe-agent\subcomponents\extraplugins\plugins\" directory.

Next, set up your commands in the nrpe.cfg by adding these lines:

Code: Select all

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$
Save, exit, and restart nrpe service (or xinetd) so that changes can take effect.

Lastly, test your checks by running from the command line on the Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_cpu_stats -a '-w 85 -c 95'
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_mem -a '-w 20 -c 10'
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_open_files -a '-w 100 -c 200'
Let us know if you have any more questions.

Re: NRPE: Command 'check_disk' not defined

Posted: Mon Apr 24, 2017 6:04 am
by dambaru
it is perfectly working for me :D

Regards
DDN

Re: NRPE: Command 'check_disk' not defined

Posted: Mon Apr 24, 2017 9:18 am
by cdienger
Glad to hear! Did you have any additional questions or can this thread be locked?