NRPE: Command not defined

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
matson-itops
Posts: 108
Joined: Wed Nov 18, 2015 11:19 pm

NRPE: Command not defined

Post by matson-itops »

Not sure why I'm getting this error. can you provide some guidance?

[nagios]$ /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -t 3 0 -c check_mailq -a -w 100 -c 200
NRPE: Command 'check_mailq' not defined

however I clearly see it in /usr/local/nagios/etc/commands.cfg
define command {
command_name check_mailq
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: NRPE: Command not defined

Post by gsmith »

hi

Please send us your system profile.
1. Login to the Nagios XI GUI using a web browser.
2. Click the "Admin" > "System Profile" Menu
3. Click the "Download Profile" button
4. Save the profile.zip file and share the file in a private message and then
reply to this post to bring it up in the queue.

Thanks
matson-itops
Posts: 108
Joined: Wed Nov 18, 2015 11:19 pm

Re: NRPE: Command not defined

Post by matson-itops »

ok sent
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: NRPE: Command not defined

Post by gsmith »

Hi

When I loaded your System Profile I see this when I go to Configure, CCM, Commands:
Image018.jpg

In /usr/local/nagios/etc/commands.cfg:

Code: Select all

define command {
    command_name    check_mailq
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
The check_mailq command should be calling out the check_mailq plugin, so it should look something like this:
Image019.jpg
And then the service definition should look something like this:
Image020.jpg
Note: I hard-coded the arguments in the command definition, and didn't provide for them
in the Service definition to save time. If you want me to reconfigure the command and
service to do this please let me know.

Let me know if you run into anything else.

Thanks
You do not have the required permissions to view the files attached to this post.
matson-itops
Posts: 108
Joined: Wed Nov 18, 2015 11:19 pm

Re: NRPE: Command not defined

Post by matson-itops »

this was working before we switched mail servers.
we are using nrpe checks and nrpe agent to trigger the check on the remote hosts with sudo
matson-itops
Posts: 108
Joined: Wed Nov 18, 2015 11:19 pm

Re: NRPE: Command not defined

Post by matson-itops »

[nagios@ ~]$ /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -t 30 -c check_mailqJSL

I tried creating a new check per your instructions, but still can not reach my server through nrpe.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: NRPE: Command not defined

Post by gsmith »

Hi

On the remote server try:

Code: Select all

systemctl enable nrpe
systemctl status nrpe
Also make sure port 5666 is open on the remote system:

Code: Select all

firewall-cmd --list-ports
If it's not listed then:

Code: Select all

firewall-cmd  --add-port=5666/tcp --permanent
firewall-cmd  --reload
firewall-cmd --list-ports
If it's still not connecting please send me the error message you are getting.

Thanks
matson-itops
Posts: 108
Joined: Wed Nov 18, 2015 11:19 pm

Re: NRPE: Command not defined

Post by matson-itops »

we are running nrpe through xinetd

[root]# cd /etc/xinetd.d
[root]# ls
xxxxx nrpe xxxxx

[root]# service xinetd status
Redirecting to /bin/systemctl status xinetd.service
● xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-11-08 16:05:41 PST; 2 days ago

AND we are not running any firewall AND all other checks on this server work.
[root]# firewall-cmd --list-ports
FirewallD is not running
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: NRPE: Command not defined

Post by gsmith »

Hi

Please send the host cfg for the server that you are trying to run check_mailq on from
/usr/local/nagios/etc on the Nagios server.

Thanks!
matson-itops
Posts: 108
Joined: Wed Nov 18, 2015 11:19 pm

Re: NRPE: Command not defined

Post by matson-itops »

I am running the check_nrpe -c check_mailq from the nagios server

Below is the host config. looks like I have 2 for the local box

[]$ more localhost.cfg
###############################################################################
#
# Hosts configuration file
#
# Created by: Nagios CCM 3.1.4
# Date: 2021-11-09 11:42:15
# Version: Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define host {
host_name localhost
use linux-server
alias localhost
address 127.0.0.1
register 1
}

###############################################################################
#
# Hosts configuration file
#
# END OF FILE
#
###############################################################################


and another one, just in case
[]$ more NagiosXI_Local_Server.cfg
###############################################################################
#
# Hosts configuration file
#
# Created by: Nagios CCM 3.1.4
# Date: 2021-11-09 11:42:16
# Version: Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define host {
host_name NagiosXI_Local_Server
use linux-server
alias NagiosXI_Local_Server
display_name NagiosXI_Local_Server
address 127.0.0.1
register 1
}

###############################################################################
#
# Hosts configuration file
#
# END OF FILE
#
###############################################################################
Locked