Home Directory Plugins Operating Systems Linux check_ubuntu_packages.patch

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

check_ubuntu_packages.patch

Rating
1 vote
Favoured:
0
Hits
99057
Files:
FileDescription
check_ubuntu_packages.patchPatch
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
A patch to make the check_debian_packages plugin suitable for use with Ubuntu.
This patch should be applied to the check_debian_packages plugin at http://exchange.nagios.org/directory/Plugins/Uncategorized/Operating-Systems/Linux/check-debian-packages/details

- Written by Tony Yarusso
Reviews (1)
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