summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe6fd21)
raw | patch | inline | side by side (parent: fe6fd21)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Mon, 11 Nov 2002 16:04:12 +0000 (16:04 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Mon, 11 Nov 2002 16:04:12 +0000 (16:04 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@184 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_snmp.c | patch | blob | history |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 5344b93051461301d68c8c080a6b30c1225f962c..7e574c5fd7b52eee334630997889117f3e1a551c 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
-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] [-p port-number] [-d delimiter]\n\
- [-D output-delimiter]"
+ [-D output-delimiter] [-m miblist]"
#define LONGOPTIONS "\
-H, --hostname=HOST\n\
-l, --label=STRING\n\
Prefix label for output from plugin (default -s 'SNMP')\n\
-v, --verbose\n\
- Debugging the output\n\
-
- "
+ Debugging the output\n\
+ -m, --miblist=STRING\n\
+ List of MIBS to be loaded (default = ALL)\n"
#define NOTES "\
- This plugin uses the 'snmpget' command included with the NET-SNMP package.\n\
#define DEFAULT_COMMUNITY "public"
#define DEFAULT_PORT "161"
#define DEFAULT_TIMEOUT 10
+#define DEFAULT_MIBLIST "ALL"
#include "common.h"
#include "utils.h"
int eval_method[MAX_OIDS];
char *delimiter = NULL;
char *output_delim = NULL;
+char *miblist = NULL;
int
usage ("Incorrect arguments supplied\n");
/* create the command line to execute */
- asprintf (&command_line, "%s -m ALL -v 1 -c %s %s:%s %s",
- PATH_TO_SNMPGET, community, server_address, port, oid);
+ asprintf (&command_line, "%s -m %s -v 1 -c %s %s:%s %s",
+ PATH_TO_SNMPGET, miblist, community, server_address, port, oid);
if (verbose)
printf ("%s\n", command_line);
while (1) {
#ifdef HAVE_GETOPT_H
c =
- getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:",
+ getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:",
long_options, &option_index);
#else
- c = getopt (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:");
+ c = getopt (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:");
#endif
if (c == -1 || c == EOF)
case 'p': /* TCP port number */
port = strscpy(port, optarg);
break;
+ case 'm': /* List of MIBS */
+ miblist = strscpy(miblist, optarg);
+ break;
}
}
if (output_delim == NULL)
asprintf (&output_delim, DEFAULT_OUTPUT_DELIMITER);
+ if (miblist == NULL)
+ asprintf (&miblist, DEFAULT_MIBLIST);
+
if (label == NULL)
asprintf (&label, "SNMP");