NRPE: Command 'check_mem' not defined

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

NRPE: Command 'check_mem' not defined

Postby mahtabalam » Wed Oct 02, 2019 7:16 am

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

Re: NRPE: Command 'check_mem' not defined

Postby scottwilkerson » Wed Oct 02, 2019 7:20 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17024
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NRPE: Command 'check_mem' not defined

Postby mahtabalam » Wed Oct 09, 2019 2:49 am

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

Re: NRPE: Command 'check_mem' not defined

Postby scottwilkerson » Wed Oct 09, 2019 10:28 am

Ok, also show the output of

Code: Select all
grep check_mem /etc/nagios/nrpe.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17024
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NRPE: Command 'check_mem' not defined

Postby vkodanam » Wed Nov 20, 2019 11:20 am

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?:
vkodanam
 
Posts: 12
Joined: Thu Oct 10, 2019 10:16 am

Re: NRPE: Command 'check_mem' not defined

Postby scottwilkerson » Wed Nov 20, 2019 11:37 am

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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17024
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NRPE: Command 'check_mem' not defined

Postby vkodanam » Wed Nov 20, 2019 12:02 pm

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
vkodanam
 
Posts: 12
Joined: Thu Oct 10, 2019 10:16 am

Re: NRPE: Command 'check_mem' not defined

Postby scottwilkerson » Wed Nov 20, 2019 12:16 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17024
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NRPE: Command 'check_mem' not defined

Postby vkodanam » Wed Nov 20, 2019 2:55 pm

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
vkodanam
 
Posts: 12
Joined: Thu Oct 10, 2019 10:16 am

Re: NRPE: Command 'check_mem' not defined

Postby scottwilkerson » Wed Nov 20, 2019 3:08 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17024
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Next

Return to Nagios Core

Who is online

Users browsing this forum: Google [Bot] and 18 guests