[Nagiosplug-checkins] CVS: nagiosplug/plugins check_snmp.c,1.3,1.4
Subhendu Ghosh
sghosh at users.sourceforge.net
Wed Jul 31 21:55:01 CEST 2002
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv23783/plugins
Modified Files:
check_snmp.c
Log Message:
port option added, -c support net-snmpv5, complete response string output
Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** check_snmp.c 24 Jun 2002 20:41:25 -0000 1.3
--- check_snmp.c 1 Aug 2002 04:54:18 -0000 1.4
***************
*** 147,152 ****
command_line = ssprintf
(command_line,
! "%s -m ALL -v 1 %s %s %s",
! PATH_TO_SNMPGET, server_address, community, oid);
/* run the command */
--- 147,152 ----
command_line = ssprintf
(command_line,
! "%s -p %s -m ALL -v 1 %s -c %s %s",
! PATH_TO_SNMPGET, port, server_address, community, oid);
/* run the command */
***************
*** 222,226 ****
response_value[i] = strtoul (p2, NULL, 10);
iresult = check_num (i);
! show = ssprintf (show, "%lu", response_value[i]);
}
--- 222,227 ----
response_value[i] = strtoul (p2, NULL, 10);
iresult = check_num (i);
! /*For consistency- full SNMP response every time */
! show = ssprintf (show, "%d", response);
}
***************
*** 261,265 ****
}
! result = max_state (result, iresult);
if (nlabels > 1 && i < nlabels && labels[i] != NULL)
--- 262,266 ----
}
! result = max (result, iresult);
if (nlabels > 1 && i < nlabels && labels[i] != NULL)
***************
*** 292,296 ****
/* WARNING if output found on stderr */
if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
! result = max_state (result, STATE_WARNING);
/* close stderr */
--- 293,297 ----
/* WARNING if output found on stderr */
if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
! result = max (result, STATE_WARNING);
/* close stderr */
***************
*** 299,303 ****
/* close the pipe */
if (spclose (child_process))
! result = max_state (result, STATE_WARNING);
if (nunits > 0)
--- 300,304 ----
/* close the pipe */
if (spclose (child_process))
! result = max (result, STATE_WARNING);
if (nunits > 0)
***************
*** 353,359 ****
port = strscpy(NULL,"161");
- if (port == NULL)
- port = strscpy(NULL,"161");
-
return c;
}
--- 354,357 ----
***************
*** 386,389 ****
--- 384,388 ----
{"label", required_argument, 0, 'l'},
{"units", required_argument, 0, 'u'},
+ {"port", required_argument, 0, 'p'},
{0, 0, 0, 0}
};
***************
*** 393,400 ****
#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
--- 392,399 ----
#ifdef HAVE_GETOPT_H
c =
! getopt_long (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:",
long_options, &option_index);
#else
! c = getopt (argc, argv, "+?hVt:c:w:H:C:o:d:D:s:R:r:l:u:p:");
#endif
***************
*** 577,580 ****
--- 576,583 ----
}
break;
+ case 'p': /* TCP port number */
+ port = strscpy(port, optarg);
+ break;
+
}
}
***************
*** 588,592 ****
("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");
}
--- 591,595 ----
("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] [-p port-number] [-d delimiter] [-D output-delimiter]\n"
" check_snmp --help\n" " check_snmp --version\n");
}
***************
*** 618,622 ****
" Units label(s) for output data (e.g., 'sec.').\n"
" -p, --port=STRING\n"
! " TCP port number target is listening on.\n"
" -d, --delimiter=STRING\n"
" Delimiter to use when parsing returned data. Default is \"%s\"\n"
--- 621,625 ----
" Units label(s) for output data (e.g., 'sec.').\n"
" -p, --port=STRING\n"
! " UDP port number target is listening on.\n"
" -d, --delimiter=STRING\n"
" Delimiter to use when parsing returned data. Default is \"%s\"\n"
More information about the Commits
mailing list