Question

I have 1 Nagios "master?" and 3 slaves running. I get the correct data from the slaves on all checks except for the check_apt where all slaves get the master result.

The scenario today was that i added this to hostgroups.cfg

define hostgroup {
        hostgroup_name  system-packages
        alias           APT status on all servers
        members         *
}

And added this to services.cfg

define service {
        hostgroup_name                  system-packages
        service_description             APT
        check_command                   check_apt
        use                             generic-service
        notification_interval           0 ; set > 0 if you want to be renotified
}

Then when i restarted the Nagios3, the master reported that 3 packages needed to be updated, then after a while the other reports came in, also with 3 packages.

That i thought was ok, they got installed on the same day, so shouldn't differ.

But then i updated those 3 packages on the master and the warnings on the slaves also disappeared, so somehow the slaves gets the result from the master.

When i run the check_apt command on a single slave, it reports the correct data:

user@remote-system:~$ /usr/lib/nagios/plugins/check_apt
APT CRITICAL: 3 packages available for upgrade (3 critical updates).

I don't get any error in the logs or anything. Are really out of ideas what can be the problem, so any suggestions are welcome.

Was it helpful?

Solution

check_apt can only show results from the host it's running on (e.g., localhost).

To run check_apt against other hosts, you need an agent of some sort. Like NRPE or check_by_ssh (with keys).

This applies to any plugin that is checking an "internal" thing like APT, load, memory, disk usage, SMART health, etc.

Edit: To clarify, your service def that applies this check to the system-packages needs to be more like this, because right now you're running check_apt on localhost for every check:

define service {
    hostgroup_name                  system-packages
    service_description             APT
    check_command                   check_nrpe!check_apt
    use                             generic-service
}

Or perhaps check_nrpe_1arg instead, if using the Debian/Ubuntu packaged NRPE.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top