Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

jorgegv

Reviews(1)
byjorgegv, November 9, 2017
Patch:
--- check_debian_packages 2017-11-09 13:17:39.528526651 +0100
+++ check_ubuntu_packages 2017-11-09 13:27:51.926197425 +0100
@@ -109,7 +109,7 @@
sub run_apt {
my ($pkg,$ver,$type,$release);
open APT,"$CMD_APT 2>&1|" or exit_unknown($!);
- my (%stable,%security,%other);
+ my (%updates,%backports,%security,%other);
while () {
print "APT: $_" if $DEBUG;
exit_unknown($_) if /(Could not open lock file)|(Could not get lock)/;
@@ -117,12 +117,16 @@
($pkg,$ver,$release) = /Inst (.*?) .*\((.*?) (.*?)\)/;
print "$_\npkg=$pkg ver=$ver release=$release\n" if $DEBUG;
die "$_\n" unless defined $release;
- $release = 'stable'
- if $release =~ /stable$/ && $release !~/security/i;
+ $release = 'updates'
+ if $release =~ /updates/;
+ $release = 'backports'
+ if $release =~ /backports/;
$release = 'security'
if $release =~ /security/i;
- if ($release eq 'stable') {
- $stable{$pkg} = $ver;
+ if ($release eq 'updates') {
+ $updates{$pkg} = $ver;
+ } elsif ($release eq 'backports') {
+ $backports{$pkg} = $ver;
} elsif ($release eq 'security') {
$security{$pkg} = $ver;
} else {
@@ -134,9 +138,10 @@
if (keys (%security)) {
$RET = 'CRITICAL';
add_info(\$info,'security',\%security);
- } elsif (keys (%other) or keys(%stable)) {
- $RET = 'WARNING';
- add_info(\$info,'stable',\%stable);
+ } elsif (keys (%other) or keys(%updates)) {
+ $RET = 'WARNING';
+ add_info(\$info,'updates',\%updates);
+ add_info(\$info,'backports',\%backports) if keys %backports;
add_info(\$info,'other',\%other) if keys %other;
}
print "$RET: $info\n";

HOW TO PATCH:
- Save the previous diff to file check_ubuntu_packages.patch
- Put check_debian_packages in the same directory as this patch
- Execute:
patch check_debian_packages check_ubuntu_packages.patch -o check_ubuntu_packages