summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnagios-check-apt-updates15
1 files changed, 9 insertions, 6 deletions
diff --git a/nagios-check-apt-updates b/nagios-check-apt-updates
index 7bdc718..c1a58cd 100755
--- a/nagios-check-apt-updates
+++ b/nagios-check-apt-updates
@@ -42,12 +42,13 @@ my $UNKNOWN = 3;
$params->{'chroots'} = [];
Getopt::Long::config('bundling');
if (!GetOptions (
- '--help' => \$params->{'help'},
- '--version' => \$params->{'version'},
- '--sudo' => \$params->{'sudo'},
- '--nosudo' => \$params->{'nosudo'},
- '--verbose' => \$params->{'verbose'},
- '--chroot=s' => $params->{'chroots'},
+ '--help' => \$params->{'help'},
+ '--version' => \$params->{'version'},
+ '--sudo' => \$params->{'sudo'},
+ '--nosudo' => \$params->{'nosudo'},
+ '--verbose' => \$params->{'verbose'},
+ '--warnifupdates' => \$params->{'warnifupdates'},
+ '--chroot=s' => $params->{'chroots'},
)) {
die ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--sudo|--nosudo] [--verbose]\n");
};
@@ -59,6 +60,7 @@ if ($params->{'help'}) {
print " --version Report version number.\n";
print " --sudo Use sudo to call apt-get (default).\n";
print " --nosudo Do not use sudo to call apt-get.\n";
+ print " --warnifupdates Exit with a WARNING status if any updates are available.\n";
print " --verbose Be a little verbose.\n";
exit (0);
};
@@ -142,6 +144,7 @@ if (@updates_security) {
};
if (@updates_other) {
$updateinfo .= 'Other Updates ('.(scalar @updates_other).'): '.join(', ', @updates_other)."; ";
+ $exit = $WARNING if $params->{'warnifupdates'};
};
$updateinfo = 'No updates available' unless defined $updateinfo;