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?


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

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


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.