summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e009c4)
raw | patch | inline | side by side (parent: 9e009c4)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 14 Nov 2002 02:26:34 +0000 (02:26 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 14 Nov 2002 02:26:34 +0000 (02:26 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@191 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 6747fa36110e98f96b4923d7a509ed0df7d31765..23c713a4945fc56381caf569b0d7a7cf21ed1e1b 100644 (file)
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
VPATH = $(top_srcdir) $(top_srcdir)/plugins $(top_srcdir)/plugins/t
-INCLUDES = @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
+INCLUDES = @SSLINCLUDE@
libexec_PROGRAMS = check_disk check_dummy check_http check_load \
check_mrtg check_mrtgtraf check_nwstat check_overcr check_ping \
check_nntp_DEPENDENCIES = check_tcp.c $(NETOBJS) $(DEPLIBS)
check_pop_DEPENDENCIES = check_tcp.c $(NETOBJS) $(DEPLIBS)
+check_mysql_INCLUDES = @MYSQLINCLUDE@
+check_pgsql_INCLUDES = @PGINCLUDE@
+check_ldap_INCLUDES = @LDAPINCLUDE@
+
##############################################################################
# secondary dependencies
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index f9cf28890ed2855548cac095371f1438953e2cc4..714ecab077530ad01e748112cc6d36a213631a35 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
}
/* get the command to run */
- sprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server);
+ asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server);
alarm (timeout_interval);
time (&start_time);
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index d3f061589028957b80c07e0c45f9d4dc2935d310..213dc4a8302b8f6d2b58429b6961db0cbfc71905 100644 (file)
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
#define UNKNOWN -1
int process_arguments (int, char **);
-int call_getopt (int, char **);
int validate_arguments (void);
static void print_help (void);
static void print_usage (void);
{
int c;
- if (argc < 2)
- return ERROR;
-
- for (c = 1; c < argc; c++) {
- if (strcmp ("-to", argv[c]) == 0)
- strcpy (argv[c], "-t");
- }
-
- c = 0;
- while (c += (call_getopt (argc - c, &argv[c]))) {
- if (argc <= c)
- break;
- if (ld_host[0] == 0) {
- strncpy (ld_host, argv[c], sizeof (ld_host) - 1);
- ld_host[sizeof (ld_host) - 1] = 0;
- }
- }
-
- return c;
-}
-
-int
-call_getopt (int argc, char **argv)
-{
- int c, i = 1;
#ifdef HAVE_GETOPT_H
int option_index = 0;
/* initialize the long option struct */
- static struct option long_options[] = {
+ static struct option longopts[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"timeout", required_argument, 0, 't'},
};
#endif
- for (c = 1; c < argc; c++)
+ if (argc < 2)
+ return ERROR;
+
+ for (c = 1; c < argc; c++) {
if (strcmp ("-to", argv[c]) == 0)
strcpy (argv[c], "-t");
+ }
while (1) {
#ifdef HAVE_GETOPT_H
- c =
- getopt_long (argc, argv, "+hVt:c:w:H:b:p:a:D:P:", long_options,
- &option_index);
+ c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index);
#else
c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:");
#endif
if (c == -1 || c == EOF)
break;
- i++;
- switch (c) {
- case 't':
- case 'c':
- case 'w':
- case 'H':
- case 'b':
- case 'p':
- case 'a':
- case 'D':
- case 'P':
- i++;
- }
-
switch (c) {
case 'h': /* help */
print_help ();
break;
}
}
- return i;
+
+ if (ld_host[0] == 0) {
+ asprintf (&ld_host, "%s", argv[c]);
+ }
+
+ return validate_arguments ();
}
int
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 4d297aaa1f70f20293c1bff3da26e3b6fd912e65..80c9b00894bd2b0766aad18214a11ed5482bf64d 100644 (file)
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
value_warning_threshold = strtoul (argv[c++], NULL, 10);
}
- if (vargc > c && alue_critical_threshold == 0) {
+ if (argc > c && value_critical_threshold == 0) {
value_critical_threshold = strtoul (argv[c++], NULL, 10);
}
index 11f5146b86a484d51f8746051b04cf9de908a710..d33ebd9ce17a100ac045d9ecc738fd6f0067bb7b 100644 (file)
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
#define PROGNAME "check_mrtgtraf"
int process_arguments (int, char **);
-int call_getopt (int, char **);
int validate_arguments (void);
void print_help (void);
void print_usage (void);
char input_buffer[MAX_INPUT_BUFFER];
char *temp_buffer;
time_t current_time;
- char error_message[MAX_INPUT_BUFFER];
+ char *error_message;
time_t timestamp = 0L;
unsigned long average_incoming_rate = 0L;
unsigned long average_outgoing_rate = 0L;
if (incoming_rate > incoming_critical_threshold
|| outgoing_rate > outgoing_critical_threshold) {
result = STATE_CRITICAL;
- sprintf (error_message, "%s. In = %0.1f %s, %s. Out = %0.1f %s",
+ asprintf (&error_message, "%s. In = %0.1f %s, %s. Out = %0.1f %s",
(use_average == TRUE) ? "Ave" : "Max", adjusted_incoming_rate,
incoming_speed_rating, (use_average == TRUE) ? "Ave" : "Max",
adjusted_outgoing_rate, outgoing_speed_rating);
else if (incoming_rate > incoming_warning_threshold
|| outgoing_rate > outgoing_warning_threshold) {
result = STATE_WARNING;
- sprintf (error_message, "%s. In = %0.1f %s, %s. Out = %0.1f %s",
+ asprintf (&error_message, "%s. In = %0.1f %s, %s. Out = %0.1f %s",
(use_average == TRUE) ? "Ave" : "Max", adjusted_incoming_rate,
incoming_speed_rating, (use_average == TRUE) ? "Ave" : "Max",
adjusted_outgoing_rate, outgoing_speed_rating);
{
int c;
- if (argc < 2)
- return ERROR;
-
- for (c = 1; c < argc; c++) {
- if (strcmp ("-to", argv[c]) == 0)
- strcpy (argv[c], "-t");
- else if (strcmp ("-wt", argv[c]) == 0)
- strcpy (argv[c], "-w");
- else if (strcmp ("-ct", argv[c]) == 0)
- strcpy (argv[c], "-c");
- }
-
-
-
- c = 0;
- while ((c += (call_getopt (argc - c, &argv[c]))) < argc) {
-
- if (is_option (argv[c]))
- continue;
-
- if (log_file == NULL) {
- log_file = argv[c];
- }
- else if (expire_minutes == -1) {
- expire_minutes = atoi (optarg);
- }
- else if (strcmp (argv[c], "MAX") == 0) {
- use_average = FALSE;
- }
- else if (strcmp (argv[c], "AVG") == 0) {
- use_average = TRUE;
- }
- else if (incoming_warning_threshold == 0) {
- incoming_warning_threshold = strtoul (argv[c], NULL, 10);
- }
- else if (incoming_critical_threshold == 0) {
- incoming_critical_threshold = strtoul (argv[c], NULL, 10);
- }
- else if (outgoing_warning_threshold == 0) {
- outgoing_warning_threshold = strtoul (argv[c], NULL, 10);
- }
- else if (outgoing_critical_threshold == 0) {
- outgoing_critical_threshold = strtoul (argv[c], NULL, 10);
- }
- }
-
- return validate_arguments ();
-}
-
-
-
-
-
-
-int
-call_getopt (int argc, char **argv)
-{
- int c, i = 0;
-
#ifdef HAVE_GETOPT_H
int option_index = 0;
- static struct option long_options[] = {
+ static struct option longopts[] = {
{"logfile", required_argument, 0, 'F'},
{"expires", required_argument, 0, 'e'},
{"aggregation", required_argument, 0, 'a'},
};
#endif
+ if (argc < 2)
+ return ERROR;
+
+ for (c = 1; c < argc; c++) {
+ if (strcmp ("-to", argv[c]) == 0)
+ strcpy (argv[c], "-t");
+ else if (strcmp ("-wt", argv[c]) == 0)
+ strcpy (argv[c], "-w");
+ else if (strcmp ("-ct", argv[c]) == 0)
+ strcpy (argv[c], "-c");
+ }
+
while (1) {
#ifdef HAVE_GETOPT_H
- c =
- getopt_long (argc, argv, "+hVF:e:a:c:w:", long_options, &option_index);
+ c = getopt_long (argc, argv, "hVF:e:a:c:w:", longopts, &option_index);
#else
- c = getopt (argc, argv, "+hVF:e:a:c:w:");
+ c = getopt (argc, argv, "hVF:e:a:c:w:");
#endif
- i++;
-
- if (c == -1 || c == EOF || c == 1)
+ if (c == -1 || c == EOF)
break;
- switch (c) {
- case 'F':
- case 'e':
- case 'a':
- case 'c':
- case 'w':
- i++;
- }
-
switch (c) {
case 'F': /* input file */
log_file = optarg;
usage ("Invalid argument\n");
}
}
- return i;
+
+ c = optind;
+ if (argc > c && log_file == NULL) {
+ log_file = argv[c++];
+ }
+
+ if (argc > c && expire_minutes == -1) {
+ expire_minutes = atoi (argv[c++]);
+ }
+
+ if (argc > c && strcmp (argv[c], "MAX") == 0) {
+ use_average = FALSE;
+ c++;
+ }
+ else if (argc > c && strcmp (argv[c], "AVG") == 0) {
+ use_average = TRUE;
+ c++;
+ }
+
+ if (argc > c && incoming_warning_threshold == 0) {
+ incoming_warning_threshold = strtoul (argv[c++], NULL, 10);
+ }
+
+ if (argc > c && incoming_critical_threshold == 0) {
+ incoming_critical_threshold = strtoul (argv[c++], NULL, 10);
+ }
+
+ if (argc > c && outgoing_warning_threshold == 0) {
+ outgoing_warning_threshold = strtoul (argv[c++], NULL, 10);
+ }
+
+ if (argc > c && outgoing_critical_threshold == 0) {
+ outgoing_critical_threshold = strtoul (argv[c++], NULL, 10);
+ }
+
+ return validate_arguments ();
}
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index f8fca736d179207fecc57dacd614773674232ac2..53deef879c1b2a8a4af2f0141be1f6935b429b28 100644 (file)
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
result=STATE_CRITICAL;
else if(check_warning_value==TRUE && lru_time <= warning_value)
result=STATE_WARNING;
- sprintf(&output_message,"LRU sitting time = %lu minutes",lru_time);
+ asprintf(&output_message,"LRU sitting time = %lu minutes",lru_time);
/* check KB free space on volume */
max_service_processes=atoi(recv_buffer);
- sprintf(&send_buffer,"S21\r\n");
+ asprintf(&send_buffer,"S21\r\n");
result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
if(result!=STATE_OK)
return result;
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index 614d467bc520b1d94e594d3663510734935436ba..c346dc77d43de39a3bfb7dabf1dd9550be4d0c23 100644 (file)
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
Number of times to retry a failed connection\n\
-t, --timeout=INTEGER\n\
Seconds before connection times out (default: %d)\n\
- -v\n\
+ -v, --verbose\n\
Show details for command-line debugging (do not use with nagios server)\n\
-h, --help\n\
Print detailed help screen\n\
Print version information\n"
#define DESCRIPTION "\
-The password option presents a substantial security issue because the
-password can be determined by careful watching of the command line in
-a process listing. This risk is exacerbated because nagios will
-run the plugin at regular prdictable intervals. Please be sure that
-the password used does not allow access to sensitive system resources,
+This plugin tests a radius server to see if it is accepting connections.\n\
+\n\
+The server to test must be specified in the invocation, as well as a user\n\
+name and password. A configuration file may also be present. The format of\n\
+the configuration file is described in the radiusclient library sources.\n\
+\n\
+The password option presents a substantial security issue because the\n\
+password can be determined by careful watching of the command line in\n\
+a process listing. This risk is exacerbated because nagios will\n\
+run the plugin at regular prdictable intervals. Please be sure that\n\
+the password used does not allow access to sensitive system resources,\n\
otherwise compormise could occur.\n"
#include "config.h"
<sect2>
<title>Future Enhancements</title>
-<para>ToDo List</para>
+<para>Todo List</para>
<itemizedlist>
<listitem>Add option to get password from a secured file rather than the command line</listitem>
</itemizedlist>
diff --git a/plugins/utils.c b/plugins/utils.c
index 5dc6cfdbc5502dc4a6e8f31bb0e0feea20e4f51b..bf6af8851c29d617dc1c1a873c36b6d29c9e5cc3 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
void strip (char *);
char *strscpy (char *dest, const char *src);
-char *strscat (char *dest, const char *src);
+char *strscat (char *dest, char *src);
char *strnl (char *str);
char *strpcpy (char *dest, const char *src, const char *str);
char *strpcat (char *dest, const char *src, const char *str);
*****************************************************************************/
char *
-strscat (char *dest, const char *src)
+strscat (char *dest, char *src)
{
if (dest == NULL)
diff --git a/plugins/version.h.in b/plugins/version.h.in
index e41aaee0d67bbb8f4372097925d8b23bf515840a..6fd1e10757792a297619cc66b8b3548dfff4ca5e 100644 (file)
--- a/plugins/version.h.in
+++ b/plugins/version.h.in
-#define PACKAGE_VERSION "1.3.0-alpha1"
#define CVS_DATE "$Date$"