Custom NRPE Port

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
FierUser
Posts: 5
Joined: Mon Jun 01, 2015 3:14 pm

Custom NRPE Port

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Custom NRPE Port

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Custom NRPE Port

Post 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>
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Custom NRPE Port

Post 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>
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
FierUser
Posts: 5
Joined: Mon Jun 01, 2015 3:14 pm

Re: Custom NRPE Port

Post 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$
        }
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom NRPE Port

Post 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$
        }
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
FierUser
Posts: 5
Joined: Mon Jun 01, 2015 3:14 pm

Re: Custom NRPE Port

Post by FierUser »

Awesome that fixed it. Thank you all.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom NRPE Port

Post by abrist »

Don't mention it. Cheers!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked