summaryrefslogtreecommitdiffstats
path: root/web/attachments/24999-check_snmp.patch.txt
blob: f56dd4907d049c2abe30bf87a6cd2cde43f06174 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
*** 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 <ip_address> -o <OID> [-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 <mibs_list> -H <ip_address> -o <OID> [-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"