diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index 02653933789f4b6f075390f9f2edf219e787ab46..3da54bcfcd03c7623cb4bf67f9ddbe673330dcb0 100644 (file)
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
* Nagios check_apt plugin
*
* License: GPL
-* Copyright (c) 2006-2007 Nagios Plugins Development Team
+* Copyright (c) 2006-2008 Nagios Plugins Development Team
*
* Original author: Sean Finney
*
-* Last Modified: $Date$
-*
* Description:
*
* This file contains the check_apt plugin
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
-* $Id$
-*
*****************************************************************************/
const char *progname = "check_apt";
-const char *revision = "$Revision$";
-const char *copyright = "2006-2007";
+const char *copyright = "2006-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
int main (int argc, char **argv) {
int result=STATE_UNKNOWN, packages_available=0, sec_count=0;
+ /* Parse extra opts if any */
+ argv=np_extra_opts(&argc, argv, progname);
+
if (process_arguments(argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
result = max_state(result, STATE_OK);
}
- printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
+ printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
state_text(result),
packages_available,
(upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade",
print_help();
exit(STATE_OK);
case 'V':
- print_revision(progname, revision);
+ print_revision(progname, NP_VERSION);
exit(STATE_OK);
case 'v':
verbose++;
}
regfree(&ireg);
regfree(&sreg);
- if(do_exclude!=NULL) regfree(&ereg);
+ if(do_exclude!=NULL) regfree(&ereg);
free(cmdline);
return result;
}
sprintf((char*)(re+strlen(re)-2), "|%s) ", next);
}
- return re;
+ return re;
}
char* construct_cmdline(upgrade_type u, const char *opts){
void
print_help (void)
{
- print_revision(progname, revision);
-
+ print_revision(progname, NP_VERSION);
+
printf(_(COPYRIGHT), copyright, email);
-
+
printf("%s\n", _("This plugin checks for software updates on systems that use"));
printf("%s\n", _("package management systems based on the apt-get(8) command"));
printf("%s\n", _("found in Debian GNU/Linux"));
printf ("\n\n");
print_usage();
-
+
printf(_(UT_HELP_VRSN));
-
+ printf(_(UT_EXTRA_OPTS));
+
printf(_(UT_TIMEOUT), timeout_interval);
-
+
printf (" %s\n", "-U, --upgrade=OPTS");
printf (" %s\n", _("[Default] Perform an upgrade. If an optional OPTS argument is provided,"));
printf (" %s\n", _("apt-get will be run with these command line options instead of the"));
printf (" %s\n", _("upgrades for Debian and Ubuntu:"));
printf (" \t\%s\n", SECURITY_RE);
printf (" %s\n", _("Note that the package must first match the include list before its"));
- printf (" %s\n\n\n", _("information is compared against the critical list."));
-
+ printf (" %s\n\n", _("information is compared against the critical list."));
+
printf ("%s\n\n", _("The following options require root privileges and should be used with care:"));
printf (" %s\n", "-u, --update=OPTS");
printf (" %s\n", _("First perform an 'apt-get update'. An optional OPTS parameter overrides"));
printf (" %s\n", _("the default options. Note: you may also need to adjust the global"));
printf (" %s\n", _("timeout (with -t) to prevent the plugin from timing out if apt-get"));
printf (" %s\n", _("upgrade is expected to take longer than the default timeout."));
+
+#ifdef NP_EXTRA_OPTS
+ printf("\n");
+ printf("%s\n", _("Notes:"));
+ printf(_(UT_EXTRA_OPTS_NOTES));
+#endif
+
+ printf(_(UT_SUPPORT));
}
-
+
/* simple usage heading */
void
print_usage(void)