*** check_snmp.c.orig Wed Jun 12 20:13:42 2002 --- check_snmp.c Wed Jun 12 20:15:07 2002 *************** int errcode, excode; *** 94,99 **** --- 94,100 ---- char *server_address = NULL; char *community = NULL; + char *mibslist = NULL; char oid[MAX_INPUT_BUFFER] = ""; char *label = NULL; char *units = NULL; *************** main (int argc, char **argv) *** 143,152 **** usage ("Incorrect arguments supplied\n"); /* create the command line to execute */ ! command_line = ssprintf ! (command_line, ! "%s -m ALL -v 1 %s %s %s", ! PATH_TO_SNMPGET, server_address, community, oid); /* run the command */ child_process = spopen (command_line); --- 144,159 ---- usage ("Incorrect arguments supplied\n"); /* create the command line to execute */ ! if (mibslist == NULL) ! command_line = ssprintf ! (command_line, ! "%s -v 1 %s %s %s", ! PATH_TO_SNMPGET, server_address, community, oid); ! else ! command_line = ssprintf ! (command_line, ! "%s -m %s -v 1 %s %s %s", ! PATH_TO_SNMPGET, mibslist, server_address, community, oid); /* run the command */ child_process = spopen (command_line); *************** call_getopt (int argc, char **argv) *** 368,373 **** --- 375,381 ---- {"warning", required_argument, 0, 'w'}, {"hostname", required_argument, 0, 'H'}, {"community", required_argument, 0, 'C'}, + {"mibslist", required_argument, 0, 'm'}, {"oid", required_argument, 0, 'o'}, {"object", required_argument, 0, 'o'}, {"delimiter", required_argument, 0, 'd'}, *************** call_getopt (int argc, char **argv) *** 385,394 **** while (1) { #ifdef HAVE_GETOPT_H c = ! getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:", long_options, &option_index); #else ! c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:"); #endif if (c == -1 || c == EOF) --- 393,402 ---- while (1) { #ifdef HAVE_GETOPT_H c = ! getopt_long (argc, argv, "+?hVt:c:w:H:C:m:o:d:D:s:R:r:l:u:", long_options, &option_index); #else ! c = getopt (argc, argv, "+?hVt:c:w:H:C:m:o:d:D:s:R:r:l:u:"); #endif if (c == -1 || c == EOF) *************** call_getopt (int argc, char **argv) *** 401,406 **** --- 409,415 ---- case 'w': case 'H': case 'C': + case 'm': case 'o': case 'd': case 'D': *************** call_getopt (int argc, char **argv) *** 466,471 **** --- 475,483 ---- case 'C': /* group or community */ community = strscpy (community, optarg); break; + case 'm': /* mibs list */ + mibslist = strscpy (mibslist, optarg); + break; case 'o': /* object identifier */ for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) ptr[0] = ' '; *************** void *** 577,583 **** print_usage (void) { printf ! ("Usage: check_snmp -H -o [-w warn_range] [-c crit_range] \n" " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n" " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n" " check_snmp --help\n" " check_snmp --version\n"); --- 589,595 ---- print_usage (void) { printf ! ("Usage: check_snmp -m -H -o [-w warn_range] [-c crit_range] \n" " [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n" " [-l label] [-u units] [-d delimiter] [-D output-delimiter]\n" " check_snmp --help\n" " check_snmp --version\n"); *************** print_help (char *cmd) *** 595,600 **** --- 607,614 ---- " Print detailed help screen\n" " -V, --version\n" " Print version information\n" + " -m, --mibslist=STRING\n" + " Specify which mibs to use (defaults to default mib list)\n" " -H, --hostname=HOST\n" " Name or IP address of the device you wish to query\n" " -o, --oid=OID(s)\n"