|
|
@@ -80,6 +80,8 @@ static char *do_include = NULL; /* regexp to only include certain packages */
|
|
|
static char *do_exclude = NULL; /* regexp to only exclude certain packages */
|
|
|
static char *do_critical = NULL; /* regexp specifying critical packages */
|
|
|
static char *input_filename = NULL; /* input filename for testing */
|
|
|
+/* number of packages available for upgrade to return WARNING status */
|
|
|
+static int packages_warning = 1;
|
|
|
|
|
|
/* other global variables */
|
|
|
static int stderr_warning = 0; /* if a cmd issued output on stderr */
|
|
|
@@ -110,7 +112,7 @@ int main (int argc, char **argv) {
|
|
|
|
|
|
if(sec_count > 0){
|
|
|
result = max_state(result, STATE_CRITICAL);
|
|
|
- } else if(packages_available > 0){
|
|
|
+ } else if(packages_available >= packages_warning){
|
|
|
result = max_state(result, STATE_WARNING);
|
|
|
} else if(result > STATE_UNKNOWN){
|
|
|
result = STATE_UNKNOWN;
|
|
|
@@ -149,11 +151,12 @@ int process_arguments (int argc, char **argv) {
|
|
|
{"exclude", required_argument, 0, 'e'},
|
|
|
{"critical", required_argument, 0, 'c'},
|
|
|
{"input-file", required_argument, 0, INPUT_FILE_OPT},
|
|
|
+ {"packages-warning", required_argument, 0, 'w'},
|
|
|
{0, 0, 0, 0}
|
|
|
};
|
|
|
|
|
|
while(1) {
|
|
|
- c = getopt_long(argc, argv, "hVvt:u::U::d::ni:e:c:", longopts, NULL);
|
|
|
+ c = getopt_long(argc, argv, "hVvt:u::U::d::ni:e:c:w:", longopts, NULL);
|
|
|
|
|
|
if(c == -1 || c == EOF || c == 1) break;
|
|
|
|
|
|
@@ -206,6 +209,9 @@ int process_arguments (int argc, char **argv) {
|
|
|
case INPUT_FILE_OPT:
|
|
|
input_filename = optarg;
|
|
|
break;
|
|
|
+ case 'w':
|
|
|
+ packages_warning = atoi(optarg);
|
|
|
+ break;
|
|
|
default:
|
|
|
/* print short usage statement if args not parsable */
|
|
|
usage5();
|
|
|
@@ -463,7 +469,10 @@ print_help (void)
|
|
|
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", _("information is compared against the critical list."));
|
|
|
+ printf (" %s\n", _("information is compared against the critical list."));
|
|
|
+ printf (" %s\n", "-w, --packages-warning=INTEGER");
|
|
|
+ printf (" %s\n", _("Minumum number of packages available for upgrade to return WARNING status."));
|
|
|
+ printf (" %s\n\n", _("Default is 1 package."));
|
|
|
|
|
|
printf ("%s\n\n", _("The following options require root privileges and should be used with care:"));
|
|
|
printf (" %s\n", "-u, --update=OPTS");
|
|
|
@@ -481,5 +490,5 @@ void
|
|
|
print_usage(void)
|
|
|
{
|
|
|
printf ("%s\n", _("Usage:"));
|
|
|
- printf ("%s [[-d|-u|-U]opts] [-n] [-t timeout]\n", progname);
|
|
|
+ printf ("%s [[-d|-u|-U]opts] [-n] [-l] [-t timeout] [-w packages-warning]\n", progname);
|
|
|
}
|