Page 1 of 3
NRPE: Command not defined
Posted: Mon Nov 08, 2021 2:11 pm
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$
}
Re: NRPE: Command not defined
Posted: Mon Nov 08, 2021 2:46 pm
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
Re: NRPE: Command not defined
Posted: Mon Nov 08, 2021 5:40 pm
by matson-itops
ok sent
Re: NRPE: Command not defined
Posted: Tue Nov 09, 2021 12:33 pm
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
Re: NRPE: Command not defined
Posted: Tue Nov 09, 2021 1:29 pm
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
Re: NRPE: Command not defined
Posted: Tue Nov 09, 2021 2:54 pm
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.
Re: NRPE: Command not defined
Posted: Wed Nov 10, 2021 2:13 pm
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:
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
Re: NRPE: Command not defined
Posted: Thu Nov 11, 2021 7:04 pm
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
Re: NRPE: Command not defined
Posted: Fri Nov 12, 2021 11:24 am
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!
Re: NRPE: Command not defined
Posted: Mon Nov 15, 2021 1:16 pm
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
#
###############################################################################