[Pkg-nagios-devel] Bug#1014551: Bug#1014551: icinga2: check_apt not working if both master and host are running 2.13.4-1

Sebastiaan Couwenberg sebastic at xs4all.nl
Thu Jul 7 22:17:42 BST 2022


On 7/7/22 22:18, Jim Penny wrote:
> Services.conf has this stanza.
> 
> apply Service "apt" {
>    check_command = "apt"
>    vars.apt_upgrade = false
>    command_endpoint = host.vars.client_endpoint
>    assign where host.vars.do_apt
> }

vars.apt_upgrade passes the false argument along to check_apt.

What seems gets executed is:

$ /usr/lib/nagios/plugins/check_apt --upgrade=false
'/usr/bin/apt-get false upgrade' exited with non-zero status.
APT WARNING: 0 packages available for upgrade (0 critical updates). 
warnings detected, errors detected.|available_upgrades=0;;;0 
critical_updates=0;;;0

Prior to 2.13.4 it executed:

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

Because 2.13.4 contains this change:

--- a/itl/command-plugins.conf
+++ b/itl/command-plugins.conf
@@ -1925,10 +1925,12 @@ object CheckCommand "apt" {
                 }
                 "--upgrade" = {
                         value = "$apt_upgrade$"
+                       separator = "="
                         description = "[Default] Perform an upgrade. If 
an optional OPTS argument is provided, apt-get will be run with these 
command line options instead of the default."
                 }
                 "--dist-upgrade" = {
                         value = "$apt_dist_upgrade$"
+                       separator = "="
                         description = "Perform a dist-upgrade instead 
of normal upgrade. Like with -U OPTS can be provided to override the 
default options."
                 }
                 "--include" = {

The description for the check command is not as informative as that of 
check_apt itself:

  -U, --upgrade=OPTS
     [Default] Perform an upgrade.  If an optional OPTS argument is
     provided, apt-get will be run with these command line options
     instead of the default (-o 'Debug::NoLocking=true' -s -qq).
     Note that you may be required to have root privileges if you do not
     use the default options.

vars.apt_upgrade = false might suggests that upgrades are not performed, 
but that's not what the --upgrade option is for. check_apt will show 
which packages will get upgraded if you were to execute `apt-get 
upgrade`, or which will get upgraded if you were to execute `apt-get 
dist-upgrade` when using check_apt --dist-upgrade.

You should remove var.apt_upgrade from your Service configuration.

Can you confirm that resolves this issue?

Kind Regards,

Bas

-- 
  GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



More information about the Pkg-nagios-devel mailing list