nrpe returning different results remotely for check_apt

13 Views Asked by At

I see another post with this topic, but nothing in it seems to help me with this scenario.

I have a nagios 4 server that I set up in the amazon cloud to monitor system at 3 locations. I'm configuring a new host and associated server configurations to be accessible via nrpe. I'm using configurations similar to the other dozen hosts already configured. Yet when nrpe makes the remote call to check_apt, it's getting different results than when check_apt is run locally.

nrpe configuration on devbox:

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

running check_apt on devbox (doesn't matter if it's a user or root):

$ sudo /usr/lib/nagios/plugins/check_apt
APT OK: 0 packages available for upgrade (0 critical updates). |available_upgrades=0;;;0 critical_updates=0;;;0

(nagios server config to remote)

define host {
    use                     linux-server
    host_name               devbox
    alias                   DevBox
    address                 192.168.0.30
    _PORT                   5666
    check_command           check_ping
    notifications_enabled   1
    notification_period     24x7
    notification_options    d,u,r
    contact_groups          alert
}
define service {
    use                     generic-service
    host_name               devbox
    service_description     APT Updates
    check_command           check_nrpe_lto!check_apt
}

running check_nrpe -c check_apt from nagios server:

$ /usr/lib/nagios/plugins/check_nrpe -H 192.168.0.30 -t 30 -c check_apt
APT WARNING: 13 packages available for upgrade (0 critical updates). |available_upgrades=13;;;0 critical_updates=0;;;0
1

There are 1 best solutions below

1
Scott On

ok, that was weird - apparently updates showed up between when I started and when I finished modifying the local and remote files (a span of about 5 minutes). For some reason it was not showing the need for updates when check_apt was run locally but was showing it when it was run remote.

As I was looking over the options for check_apt I noticed one that triggered an 'apt-get update' before doing the check, so I ran it with privileges and the update first flag and suddenly the local was showing 19 total packets needing to update.

running apt update && apt upgrade then set both local and remote to '0'. I don't know if this will continue to be an issue going forward or not, but it seems to synch up at least now.