*** check_snmp.c.old Tue May 31 22:09:23 2005 --- check_snmp.c Tue May 31 23:35:45 2005 *************** *** 336,341 **** --- 336,342 ---- i++; + /* I think this declaration here is bad syntax, and compilation fails */ char *str[MAX_INPUT_BUFFER]; asprintf(str, "=%s%s;;;; ", show, type ? type : ""); strcat(perfstr, *str); *************** *** 376,381 **** --- 377,383 ---- char *ptr; int c = 1; int j = 0, jj = 0, ii = 0; + int needmibs = FALSE; int option = 0; static struct option longopts[] = { *************** *** 510,515 **** --- 512,525 ---- retries = atoi(optarg); break; case 'o': /* object identifier */ + if ( strspn( optarg, "0123456789." ) != strlen( optarg ) ) { + /* + * we have something other than digits and periods, so we + * have a mib variable, rather than just an SNMP OID, so + * we have to actually read the mib files + */ + needmibs = TRUE; + } for (ptr = optarg; (ptr = index (ptr, ',')); ptr++) ptr[0] = ' '; /* relpace comma with space */ for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++) *************** *** 628,633 **** --- 638,646 ---- if (community == NULL) community = strdup (DEFAULT_COMMUNITY); + if ( ! needmibs ) + miblist = "''"; /* don't read any MIB files */ + return validate_arguments (); } *************** *** 913,921 **** /* OID Stuff */ printf (_("\ -o, --oid=OID(s)\n\ ! Object identifier(s) whose value you wish to query\n\ -m, --miblist=STRING\n\ ! List of MIBS to be loaded (default = ALL)\n -d, --delimiter=STRING\n\ Delimiter to use when parsing returned data. Default is \"%s\"\n\ Any data on the right hand side of the delimiter is considered\n\ to be the data that should be used in the evaluation.\n"), DEFAULT_DELIMITER); --- 926,937 ---- /* OID Stuff */ printf (_("\ -o, --oid=OID(s)\n\ ! Object identifier(s) or SNMP variables whose value you wish to query\n\ -m, --miblist=STRING\n\ ! List of MIBS to be loaded (default = ALL)\n\ ! Set empty if polling only OIDs, and not SNMP variables\n\ ! (since no MIB files are needed if we already have the OIDs)\n\ ! -d, --delimiter=STRING\n\ Delimiter to use when parsing returned data. Default is \"%s\"\n\ Any data on the right hand side of the delimiter is considered\n\ to be the data that should be used in the evaluation.\n"), DEFAULT_DELIMITER);