nrpe: Host is not allowed to talk to us

23,330

Solution 1

Had the same entry in my syslog. Editing /etc/nagios/nrpe.cfg and enter missing IP will fixed it at all.

allowed_hosts=1.2.3.4/24,127.0.0.1

After editing you have to restart or even reload nrpe deamon.

/etc/init.d/nagios-nrpe-server reload

Check if it is all fine with your configuration. Syslog should have an entry like this:

Allowing connections from: 1.2.3.4/24,127.0.0.1

I advise you not to add user nagios to sudoers because of security issues.

Solution 2

A lot of how-to's here and there ask you to allow your monitoring server IP like this in your host's /etc/nagios/nrpe.cfg :

allowed_hosts=127.0.0.1, 1.2.3.4

On some distribs (Ubuntu 14.04 LTS for instance), it's working. On other (Ubuntu 12.04 LTS - tested on Microsoft Azure in my case), it does not.

Just remove the space before second IP :

allowed_hosts=127.0.0.1,1.2.3.4

Then, of course, restart your host's nrpe service :

$ service nagios-nrpe-server restart

Solution 3

I found the solution, but the error message is totally misleading. The user nagios has to be in the suders...

/etc/sudoers:

nagios  ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
Share:
23,330
Jean-Philippe Caruana
Author by

Jean-Philippe Caruana

Agile developer : java, go, python, ruby, scala, erlang, elixir

Updated on September 18, 2022

Comments

  • Jean-Philippe Caruana
    Jean-Philippe Caruana almost 2 years

    I installed nrpe on new servers. Nagios is already running and checking other server (I haven't installed).

    I've got several error lines in my syslog file :

    Oct 31 15:17:01 myservername nrpe[41848]: Host nagios_ip is not allowed to talk to us!
    

    My nrpe.cfg file includes the following line :

    allowed_hosts=nagios_ip
    

    What am I doing wrong ?

    (with nagios_ip the actual IP for my nagios server)

    • norrland
      norrland over 10 years
      Which OS and Nagios/NRPE version is installed?
    • norrland
      norrland over 10 years
      Also. Check nrpe.conf for whitespaces after allowed_hosts=<ip>. In vim :set list
  • Keith
    Keith over 10 years
    this is not correct at all, actually
  • Jean-Philippe Caruana
    Jean-Philippe Caruana over 10 years
    well, this solved the problem at once. Could you be more specific ?
  • gxx
    gxx over 8 years
    "I advise you not to add user nagios to sudoers because of security issues." Could you elaborate on this?
  • gxx
    gxx over 8 years
    "You do not want to add nagios to your sudoers file." Could you elaborate on this?
  • A.C
    A.C over 8 years
    you're making these perl/python/bash scripts that check system information rwx by everyone instead of giving sudo access to a user. If you don't understand how sudo works, or what it is I encourage you to google it. if you're worried about it, chmod 755
  • gxx
    gxx over 8 years
    Thanks for your comment; I'm appreciating your hints...good to see, that you are in fact quite clueless what's possible with sudo, and how to limit access. Just giving a user access to sudo doesn't mean anything, in contrast to your chmod 777.
  • David Baucum
    David Baucum over 5 years
    One should definitely not do this. The nagios user should not have super permissions. Use the answer from @JaMaBing