I have 2 servers behind NAT, both have same public IP and NRPE is listening on non-standard ports.

I would like to monitor them both using my central icinga server, but I can't find where can I specify alternative nrpe port, icinga is trying default port which isn't open on target public IP. How can I do that?

  • You can check it using nmap command when you want to know which port isnt open on Target Public IP?Or using netstat command to check it. – supriady Jan 3 '17 at 12:41

Note that I assume that your NAT-ing device is already configured forwarding traffic to your NRPE servers. And that you are running Icinga 1.

On your Icinga server, you probably have some /etc/nagios-plugins/config/check_nrpe.cfg file existing, that gets loaded by your Icinga daemon. When you define a check_nrpe check, this is where Icinga finds your command definition.

The default check_nrpe command definition does not allow for dynamic ports. If you want to set a custom port running NRPE commands, you'll want to add a new command somewhere, or change the existing one (and potentially, all references to it) so it allows for this port to be defined.

On paper, you may have something like this:

define command {
    command_name        check_nrpe
    command_line        /usr/lib/nagios/plugins/check_nrpe -H '$HOSTADDRESS$' -c '$ARG1$' -t 30

define command {
    command_name        check_nrpe5667
    command_line        /usr/lib/nagios/plugins/check_nrpe -H '$HOSTADDRESS$' -p 5667 -c '$ARG1$' -t 30

define command {
    command_name        check_nrpe_dynport
    command_line        /usr/lib/nagios/plugins/check_nrpe -H '$HOSTADDRESS$' -p '$ARG1$' -c '$ARG2$' -t 30

Now instead of defining your check command as check_nrpe!my_remote_check, you would use check_nrpe5667!my_remote_check, or check_nrpe_dynport!5667!my_remote_check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.