summaryrefslogtreecommitdiffstats
path: root/web/attachments/136758-mmmm
blob: 768eb352ad47aac9da72a41445328b44875e134f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
*** 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);