linuxmonitoringnrpeicinga

nrpe : Network server bind failure (98: Address already in use)


I have installed iCinga and nrpe in same machine. I am using nrpe for monitor many linux machine, so I installed nrpe locally also.

When I start my nrep locally service nrpe start it sows error like in /var/log/messages

nrpe : Network server bind failure (98: Address already in use)

I have google it that issue, and find the 5666 port usage

[root@cosrh6-74 conf.d]# netstat -apn | grep :5666
tcp        0      0 127.0.0.1:50539           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:50608           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:41987           10.104.16.210:5666          TIME_WAIT   -
tcp        0      1 127.0.0.1:42001           10.104.16.210:5666          SYN_SENT    -
tcp        0      0 127.0.0.1:50576           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:41927           10.104.16.210:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:52598           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 127.0.0.1:52624           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 127.0.0.1:41962           10.104.16.210:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:41979           10.104.16.210:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:52566           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 127.0.0.1:41928           10.104.16.210:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:52569           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 127.0.0.1:41955           10.104.16.210:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:52587           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 127.0.0.1:50586           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:50547           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:52588           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 127.0.0.1:50609           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:50567           10.104.16.212:5666          TIME_WAIT   -
tcp        0      0 127.0.0.1:52592           10.3.81.172:5666            TIME_WAIT   -
tcp        0      0 :::5666                     :::*                        LISTEN      757/xinetd

I I have changed /etc/nagios/nrpe.cfg port to 56666 from 5666.

How can I configure different port in host configuration(different port for different host) in icinga2 server to monitor machines with nrpe running in different ports?

Is this right to change port? Or any other way to do this? Please correct me if I did anything wrong?


Solution

  • Added port in command.conf file like this,

    object CheckCommand "check-nrpe" {
        import "plugin-check-command"
        command  = ["/usr/local/nagios/libexec/check_nrpe"]
         "-p" ="56666"
         "-H" ="$host$"
         "-c" = "$nrpe_command$"
         "-a" = $nrpe_arguments$"
    }
    

    "-p" ="56666" Works for me!!

    EDIT: Or we can pass like arguments from host configuration ( keeping port number in host configuration like @7171u answer) .