Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
    
Have you tried restarting the nrpe service on the target server? – norrland Oct 31 '13 at 14:45
    
Yes I did but it had no effect – Jean-Philippe Caruana Oct 31 '13 at 14:47
    
Which OS and Nagios/NRPE version is installed? – norrland Oct 31 '13 at 14:52
    
Also. Check nrpe.conf for whitespaces after allowed_hosts=<ip>. In vim :set list – norrland Oct 31 '13 at 14:54
up vote 2 down vote accepted

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|improve this answer
1  
this is not correct at all, actually – Keith Oct 31 '13 at 18:02
3  
well, this solved the problem at once. Could you be more specific ? – Jean-Philippe Caruana Nov 4 '13 at 9:16

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.

share|improve this answer
    
"I advise you not to add user nagios to sudoers because of security issues." Could you elaborate on this? – gf_ Dec 9 '15 at 20:57

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
share|improve this answer

You do not want to add nagios to your sudoers file. If you're nagios server is in allowed_hosts but you're still getting this error, the following work flow will probably fix it (at least it did with mine):

sudo@host: ls -l /usr/lib/nagios/plugins/ if any are -rwxr-x-r-x then

sudo@host: chmod 777 /usr/lib/nagios/plugins/* sudo@host: /etc/init.d/nagios-nrpe-server reload

then to check, do on your nagios server

/usr/lib/nagios/plugins/check_nrpe -H <server>

Good Luck!

share|improve this answer
    
chmod 777 is a quite bad advice; making all the files world write-/read-/executable? Really...? – gf_ Dec 9 '15 at 20:56
    
"You do not want to add nagios to your sudoers file." Could you elaborate on this? – gf_ Dec 9 '15 at 20:57
    
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 – A.C Dec 10 '15 at 18:23
    
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. – gf_ Dec 10 '15 at 18:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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