[Help] Fix NRPE: Command 'check_swap' 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.
Locked
bkavpro
Posts: 5
Joined: Thu Dec 19, 2019 11:08 pm

[Help] Fix NRPE: Command 'check_swap' not defined

Post by bkavpro »

Hi everyone,


I'm sorry for my bad english.

My problem: I have 5 server linux, I already install "nagios-plugins-all nagios-plugins-nrpe nrpe" and config nagios on /etc/nagios/nrpe.cfg

Code: Select all

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /
command[check_hda2]=/usr/lib64/nagios/plugins/check_disk -w 15% -c 10% -p /mnt/data
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 300 -c 350
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 50% -c 30%
Only 2 Server have check_swap working

Code: Select all

CPU Load
OK	12-20-2019 04:16:13	10d 16h 19m 19s	1/3	OK - load average: 0.12, 0.21, 0.34 
Check Disk_2
OK	12-20-2019 04:24:09	10d 16h 21m 23s	1/3	DISK OK - free space: /mnt/data 44034 MB (61% inode=97%): 
Check Root Partition
OK	12-20-2019 04:16:25	10d 14h 39m 7s	1/3	DISK OK - free space: / 4805 MB (48% inode=82%): 
Check Swap
OK	12-20-2019 04:15:40	10d 16h 19m 51s	1/3	SWAP OK - 100% free (5119 MB out of 5119 MB) 
Check Zombies
OK	12-20-2019 04:24:07	10d 16h 21m 23s	1/3	PROCS OK: 0 processes with STATE = Z 
Total Processes
OK	12-20-2019 04:18:14	10d 16h 17m 17s	1/3	PROCS OK: 101 processes 
Users Load
OK	12-20-2019 04:15:46	10d 16h 19m 45s	1/3	USERS OK - 1 users currently logged in 

But last 3 server get error with check_swap

CRITICAL 12-20-2019 04:17:20 0d 2h 12m 11s 3/3 NRPE: Command 'check_swap' not defined

Code: Select all

CPU Load
OK	12-20-2019 04:19:04	0d 2h 16m 27s	1/3	OK - load average: 0.18, 0.14, 0.16 
Check Disk_2
OK	12-20-2019 04:20:29	0d 2h 15m 2s	1/3	DISK OK - free space: /mnt/data 50892 MiB (71.06% inode=96%): 
Check Root Partition
OK	12-20-2019 04:21:55	0d 2h 13m 36s	1/3	DISK OK - free space: / 9781 MiB (32.59% inode=94%): 
Check Swap
CRITICAL	12-20-2019 04:17:20	0d 2h 12m 11s	3/3	NRPE: Command 'check_swap' not defined 
Check Zombies
OK	12-20-2019 04:24:46	0d 2h 10m 45s	1/3	PROCS OK: 0 processes with STATE = Z 
Total Processes
OK	12-20-2019 04:16:11	0d 2h 9m 20s	1/3	PROCS OK: 145 processes 
Users Load
OK	12-20-2019 04:17:37	0d 2h 7m 54s	1/3	USERS OK - 1 users currently logged in 
I try fix: Update nagios plugin, change URL plugin from /usr/lib64/nagios/plugins/ to /usr/local/nagios/libexec/ but still not work. I try go forum and read many post but can not fix it.

Please, anyone can help me to fix that problem, thank you.
Have a nice day,

=================================================================================

Thanks to @scottwilkerson for help me fix it,
scottwilkerson wrote:Ok, you were making edits to /etc/nagios/nrpe.cfg but NRPE is running under xinetd using /usr/local/nagios/etc/nrpe.cfg

Maike your changes in /usr/local/nagios/etc/nrpe.cfg then restart xinetd
Last edited by bkavpro on Mon Dec 30, 2019 11:50 pm, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by scottwilkerson »

On one of the servers that isn't working can you show the output of the following

Code: Select all

ps -ef|grep nrpe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bkavpro
Posts: 5
Joined: Thu Dec 19, 2019 11:08 pm

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by bkavpro »

scottwilkerson wrote:On one of the servers that isn't working can you show the output of the following

Code: Select all

ps -ef|grep nrpe
Hi scottwilkerson,

This is output :

Code: Select all

[root@test-1 ~]# ps -ef|grep nrpe
root      2378  2360  0 01:34 pts/0    00:00:00 grep --color=auto nrpe
I also check other server and output same ,

Thanks,
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by scottwilkerson »

Can you show the output of the following on a server that isn't working
netstat -nlp|grep 5666
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bkavpro
Posts: 5
Joined: Thu Dec 19, 2019 11:08 pm

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by bkavpro »

scottwilkerson wrote:Can you show the output of the following on a server that isn't working
netstat -nlp|grep 5666
Hi scottwilkerson, port 5666 still listen by xinetd

Code: Select all

[root@test-1 ~]# netstat -nlp|grep 5666
tcp        0      0 :::5666                     :::*                        LISTEN      28257/xinetd
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by scottwilkerson »

Ok, so let's look at the following and see what the location of the nrpe.cfg the xinetd process is using for nrpe

Code: Select all

cat /etc/xinetd.d/nrpe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bkavpro
Posts: 5
Joined: Thu Dec 19, 2019 11:08 pm

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by bkavpro »

scottwilkerson wrote:Ok, so let's look at the following and see what the location of the nrpe.cfg the xinetd process is using for nrpe

Code: Select all

cat /etc/xinetd.d/nrpe
Yes, This is my config :

Code: Select all

[root@test-1 ~]# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
#       only_from       = 127.0.0.1
}
Thanks,
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by scottwilkerson »

Ok, you were making edits to /etc/nagios/nrpe.cfg but NRPE is running under xinetd using /usr/local/nagios/etc/nrpe.cfg

Maike your changes in /usr/local/nagios/etc/nrpe.cfg then restart xinetd
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bkavpro
Posts: 5
Joined: Thu Dec 19, 2019 11:08 pm

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by bkavpro »

scottwilkerson wrote:Ok, you were making edits to /etc/nagios/nrpe.cfg but NRPE is running under xinetd using /usr/local/nagios/etc/nrpe.cfg

Maike your changes in /usr/local/nagios/etc/nrpe.cfg then restart xinetd
Hi scottwilkerson,

Thank you so much, that way to fix my problem.

But now I have new problem: 2 server can not upgrade NRPE from v2.15 to v3.2.1, I use this post for upgrade my NRPE: https://support.nagios.com/kb/article/n ... e-515.html , it's work on 3 server and other still show

Code: Select all

[root@wama2 plugins]# /usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1
NRPE v2.15
I try copy new file NRPE v3.2.1 and still show older version, Do you know how to fix it ?

Thanks for your help.

Have a nice day,
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: [Help] Fix NRPE: Command 'check_swap' not defined

Post by scottwilkerson »

If you upgraded using those instructions the file is likely located in /usr/local/nagios/bin/nrpe

and uses the service command vs. xinetd

What you would need to do is remove /etc/xinetd.d/nrpe then restart xinetd
service xinetd restart

then start the nrpe service

Code: Select all

service nrpe start
One note is that this will also likely expect to use the config located at /usr/local/nagios/etc/nrpe.cfg and you will need to add your nagios server to the allowed_hosts section of that configuration file.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked