NRPE: Command 'check_mem' not defined

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.
mahtabalam
Posts: 9
Joined: Mon Sep 23, 2019 1:30 am

NRPE: Command 'check_mem' not defined

Post by mahtabalam »

I have installed NRPE in my server and created check_mem command in nrpe,cfg
The command is :

command[check_mem]=/usr/lib64/nagios/plugins/check_mem.sh -w 80 -c 90

Now when I create a active check in my nagios core which is
define service {

use vps-monitor ; Name of service template to use
host_name xxxxxxxx, xxxxxxxx
service_description RAM Memory
check_command check_nrpe!check_mem
}


it gives the output like below :
NRPE: Command 'check_mem' not defined

What should I do now?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

Did you restart the nrpe service after modifying the nrpe.cfg?

If so can you show the output of

Code: Select all

ps -ef|grep nrpe
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
mahtabalam
Posts: 9
Joined: Mon Sep 23, 2019 1:30 am

Re: NRPE: Command 'check_mem' not defined

Post by mahtabalam »

scottwilkerson wrote:Did you restart the nrpe service after modifying the nrpe.cfg?

If so can you show the output of

Code: Select all

ps -ef|grep nrpe
Attachments
Screenshot from 2019-10-09 13-48-15.png
Screenshot from 2019-10-09 13-48-15.png (11.44 KiB) Viewed 3420 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

Ok, also show the output of

Code: Select all

grep check_mem /etc/nagios/nrpe.cfg
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: NRPE: Command 'check_mem' not defined

Post by vkodanam »

Hi, I've similar issue. I wanted to monitor the memory of the remote server, I've placed the check_mem.sh on the remote server at /usr/lib/nagios/plugins. Added the command command[check_mem]=/usr/local/nagios/libexec/check_mem.sh 85 95 to nrpe.conf on the remote server. And when I test it from the Nagios server, i still get the command not defined error. The check_mem.sh has appropriate permissions, Nagios server has access to the remote server, I'm able to run other check such as check_load without any problem. What am I doing wrong?:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

vkodanam wrote:Hi, I've similar issue. I wanted to monitor the memory of the remote server, I've placed the check_mem.sh on the remote server at /usr/lib/nagios/plugins. Added the command command[check_mem]=/usr/local/nagios/libexec/check_mem.sh 85 95 to nrpe.conf on the remote server. And when I test it from the Nagios server, i still get the command not defined error. The check_mem.sh has appropriate permissions, Nagios server has access to the remote server, I'm able to run other check such as check_load without any problem. What am I doing wrong?:
Did you restart nrpe after adding the command?

Can you show the output of the following on the remote server?

Code: Select all

ps -ef|grep nrpe
What command are you using from the Nagios server?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: NRPE: Command 'check_mem' not defined

Post by vkodanam »

scottwilkerson wrote:
vkodanam wrote:Hi, I've similar issue. I wanted to monitor the memory of the remote server, I've placed the check_mem.sh on the remote server at /usr/lib/nagios/plugins. Added the command command[check_mem]=/usr/local/nagios/libexec/check_mem.sh 85 95 to nrpe.conf on the remote server. And when I test it from the Nagios server, i still get the command not defined error. The check_mem.sh has appropriate permissions, Nagios server has access to the remote server, I'm able to run other check such as check_load without any problem. What am I doing wrong?:
Did you restart nrpe after adding the command?

Can you show the output of the following on the remote server?

Code: Select all

ps -ef|grep nrpe
What command are you using from the Nagios server?

The output for ps -ef|grep nrpe:

Code: Select all

ps -ef|grep nrpe
nagios    1548     1  0 Oct29 ?        00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f
root     27449 25523  0 11:52 pts/0    00:00:00 grep --color=auto nrpe

Code: Select all

grep check_mem /etc/nagios/nrpe.cfg

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh 85 95
#command[check_mem]=/usr/lib/nagios/plugins/custom_check_mem -n $ARG1$
command used on the Nagios server :

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.xx.xx -c  check_mem
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

Several problems, you said you put the plugin at /usr/lib/nagios/plugins but your command path you set is /usr/local/nagios/libexec/check_mem.sh That would be incorrect.

Also, based on this, nrpe hasn't been restarted and has been running since Oct29

Code: Select all

nagios    1548     1  0 Oct29 ?        00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f
You need to restart nrpe for changes to take affect
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
vkodanam
Posts: 15
Joined: Thu Oct 10, 2019 10:16 am

Re: NRPE: Command 'check_mem' not defined

Post by vkodanam »

scottwilkerson wrote:Several problems, you said you put the plugin at /usr/lib/nagios/plugins but your command path you set is /usr/local/nagios/libexec/check_mem.sh That would be incorrect.

Also, based on this, nrpe hasn't been restarted and has been running since Oct29

Code: Select all

nagios    1548     1  0 Oct29 ?        00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f
You need to restart nrpe for changes to take affect
Sorry, looks like I've given the wrong path for where I've had placed the check_mem.sh script. I've restarted the nrpe service a couple of times and its till showed Oct 29. I had to force kill and reboot the VM. Now, I get the error Unable to read the output.

Command on NRPE.cfg is command[check_mem]=/usr/local/nagios/libexec/check_mem.sh -w 85 -c 95
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

You have changed the path and the arguments in the different commands you have shown
if this is in /etc/nagios/nrpe.cfg
vkodanam wrote:

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh -w 85 -c 95
Can you run that from the command line on the remote server?

Code: Select all

/usr/local/nagios/libexec/check_mem.sh -w 85 -c 95
can you also show again the output of

Code: Select all

ps -ef|grep nrpe
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked