From 8d46ed7f24c9f893a20508c5ed77a91a610becfb Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 18 Sep 2005 01:13:16 +0000 Subject: Merge in came changes git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@17 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- nagios-check-apt-updates | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/nagios-check-apt-updates b/nagios-check-apt-updates index c1a58cd..4d11215 100755 --- a/nagios-check-apt-updates +++ b/nagios-check-apt-updates @@ -3,7 +3,7 @@ # nagios check for debian (security) updates, # based on net-snmp glue to security updates via apt-get. # Copyright (C) 2004 SILVER SERVER Gmbh -# Copyright (C) 2004 Peter Palfrader +# Copyright (C) 2004, 2005 Peter Palfrader # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ $ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/sbin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; -my $VERSION = '0.0.1'; +my $VERSION = '0.0.3 - $Rev$'; my $APT = '/usr/bin/apt-get'; my $USE_SUDO = 1; my $params; @@ -50,10 +50,10 @@ if (!GetOptions ( '--warnifupdates' => \$params->{'warnifupdates'}, '--chroot=s' => $params->{'chroots'}, )) { - die ("$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--sudo|--nosudo] [--verbose]\n"); + die ("Usage: $PROGRAM_NAME [--help|--version] [--sudo|--nosudo] [--verbose]\n"); }; if ($params->{'help'}) { - print "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--help|--version] [--sudo|--nosudo] [--verbose]\n"; + print "Usage: $PROGRAM_NAME [--help|--version] [--sudo|--nosudo] [--verbose]\n"; print "Reports packages to upgrade, updating the list if necessary.\n"; print "\n"; print " --help Print this short help.\n"; @@ -62,13 +62,21 @@ if ($params->{'help'}) { 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"; + print " --chroot= Run check in path.\n"; + print "\n"; + print "Note that for --sudo (default) you will need entries in /etc/sudoers like these:\n"; + print "nagios ALL=(ALL) NOPASSWD: /usr/bin/apt-get update\n"; + print "nagios ALL=(ALL) NOPASSWD: /usr/bin/apt-get --simulate upgrade\n"; + print "nagios ALL=(ALL) NOPASSWD: /usr/sbin/chroot /chroot-ia32 /usr/bin/apt-get update\n"; + print "nagios ALL=(ALL) NOPASSWD: /usr/sbin/chroot /chroot-ia32 /usr/bin/apt-get --simulate upgrade\n"; + print "\n"; exit (0); }; if ($params->{'version'}) { print "nagios-check-apt-updates $VERSION\n"; print "nagios check for availability of debian (security) updates\n"; print "Copyright (c) 2004 SILVER SERVER Gmbh\n"; - print "Copyright (c) 2004 Peter Palfrader \n"; + print "Copyright (c) 2004,2005 Peter Palfrader \n"; exit (0); }; if ($params->{'sudo'} && $params->{'nosudo'}) { -- cgit v1.2.3