Page 1 of 1

Custom NRPE Port

Posted: Mon Jun 01, 2015 3:21 pm
by FierUser
Hi I'm trying to change the default NRPE port from 5666 to something else. However everytime I try to use check_nrpe it still uses the default 5666 port.

I'm not sure which file I should be changing, but I've changed the nrpe.cfg file to have server_port=#### on both the client and server. Not sure where else I have to go to change the port settings.

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 3:27 pm
by tgriep
On your check_nrpe command on the XI system, did you edit the command to add the switch -p <port> and add the port that you want to use for that specific host?
Is the port open on the remote system?

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 3:32 pm
by lmiltchev
Are you running NRPE under xinetd or as a "standalone" daemon? If you are running it under xinetd, you may need to change the port number in "/etc/xinetd.d/nrpe" file.

Code: Select all

port            = <new port number>
Did you make sure the port is not blocked by your firewall?

Code: Select all

iptables -nL | grep <new port number>

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 3:34 pm
by eloyd
Depending on how secure your Nagios server is, you may also be blocking outbound servers. You can check by expanding the iptables command and checking for the IP address of your destination host that you're checking:

Code: Select all

iptables -Lvn | grep <ip address>

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 3:36 pm
by FierUser
tgriep wrote:On your check_nrpe command on the XI system, did you edit the command to add the switch -p <port> and add the port that you want to use for that specific host?
Is the port open on the remote system?
I've opened the port on the remote system via iptables, I don't believe I edited the command to add the switch; is that under commands.cfg?

Code: Select all

#'check_nrpe' command definition
define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 3:46 pm
by abrist
Exactly. Change your command to match the following (replace <custom port> with your desired port):

Code: Select all

#'check_nrpe' command definition
define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -p <custom port> -c $ARG1$
        }

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 4:39 pm
by FierUser
Awesome that fixed it. Thank you all.

Re: Custom NRPE Port

Posted: Mon Jun 01, 2015 4:40 pm
by abrist
Don't mention it. Cheers!