1

I use nagios to warn if there are apt updates available on my Debian buster server, but I want to use this option:

-o, --only-critical
  Only warn about upgrades matching the critical list.  The total number
  of upgrades will be printed, but any non-critical upgrades will not cause
  the plugin to return WARNING status.

so I edited /etc/nagios-plugins/config/apt.cfg:

# 'check_apt' command definition
define command{
        command_name    check_apt
        command_line    /usr/lib/nagios/plugins/check_apt --only-critical
}

# 'check_apt_distupgrade' command definition
define command{
        command_name    check_apt_distupgrade
        command_line    /usr/lib/nagios/plugins/check_apt --only-critical -d
}

But still I get emails containing something like:

***** Service Monitoring on freifunk *****

apt on vm02.freifunk is WARNING!

Info:    APT WARNING: 2 packages available for upgrade (0 critical updates). 

Although I have installed monitoring-plugins-basic 2.2-6 and the --only-critical option was added in release-2.3.3 it is working already:

# /usr/lib/nagios/plugins/check_apt
APT WARNING: 2 packages available for upgrade (0 critical updates). |available_upgrades=2;;;0 critical_updates=0;;;0
# /usr/lib/nagios/plugins/check_apt --only-critical
APT OK: 2 packages available for upgrade (0 critical updates). |available_upgrades=2;;;0 critical_updates=0;;;0

But the command option I set in the nagios config seems to be ignored.

I also tried the latest version manually installed from this source, but it didn't change the outcome. Maybe is there another way to achieve this? maybe just change the line in command_line to something, that greps the result somehow?

it seems like the nagios plugins are used by icinga2. This is a part of /etc/icinga2/constants.conf:

/* The directory which contains the plugins from the Monitoring Plugins project. */
const PluginDir = "/usr/lib/nagios/plugins"

How do I properly tell nagios not to warn about non-critical updates?

Glorfindel
  • 805
  • 2
  • 10
  • 19
rubo77
  • 27,777
  • 43
  • 130
  • 199
  • Can you please verify the config path? You talk about `/etc/nagios/config` and `/etc/nagios-plugins/config/`. Is the correct config used? – Beko Pharm Jul 21 '20 at 08:26
  • @BekoPharm, yes, I added my answer – rubo77 Jul 21 '20 at 12:20
  • If the plugin works correctly from CLI (which it seems to do), you can at least be sure that it's a configuration issue. You might want to investigate where you're seeing the problem (what host/service), what command that check is using and go from there. Note that if this is a remote check (NRPE for example) the used plugin is on the receiving node, not the node running Nagios. – pzkpfw Dec 08 '20 at 10:15

0 Answers0