From aa337ba13d4f6fc398e38bd1ae8b62b22ec088db Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 4 Apr 2012 01:05:53 +0200 Subject: [PATCH] dsa-check-packages: Ignore :$arch in package names of dpkg -l output Ignore :$arch in package names of dpkg -l output at least for the "primary" arch. Does not really handle multi-arch packages, but it makes things work again for now. --- dsa-nagios-checks/checks/dsa-check-packages | 9 ++++++++- dsa-nagios-checks/debian/changelog | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dsa-nagios-checks/checks/dsa-check-packages b/dsa-nagios-checks/checks/dsa-check-packages index 9a28c5a..107b94b 100755 --- a/dsa-nagios-checks/checks/dsa-check-packages +++ b/dsa-nagios-checks/checks/dsa-check-packages @@ -61,7 +61,13 @@ sub record($) { sub get_packages { $ENV{'COLUMNS'} = 1000; $ENV{'LC_ALL'} = 'C'; - open(F, "dpkg -l|") or die ("Cannot run dpkg: $!\n"); + open(F, "dpkg --print-architecture|") or die ("Cannot run dpkg --print-architecture: $!\n"); + my $arch = ; + chomp($arch); + close(F); + + + open(F, "dpkg -l|") or die ("Cannot run dpkg -l: $!\n"); my @lines = ; close(F); chomp(@lines); @@ -72,6 +78,7 @@ sub get_packages { my %pkgs; for my $line (@lines) { my ($state, $pkg, $version, undef) = split(/ */, $line); + $pkg =~ s/\Q:$arch\E$//; $pkgs{$state}{$pkg} = { 'installed' => $version } } diff --git a/dsa-nagios-checks/debian/changelog b/dsa-nagios-checks/debian/changelog index 114e052..0b215ff 100644 --- a/dsa-nagios-checks/debian/changelog +++ b/dsa-nagios-checks/debian/changelog @@ -12,12 +12,15 @@ dsa-nagios-checks (9X) Xnstable; urgency=low * rename checks/dsa-check-backuppg.conf.sample -> etc/dsa-check-backuppg.conf.sample. * dsa-check-running-kernel: Fix finding meta package for 3.x kernels. + * dsa-check-packages: Ignore :$arch in package names of dpkg -l output, + at least for the "primary" arch. Does not really handle multi-arch + packages, but it makes things work again for now. [ Stephen Gran ] * dsa-check-udldap-freshness: check new last_update.trace if it exists instead of /var/lib/misc/thishost/passwd.{db,tdb}. - -- Peter Palfrader Sun, 18 Mar 2012 20:34:29 +0100 + -- Peter Palfrader Wed, 04 Apr 2012 01:05:01 +0200 dsa-nagios-checks (92.1) unstable; urgency=low -- 2.20.1