summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: 3f520e5)
raw | patch | inline | side by side (from parent 1: 3f520e5)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 1 Jun 2005 19:41:01 +0000 (19:41 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 1 Jun 2005 19:41:01 +0000 (19:41 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1187 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 728d692ac19a9e1b15adfcb1e90f4468722c69f8..97c86a3a5b07d74cbc8435bf304706c7e501c537 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
unsigned long eval_method[MAX_OIDS];
char *delimiter;
char *output_delim;
-char *miblist;
+char *miblist = NULL;
+int needmibs = FALSE;
+
int
main (int argc, char **argv)
output = strdup ("");
delimiter = strdup (" = ");
output_delim = strdup (DEFAULT_OUTPUT_DELIMITER);
- miblist = strdup (DEFAULT_MIBLIST);
+ /* miblist = strdup (DEFAULT_MIBLIST); */
timeout_interval = DEFAULT_TIMEOUT;
retries = DEFAULT_RETRIES;
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++)
if (community == NULL)
community = strdup (DEFAULT_COMMUNITY);
+
+
return validate_arguments ();
}
<para>&PROTO_validate_arguments;</para>
-<para>Given a database name, this function returns TRUE if the string
-is a valid PostgreSQL database name, and returns false if it is
-not.</para>
+<para>Checks to see if the default miblist needs to be loaded. Also verifies
+the authentication and authorization combinations based on protocol version
+selected.</para>
-<para>Valid PostgreSQL database names are less than &NAMEDATALEN;
-characters long and consist of letters, numbers, and underscores. The
-first character cannot be a number, however.</para>
+<para></para>
</sect3>
-@@
int
validate_arguments ()
{
+ /* check whether to load locally installed MIBS (CPU/disk intensive) */
+ if (miblist == NULL) {
+ if ( needmibs == TRUE ) {
+ miblist = strdup (DEFAULT_MIBLIST);
+ }else{
+ miblist = "''"; /* don't read any mib files for numeric oids */
+ }
+ }
+
/* Need better checks to verify seclevel and authproto choices */
/* OID Stuff */
printf (_("\
-o, --oid=OID(s)\n\
- Object identifier(s) whose value you wish to query\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 -d, --delimiter=STRING\n\
+ List of MIBS to be loaded (default = none if using numeric oids or 'ALL'\n\
+ for symbolic 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);