Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a very odd problem with Nagios. For some reason the check_apt seems to be failing and I dont know why. It acts like it's not running the check at all.

I have nrpe running on the box development and all other checks are running fine. On the box with nagios installed the definition is as follows.

define service{
    use                             generic-service         
    host_name                       development
    service_description             APT
    check_command                   check_nrpe!check_apt
    }

On "development" the nrpe.cfg contains the following line.

command[check_apt]=/usr/lib/nagios/plugins/check_apt -n

Furthermore if I am on the box with Nagios installed and I execute the following it works!

/usr/lib/nagios/plugins/check_nrpe -H development -c check_apt

which returns

APT OK: 0 packages available for upgrade (0 critical updates).

So, what is wrong here? It would seem that other NRPE plugins are working fine, only APT seems to fail and running it manually on the box seems to work. Suggestions?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The problem I discovered was in the service description, although I think there is either a bug or an option in Nagios not being specified. The debug output showed the actual command line being run to NRPE

/usr/lib/nagios/plugins/check_nrpe -H server.mechsoft-vps1.com -c check_mysqld -a

The problem here is that -a requires a parameter. The check however does not. Changing the service definition to add a parameter fixed the problem.

define service{
    use                             generic-service         
    host_name                       development
    service_description             APT
    check_command                   check_nrpe!check_apt!1
    }
share|improve this answer
    
having same issue, this solution didn't work for me. Any ideas are appreciated a lot! serverfault.com/questions/549882/… –  talha06 Oct 31 '13 at 13:50

Try enabling debug in the nrpe configuration file nrpe.conf on your development host. Set debug=1, restart nrpe if running as a daemon, and check your /var/log/messages or nagios log file for errors. You can schedule immediate checks of your check_apt command from the Nagios web interface.

Also try running from the console with the "right" user, not as root but as nagios user. Or is your nagios running as root? In our systems nagios runs as user nagios.

If your nagios is running under a nagios user, try:

su -c '/usr/lib/nagios/plugins/check_nrpe -H development -c check_apt' nagios

Richard

share|improve this answer

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.