merge with upstream 1.4.3

This commit is contained in:
Sean Finney 2006-05-18 17:40:55 +00:00
parent f38b2e70c9
commit d9bacc718a
14 changed files with 31 additions and 1140 deletions

22
debian/changelog vendored
View file

@ -1,8 +1,24 @@
nagios-plugins (1.4.2-8) UNRELEASED; urgency=low
nagios-plugins (1.4.3-1) unstable; urgency=low
* NOT RELEASED YET
* new upstream release.
-- sean finney <seanius@debian.org> Sat, 18 Feb 2006 14:13:12 +0100
[sean finney]
* the following dpatches have been incorporated upstream and thus removed:
- 11_check_ups.c_perfdata_fix.dpatch
- 12_check_mysql.c_mysql_options.dpatch
- 15_check_mrtg_wtf_conditionals.dpatch
- 16_check_smtp_protocolfix.dpatch
- 17_check_smb_freespace.dpatch
- 19_check_disk_subdirs.dpatch
- 20_check_ntp_lessbeastlyregex.dpatch
- 21_de.po_fixes.dpatch
- 24_check_procs_localefix.dpatch
* the following dpatches have been modified to still apply against upstream
- 10_config.h_debiandefaults.dpatch
- 14_check_log_paths.dpatch
- 18_check_game_cmdline.dpatch
-- sean finney <seanius@debian.org> Thu, 18 May 2006 12:33:11 -0500
nagios-plugins (1.4.2-7) unstable; urgency=medium

View file

@ -1,16 +1,7 @@
06_checkircd
10_config.h_debiandefaults.dpatch
11_check_ups.c_perfdata_fix.dpatch
12_check_mysql.c_mysql_options.dpatch
13_subst.in_again.dpatch
14_check_log_paths.dpatch
15_check_mrtg_wtf_conditionals.dpatch
16_check_smtp_protocolfix.dpatch
17_check_smb_freespace.dpatch
18_check_game_cmdline.dpatch
19_check_disk_subdirs.dpatch
20_check_ntp_lessbeastlyregex.dpatch
21_de.po_fixes.dpatch
22_check_smb_hostaddress.dpatch
23_check_axis.dpatch
24_check_procs_localefix.dpatch

View file

@ -17,81 +17,6 @@ diff -urNad nagios-plugins-1.4.2~/configure nagios-plugins-1.4.2/configure
LDFLAGS="$LDFLAGS -L."
@@ -14743,72 +14743,10 @@
fi
fi
-# Extract the first word of "nslookup", so it can be a program name with args.
-set dummy nslookup; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_PATH_TO_NSLOOKUP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- case $PATH_TO_NSLOOKUP in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PATH_TO_NSLOOKUP="$PATH_TO_NSLOOKUP" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_PATH_TO_NSLOOKUP="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- ;;
-esac
-fi
-PATH_TO_NSLOOKUP=$ac_cv_path_PATH_TO_NSLOOKUP
-
-if test -n "$PATH_TO_NSLOOKUP"; then
- echo "$as_me:$LINENO: result: $PATH_TO_NSLOOKUP" >&5
-echo "${ECHO_T}$PATH_TO_NSLOOKUP" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-
-echo "$as_me:$LINENO: checking for nslookup syntax" >&5
-echo $ECHO_N "checking for nslookup syntax... $ECHO_C" >&6
-if test -n "$PATH_TO_NSLOOKUP"
-then
- if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep "Invalid option: sil" >/dev/null
- then
- ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
- echo "$as_me:$LINENO: result: $ac_cv_nslookup_command" >&5
-echo "${ECHO_T}$ac_cv_nslookup_command" >&6
-
- else
- ac_cv_nslookup_command="$PATH_TO_NSLOOKUP -sil"
- echo "$as_me:$LINENO: result: $ac_cv_nslookup_command" >&5
-echo "${ECHO_T}$ac_cv_nslookup_command" >&6
-
- fi
- EXTRAS="$EXTRAS check_dns"
-
-else
- { echo "$as_me:$LINENO: WARNING: nslookup command not found" >&5
-echo "$as_me: WARNING: nslookup command not found" >&2;}
-fi
-
+EXTRAS="$EXTRAS check_dns"
cat >>confdefs.h <<_ACEOF
-#define NSLOOKUP_COMMAND "$ac_cv_nslookup_command"
+#define NSLOOKUP_COMMAND "$NSLOOKUP_COMMAND"
_ACEOF
diff -urNad nagios-plugins-1.4.2~/np-debian.h nagios-plugins-1.4.2/np-debian.h
--- nagios-plugins-1.4.2~/np-debian.h 1970-01-01 01:00:00.000000000 +0100
+++ nagios-plugins-1.4.2/np-debian.h 2006-01-23 18:24:07.000000000 +0100
@ -125,7 +50,7 @@ diff -urNad nagios-plugins-1.4.2~/plugins/common.h nagios-plugins-1.4.2/plugins/
--- nagios-plugins-1.4.2~/plugins/common.h 2004-12-10 01:13:43.000000000 +0100
+++ nagios-plugins-1.4.2/plugins/common.h 2006-01-23 18:24:07.000000000 +0100
@@ -33,6 +33,7 @@
*****************************************************************************/
#define _COMMON_H_
#include "config.h"
+#include "np-debian.h"

View file

@ -1,47 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 11_check_ups.c_perfdata_fix.dpatch by <seanius@localhost.localdomain>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad sid~/plugins/check_ups.c sid/plugins/check_ups.c
--- sid~/plugins/check_ups.c 2005-03-04 22:58:40.000000000 +0100
+++ sid/plugins/check_ups.c 2005-10-06 14:43:10.000000000 +0200
@@ -98,6 +98,7 @@
int result = STATE_UNKNOWN;
char *message;
char *data;
+ char *tunits;
char temp_buffer[MAX_INPUT_BUFFER];
double ups_utility_deviation = 0.0;
int res;
@@ -281,10 +282,12 @@
else {
supported_options |= UPS_TEMP;
if (temp_output_c) {
+ tunits="degC";
ups_temperature = atof (temp_buffer);
asprintf (&message, "%sTemp=%3.1fC", message, ups_temperature);
}
else {
+ tunits="degF";
ups_temperature = (atof (temp_buffer) * 1.8) + 32;
asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature);
}
@@ -297,13 +300,13 @@
result = max_state (result, STATE_WARNING);
}
asprintf (&data, "%s %s", data,
- perfdata ("temp", (long)ups_temperature, "degF",
+ perfdata ("temp", (long)ups_temperature, tunits,
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
TRUE, 0, FALSE, 0));
} else {
asprintf (&data, "%s %s", data,
- perfdata ("temp", (long)ups_temperature, "degF",
+ perfdata ("temp", (long)ups_temperature, tunits,
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
}
}

View file

@ -1,356 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 12_check_mysql.c_mysql_options.dpatch by <seanius@localhost.localdomain>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad sid2~/plugins/check_mysql.c sid2/plugins/check_mysql.c
--- sid2~/plugins/check_mysql.c 2005-05-26 04:13:19.000000000 +0200
+++ sid2/plugins/check_mysql.c 2005-10-07 22:23:07.000000000 +0200
@@ -65,6 +65,8 @@
/* initialize mysql */
mysql_init (&mysql);
+ mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"client");
+
/* establish a connection to the server and error checking */
if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,NULL,0)) {
if (mysql_errno (&mysql) == CR_UNKNOWN_HOST)
diff -urNad sid2~/plugins/check_mysql.c.orig sid2/plugins/check_mysql.c.orig
--- sid2~/plugins/check_mysql.c.orig 1970-01-01 01:00:00.000000000 +0100
+++ sid2/plugins/check_mysql.c.orig 2005-05-26 04:13:19.000000000 +0200
@@ -0,0 +1,333 @@
+/******************************************************************************
+*
+* CHECK_MYSQL.C
+*
+* Program: Mysql plugin for Nagios
+* License: GPL
+* Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)
+* portions (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
+*
+* $Id$
+*
+* Description:
+*
+* This plugin is for testing a mysql server.
+******************************************************************************/
+
+const char *progname = "check_mysql";
+const char *revision = "$Revision$";
+const char *copyright = "1999-2004";
+const char *email = "nagiosplug-devel@lists.sourceforge.net";
+
+#define SLAVERESULTSIZE 40
+
+#include "common.h"
+#include "utils.h"
+#include "netutils.h"
+
+#include <mysql/mysql.h>
+#include <mysql/errmsg.h>
+
+char *db_user = NULL;
+char *db_host = NULL;
+char *db_pass = NULL;
+char *db = NULL;
+unsigned int db_port = MYSQL_PORT;
+int check_slave = 0;
+
+int process_arguments (int, char **);
+int validate_arguments (void);
+void print_help (void);
+void print_usage (void);
+
+
+
+int
+main (int argc, char **argv)
+{
+
+ MYSQL mysql;
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+
+ /* should be status */
+
+ char *result = NULL;
+ char slaveresult[SLAVERESULTSIZE];
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ if (process_arguments (argc, argv) == ERROR)
+ usage4 (_("Could not parse arguments"));
+
+ /* initialize mysql */
+ mysql_init (&mysql);
+
+ /* establish a connection to the server and error checking */
+ if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,NULL,0)) {
+ if (mysql_errno (&mysql) == CR_UNKNOWN_HOST)
+ die (STATE_WARNING, "%s\n", mysql_error (&mysql));
+ else if (mysql_errno (&mysql) == CR_VERSION_ERROR)
+ die (STATE_WARNING, "%s\n", mysql_error (&mysql));
+ else if (mysql_errno (&mysql) == CR_OUT_OF_MEMORY)
+ die (STATE_WARNING, "%s\n", mysql_error (&mysql));
+ else if (mysql_errno (&mysql) == CR_IPSOCK_ERROR)
+ die (STATE_WARNING, "%s\n", mysql_error (&mysql));
+ else if (mysql_errno (&mysql) == CR_SOCKET_CREATE_ERROR)
+ die (STATE_WARNING, "%s\n", mysql_error (&mysql));
+ else
+ die (STATE_CRITICAL, "%s\n", mysql_error (&mysql));
+ }
+
+ /* get the server stats */
+ result = strdup (mysql_stat (&mysql));
+
+ /* error checking once more */
+ if (mysql_error (&mysql)) {
+ if (mysql_errno (&mysql) == CR_SERVER_GONE_ERROR)
+ die (STATE_CRITICAL, "%s\n", mysql_error (&mysql));
+ else if (mysql_errno (&mysql) == CR_SERVER_LOST)
+ die (STATE_CRITICAL, "%s\n", mysql_error (&mysql));
+ else if (mysql_errno (&mysql) == CR_UNKNOWN_ERROR)
+ die (STATE_CRITICAL, "%s\n", mysql_error (&mysql));
+ }
+
+ if(check_slave) {
+ /* check the slave status */
+ if (mysql_query (&mysql, "show slave status") != 0) {
+ mysql_close (&mysql);
+ die (STATE_CRITICAL, _("slave query error: %s\n"), mysql_error (&mysql));
+ }
+
+ /* store the result */
+ if ( (res = mysql_store_result (&mysql)) == NULL) {
+ mysql_close (&mysql);
+ die (STATE_CRITICAL, _("slave store_result error: %s\n"), mysql_error (&mysql));
+ }
+
+ /* fetch the first row */
+ if ( (row = mysql_fetch_row (res)) == NULL) {
+ mysql_free_result (res);
+ mysql_close (&mysql);
+ die (STATE_CRITICAL, _("slave fetch row error: %s\n"), mysql_error (&mysql));
+ }
+
+ if (mysql_field_count (&mysql) == 12) {
+ /* mysql 3.23.x */
+ snprintf (slaveresult, SLAVERESULTSIZE, _("Slave running: %s"), row[6]);
+ if (strcmp (row[6], "Yes") != 0) {
+ mysql_free_result (res);
+ mysql_close (&mysql);
+ die (STATE_CRITICAL, "%s\n", slaveresult);
+ }
+
+ } else {
+ /* mysql 4.x.x */
+ int slave_io_field = -1 , slave_sql_field = -1, i, num_fields;
+ MYSQL_FIELD* fields;
+
+ num_fields = mysql_num_fields(res);
+ fields = mysql_fetch_fields(res);
+ for(i = 0; i < num_fields; i++)
+ {
+ if (0 == strcmp(fields[i].name, "Slave_IO_Running"))
+ {
+ slave_io_field = i;
+ continue;
+ }
+ if (0 == strcmp(fields[i].name, "Slave_SQL_Running"))
+ {
+ slave_sql_field = i;
+ continue;
+ }
+ }
+ if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0))
+ {
+ mysql_free_result (res);
+ mysql_close (&mysql);
+ die (STATE_CRITICAL, "Slave status unavailable\n");
+ }
+
+ snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[slave_io_field], row[slave_sql_field]);
+ if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
+ mysql_free_result (res);
+ mysql_close (&mysql);
+ die (STATE_CRITICAL, "%s\n", slaveresult);
+ }
+ }
+
+ /* free the result */
+ mysql_free_result (res);
+ }
+
+ /* close the connection */
+ mysql_close (&mysql);
+
+ /* print out the result of stats */
+ if (check_slave) {
+ printf ("%s %s\n", result, slaveresult);
+ } else {
+ printf ("%s\n", result);
+ }
+
+ return STATE_OK;
+}
+
+
+/* process command-line arguments */
+int
+process_arguments (int argc, char **argv)
+{
+ int c;
+
+ int option = 0;
+ static struct option longopts[] = {
+ {"hostname", required_argument, 0, 'H'},
+ {"database", required_argument, 0, 'd'},
+ {"username", required_argument, 0, 'u'},
+ {"password", required_argument, 0, 'p'},
+ {"port", required_argument, 0, 'P'},
+ {"check-slave", no_argument, 0, 'S'},
+ {"verbose", no_argument, 0, 'v'},
+ {"version", no_argument, 0, 'V'},
+ {"help", no_argument, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ if (argc < 1)
+ return ERROR;
+
+ while (1) {
+ c = getopt_long (argc, argv, "hVSP:p:u:d:H:", longopts, &option);
+
+ if (c == -1 || c == EOF)
+ break;
+
+ switch (c) {
+ case 'H': /* hostname */
+ if (is_host (optarg)) {
+ db_host = optarg;
+ }
+ else {
+ usage2 (_("Invalid hostname/address"), optarg);
+ }
+ break;
+ case 'd': /* hostname */
+ db = optarg;
+ break;
+ case 'u': /* username */
+ db_user = optarg;
+ break;
+ case 'p': /* authentication information: password */
+ db_pass = optarg;
+ break;
+ case 'P': /* critical time threshold */
+ db_port = atoi (optarg);
+ break;
+ case 'S':
+ check_slave = 1; /* check-slave */
+ break;
+ case 'V': /* version */
+ print_revision (progname, revision);
+ exit (STATE_OK);
+ case 'h': /* help */
+ print_help ();
+ exit (STATE_OK);
+ case '?': /* help */
+ usage2 (_("Unknown argument"), optarg);
+ }
+ }
+
+ c = optind;
+
+ while ( argc > c ) {
+
+ if (strlen(db_host) == 0)
+ if (is_host (argv[c])) {
+ db_host = argv[c++];
+ }
+ else {
+ usage2 (_("Invalid hostname/address"), optarg);
+ }
+ else if (strlen(db_user) == 0)
+ db_user = argv[c++];
+ else if (strlen(db_pass) == 0)
+ db_pass = argv[c++];
+ else if (strlen(db) == 0)
+ db = argv[c++];
+ else if (is_intnonneg (argv[c]))
+ db_port = atoi (argv[c++]);
+ else
+ break;
+ }
+
+ return validate_arguments ();
+}
+
+
+int
+validate_arguments (void)
+{
+ if (db_user == NULL)
+ db_user = strdup("");
+
+ if (db_host == NULL)
+ db_host = strdup("");
+
+ if (db_pass == NULL)
+ db_pass == strdup("");
+
+ if (db == NULL)
+ db = strdup("");
+
+ return OK;
+}
+
+
+void
+print_help (void)
+{
+ char *myport;
+ asprintf (&myport, "%d", MYSQL_PORT);
+
+ print_revision (progname, revision);
+
+ printf (_(COPYRIGHT), copyright, email);
+
+ printf (_("This program tests connections to a mysql server\n"));
+
+ print_usage ();
+
+ printf (_(UT_HELP_VRSN));
+
+ printf (_(UT_HOST_PORT), 'P', myport);
+
+ printf (_("\
+ -d, --database=STRING\n\
+ Check database with indicated name\n\
+ -u, --username=STRING\n\
+ Connect using the indicated username\n\
+ -p, --password=STRING\n\
+ Use the indicated password to authenticate the connection\n\
+ ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n\
+ Your clear-text password will be visible as a process table entry\n\
+ -S, --check-slave\n\
+ Check if the slave thread is running properly.\n"));
+
+ printf (_("\n\
+There are no required arguments. By default, the local database with\n\
+a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT);
+
+ printf (_(UT_SUPPORT));
+}
+
+
+void
+print_usage (void)
+{
+ printf ("\
+Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password] [-S]\n",
+ progname);
+}

View file

@ -8,19 +8,21 @@
diff -urNad nagios-plugins~/plugins-scripts/check_log.sh nagios-plugins/plugins-scripts/check_log.sh
--- nagios-plugins~/plugins-scripts/check_log.sh 2005-02-04 00:51:35.000000000 +0100
+++ nagios-plugins/plugins-scripts/check_log.sh 2005-10-09 17:29:46.000000000 +0200
@@ -62,12 +62,12 @@
@@ -62,14 +62,14 @@
ECHO="/bin/echo"
GREP="/bin/grep"
GREP="/bin/egrep"
-DIFF="/bin/diff"
-TAIL="/bin/tail"
+DIFF="/usr/bin/diff"
+TAIL="/usr/bin/tail"
CAT="/bin/cat"
RM="/bin/rm"
CHMOD="/bin/chmod"
TOUCH="/bin/touch"
-PROGNAME=`/bin/basename $0`
+PROGNAME=`/usr/bin/basename $0`
PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision$' | /bin/sed -e 's/[^0-9.]//g'`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision$' | sed -e 's/[^0-9.]//g'`

View file

@ -1,92 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14_check_log_paths.dpatch by <seanius@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins/check_mrtg.c nagios-plugins/plugins/check_mrtg.c
--- nagios-plugins~/plugins/check_mrtg.c 2004-12-26 00:17:44.000000000 +0100
+++ nagios-plugins/plugins/check_mrtg.c 2005-10-26 23:15:37.000000000 +0200
@@ -43,13 +43,12 @@
int
main (int argc, char **argv)
{
- int result = STATE_UNKNOWN;
+ int result = STATE_OK;
FILE *fp;
int line;
char input_buffer[MAX_INPUT_BUFFER];
char *temp_buffer;
time_t current_time;
- char* message;
time_t timestamp = 0L;
unsigned long average_value_rate = 0L;
unsigned long maximum_value_rate = 0L;
@@ -112,43 +111,37 @@
/* if we couldn't read enough data, return an unknown error */
if (line <= 2) {
- result = STATE_UNKNOWN;
- asprintf (&message, _("Unable to process MRTG log file\n"));
+ printf (_("Unable to process MRTG log file\n"));
+ return STATE_UNKNOWN;
}
/* make sure the MRTG data isn't too old */
- if (result == STATE_OK) {
- time (&current_time);
- if (expire_minutes > 0
- && (current_time - timestamp) > (expire_minutes * 60)) {
- result = STATE_WARNING;
- asprintf (&message, _("MRTG data has expired (%d minutes old)\n"),
- (int) ((current_time - timestamp) / 60));
- }
+ time (&current_time);
+ if (expire_minutes > 0
+ && (current_time - timestamp) > (expire_minutes * 60)) {
+ printf (_("MRTG data has expired (%d minutes old)\n"),
+ (int) ((current_time - timestamp) / 60));
+ return STATE_WARNING;
}
/* else check the incoming/outgoing rates */
- if (result == STATE_OK) {
- if (use_average == TRUE)
- rate = average_value_rate;
- else
- rate = maximum_value_rate;
-
- if (rate > value_critical_threshold)
- result = STATE_CRITICAL;
- else if (rate > value_warning_threshold)
- result = STATE_WARNING;
+ if (use_average == TRUE)
+ rate = average_value_rate;
+ else
+ rate = maximum_value_rate;
- asprintf (&message, "%s. %s = %lu %s|%s",
- (use_average == TRUE) ? _("Avg") : _("Max"),
- label, rate, units,
- perfdata(label, (long) rate, units,
- (int) value_warning_threshold, (long) value_warning_threshold,
- (int) value_critical_threshold, (long) value_critical_threshold,
- 0, 0, 0, 0));
- }
+ if (rate > value_critical_threshold)
+ result = STATE_CRITICAL;
+ else if (rate > value_warning_threshold)
+ result = STATE_WARNING;
- printf ("%s\n", message);
+ printf("%s. %s = %lu %s|%s\n",
+ (use_average == TRUE) ? _("Avg") : _("Max"),
+ label, rate, units,
+ perfdata(label, (long) rate, units,
+ (int) value_warning_threshold, (long) value_warning_threshold,
+ (int) value_critical_threshold, (long) value_critical_threshold,
+ 0, 0, 0, 0));
return result;
}

View file

@ -1,202 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16_check_smtp_protocolfix.dpatch by <seanius@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins/check_smtp.c nagios-plugins/plugins/check_smtp.c
--- nagios-plugins~/plugins/check_smtp.c 2005-10-10 09:52:49.000000000 +0200
+++ nagios-plugins/plugins/check_smtp.c 2005-10-10 09:54:53.000000000 +0200
@@ -59,10 +59,17 @@
enum {
SMTP_PORT = 25
};
-const char *SMTP_EXPECT = "220";
-const char *SMTP_HELO = "HELO ";
-const char *SMTP_QUIT = "QUIT\r\n";
-const char *SMTP_STARTTLS = "STARTTLS\r\n";
+#define SMTP_EXPECT "220"
+#define SMTP_HELO "HELO "
+#define SMTP_EHLO "EHLO "
+#define SMTP_QUIT "QUIT\r\n"
+#define SMTP_STARTTLS "STARTTLS\r\n"
+
+#ifndef HOST_MAX_BYTES
+#define HOST_MAX_BYTES 255
+#endif
+
+#define EHLO_SUPPORTS_STARTTLS 1
int process_arguments (int, char **);
int validate_arguments (void);
@@ -101,6 +108,9 @@
int check_critical_time = FALSE;
int verbose = 0;
int use_ssl = FALSE;
+short use_ehlo = FALSE;
+short ssl_established = TRUE;
+char *localhostname = NULL;
int sd;
char buffer[MAX_INPUT_BUFFER];
enum {
@@ -112,7 +122,7 @@
int
main (int argc, char **argv)
{
-
+ short supports_tls=FALSE;
int n = 0;
double elapsed_time;
long microsec;
@@ -120,6 +130,7 @@
char *cmd_str = NULL;
char *helocmd = NULL;
struct timeval tv;
+ struct hostent *hp;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
@@ -129,12 +140,26 @@
usage4 (_("Could not parse arguments"));
/* initialize the HELO command with the localhostname */
-#ifndef HOST_MAX_BYTES
-#define HOST_MAX_BYTES 255
-#endif
- helocmd = malloc (HOST_MAX_BYTES);
- gethostname(helocmd, HOST_MAX_BYTES);
- asprintf (&helocmd, "%s%s%s", SMTP_HELO, helocmd, "\r\n");
+ if(! localhostname){
+ localhostname = malloc (HOST_MAX_BYTES);
+ if(!localhostname){
+ printf(_("malloc() failed!\n"));
+ return STATE_CRITICAL;
+ }
+ if(gethostname(localhostname, HOST_MAX_BYTES)){
+ printf(_("gethostname() failed!\n"));
+ return STATE_CRITICAL;
+ }
+ hp = gethostbyname(localhostname);
+ if(!hp) helocmd = localhostname;
+ else helocmd = hp->h_name;
+ } else {
+ helocmd = localhostname;
+ }
+ if(use_ehlo)
+ asprintf (&helocmd, "%s%s%s", SMTP_EHLO, helocmd, "\r\n");
+ else
+ asprintf (&helocmd, "%s%s%s", SMTP_HELO, helocmd, "\r\n");
/* initialize the MAIL command with optional FROM command */
asprintf (&cmd_str, "%sFROM: %s%s", mail_command, from_arg, "\r\n");
@@ -178,11 +203,26 @@
}
}
- /* send the HELO command */
+ /* send the HELO/EHLO command */
send(sd, helocmd, strlen(helocmd), 0);
/* allow for response to helo command to reach us */
- read (sd, buffer, MAXBUF - 1);
+ if(read (sd, buffer, MAXBUF - 1) < 0){
+ printf (_("recv() failed\n"));
+ return STATE_WARNING;
+ } else if(use_ehlo){
+ buffer[MAXBUF-1]='\0';
+ if(strstr(buffer, "250 STARTTLS") != NULL ||
+ strstr(buffer, "250-STARTTLS") != NULL){
+ supports_tls=TRUE;
+ }
+ }
+
+ if(use_ssl && ! supports_tls){
+ printf(_("WARNING - TLS not supported by server\n"));
+ send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0);
+ return STATE_WARNING;
+ }
#ifdef HAVE_SSL
if(use_ssl) {
@@ -192,11 +232,14 @@
recv(sd,buffer, MAX_INPUT_BUFFER-1, 0); /* wait for it */
if (!strstr (buffer, server_expect)) {
printf (_("Server does not support STARTTLS\n"));
+ send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0);
return STATE_UNKNOWN;
}
if(connect_STARTTLS() != OK) {
printf (_("CRITICAL - Cannot create SSL context.\n"));
return STATE_CRITICAL;
+ } else {
+ ssl_established = TRUE;
}
if ( check_cert ) {
if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
@@ -333,6 +376,7 @@
{"timeout", required_argument, 0, 't'},
{"port", required_argument, 0, 'p'},
{"from", required_argument, 0, 'f'},
+ {"fqdn", required_argument, 0, 'F'},
{"command", required_argument, 0, 'C'},
{"response", required_argument, 0, 'R'},
{"nocommand", required_argument, 0, 'n'},
@@ -359,7 +403,7 @@
}
while (1) {
- c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:",
+ c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:F:",
longopts, &option);
if (c == -1 || c == EOF)
@@ -380,6 +424,10 @@
else
usage4 (_("Port must be a positive integer"));
break;
+ case 'F':
+ /* localhostname */
+ localhostname = strdup(optarg);
+ break;
case 'f': /* from argument */
from_arg = optarg;
smtp_use_dummycmd = 1;
@@ -439,6 +487,7 @@
case 'S':
/* starttls */
use_ssl = TRUE;
+ use_ehlo = TRUE;
break;
case 'D':
/* Check SSL cert validity */
@@ -581,7 +630,7 @@
/* Initialize SSL context */
SSLeay_add_ssl_algorithms ();
- meth = SSLv2_client_method ();
+ meth = SSLv23_client_method ();
SSL_load_error_strings ();
if ((ctx = SSL_CTX_new (meth)) == NULL)
{
@@ -602,11 +651,6 @@
{
printf (_("CRITICAL - Cannot initiate SSL handshake.\n"));
}
- /* this causes a seg faul
- not sure why, being sloppy
- and commenting it out */
- /* SSL_free (ssl); */
- SSL_CTX_free(ctx);
my_close();
return STATE_CRITICAL;
@@ -708,7 +752,7 @@
my_close (void)
{
#ifdef HAVE_SSL
- if (use_ssl == TRUE) {
+ if (use_ssl == TRUE && ssl_established == TRUE) {
SSL_shutdown (ssl);
SSL_free (ssl);
SSL_CTX_free (ctx);

View file

@ -1,104 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17_check_smb_freespace.dpatch by <seanius@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins-scripts/check_disk_smb.pl nagios-plugins/plugins-scripts/check_disk_smb.pl
--- nagios-plugins~/plugins-scripts/check_disk_smb.pl 2005-10-11 09:31:55.000000000 +0200
+++ nagios-plugins/plugins-scripts/check_disk_smb.pl 2005-10-11 09:33:17.000000000 +0200
@@ -87,18 +87,55 @@
my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
($crit) || usage("Invalid critical threshold: $opt_c\n");
+# split the type from the unit value
+#Check $warn and $crit for type (%/M/G) and set up for tests
+#P = Percent, K = KBytes
+my $warn_type;
+my $crit_type;
+
+if ($opt_w =~ /^([0-9]+)\%?$/) {
+ $warn = "$1";
+ $warn_type = "P";
+} elsif ($opt_w =~ /^([0-9]+)k$/) {
+ $warn_type = "K";
+ $warn = $1;
+} elsif ($opt_w =~ /^([0-9]+)M$/) {
+ $warn_type = "K";
+ $warn = $1 * 1024;
+} elsif ($opt_w =~ /^([0-9]+)G$/) {
+ $warn_type = "K";
+ $warn = $1 * 1048576;
+}
+if ($opt_c =~ /^([0-9]+)\%?$/) {
+ $crit = "$1";
+ $crit_type = "P";
+} elsif ($opt_c =~ /^([0-9]+)k$/) {
+ $crit_type = "K";
+ $crit = $1;
+} elsif ($opt_c =~ /^([0-9]+)M$/) {
+ $crit_type = "K";
+ $crit = $1 * 1024;
+} elsif ($opt_c =~ /^([0-9]+)G$/) {
+ $crit_type = "K";
+ $crit = $1 * 1048576;
+}
+
# check if both warning and critical are percentage or size
-unless( ( ($opt_w =~ /([0-9]){1,2}$/ ) && ($opt_c =~ /([0-9]){1,2}$/ ) )|| (( $opt_w =~ /[kMG]/ ) && ($opt_c =~ /[kMG]/) ) ){
+unless( ( $warn_type eq "P" && $crit_type eq "P" ) || ( $warn_type ne "P" && $crit_type ne "P" ) ){
+ $opt_w =~ s/\%/\%\%/g;
+ $opt_c =~ s/\%/\%\%/g;
usage("Both warning and critical should be same type- warning: $opt_w critical: $opt_c \n");
}
# verify warning is less than critical
-if ( $opt_w =~ /[kMG]/) {
+if ( $warn_type eq "K") {
unless ( $warn > $crit) {
usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n");
}
}else{
unless ( $warn < $crit) {
+ $opt_w =~ s/\%/\%\%/g;
+ $opt_c =~ s/\%/\%\%/g;
usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n");
}
}
@@ -147,35 +184,6 @@
my ($capper) = int(($3/$1)*100);
my ($mountpt) = "\\\\$host\\$share";
- #Check $warn and $crit for type (%/M/G) and set up for tests
- #P = Percent, K = KBytes
- my $warn_type;
- my $crit_type;
-
- if ($opt_w =~ /^([0-9]+$)/) {
- $warn_type = "P";
- } elsif ($opt_w =~ /^([0-9]+)k$/) {
- $warn_type = "K";
- $warn = $1;
- } elsif ($opt_w =~ /^([0-9]+)M$/) {
- $warn_type = "K";
- $warn = $1 * 1024;
- } elsif ($opt_w =~ /^([0-9]+)G$/) {
- $warn_type = "K";
- $warn = $1 * 1048576;
- }
- if ($opt_c =~ /^([0-9]+$)/) {
- $crit_type = "P";
- } elsif ($opt_c =~ /^([0-9]+)k$/) {
- $crit_type = "K";
- $crit = $1;
- } elsif ($opt_c =~ /^([0-9]+)M$/) {
- $crit_type = "K";
- $crit = $1 * 1024;
- } elsif ($opt_c =~ /^([0-9]+)G$/) {
- $crit_type = "K";
- $crit = $1 * 1048576;
- }
if (int($avail / 1024) > 0) {
$avail = int($avail / 1024);

View file

@ -8,14 +8,12 @@
diff -urNad nagios-plugins~/plugins/check_game.c nagios-plugins/plugins/check_game.c
--- nagios-plugins~/plugins/check_game.c 2005-10-11 16:45:44.000000000 +0200
+++ nagios-plugins/plugins/check_game.c 2005-10-11 16:47:07.000000000 +0200
@@ -328,8 +328,8 @@
@@ -328,7 +328,7 @@
print_usage (void)
{
printf ("\
-Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
- [-pf ping_field]\n", progname);
+Usage: %s [-hvV] [-P port] [-t timeout] [-g game_field] [-m map_field]\n\
+ [-p ping_field] [-G game-time] [-H hostname] <game> <ip_address>\n", progname);
printf (_("Usage:"));
- printf (" %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n", progname);
+ printf (" %s [-hvV] [-P port] [-t timeout] [-g game_field] [-m map_field] [-p ping_field] [-G game-time] [-H hostname] <game> <ip_address>\n", progname);
}
/******************************************************************************

View file

@ -1,156 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 19_check_disk_subdirs.dpatch by <seanius@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins/check_disk.c nagios-plugins/plugins/check_disk.c
--- nagios-plugins~/plugins/check_disk.c 2005-10-11 11:48:33.000000000 +0200
+++ nagios-plugins/plugins/check_disk.c 2005-10-11 11:49:34.000000000 +0200
@@ -64,6 +64,7 @@
{
char *name;
int found;
+ int found_len;
uintmax_t w_df;
uintmax_t c_df;
double w_dfp;
@@ -166,26 +167,56 @@
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
- for (me = mount_list; me; me = me->me_next) {
+ /* if a list of paths has been selected, preseed the list with
+ * the longest matching filesystem name by iterating across
+ * the mountlist once ahead of time. this will allow a query on
+ * "/var/log" to return information about "/var" if no "/var/log"
+ * filesystem exists, etc. this is the default behavior already
+ * with df-based checks, but for systems with their own space
+ * checking routines, this should make them more consistent.
+ */
+ if(path_select_list){
+ for (me = mount_list; me; me = me->me_next) {
+ walk_name_list(path_select_list, me->me_mountdir);
+ walk_name_list(path_select_list, me->me_devname);
+ }
+ /* now pretend we never saw anything, but keep found_len.
+ * thus future searches will only match the best match */
+ for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next){
+ temp_list->found=0;
+ }
+ }
+ /* for every mount entry */
+ for (me = mount_list; me; me = me->me_next) {
+ /* if there's a list of paths to select, the current mount
+ * entry matches in path or device name, get fs usage */
if (path_select_list &&
(walk_name_list (path_select_list, me->me_mountdir) ||
- walk_name_list (path_select_list, me->me_devname) ) )
+ walk_name_list (path_select_list, me->me_devname) ) ) {
get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
- else if (dev_select_list || path_select_list)
+ /* else if there's a list of paths/devices to select (but
+ * we didn't match above) skip to the next mount entry */
+ } else if (dev_select_list || path_select_list) {
continue;
- else if (me->me_remote && show_local_fs)
+ /* skip remote filesystems if we're not interested in them */
+ } else if (me->me_remote && show_local_fs) {
continue;
- else if (me->me_dummy && !show_all_fs)
+ /* skip pseudo fs's if we haven't asked for all fs's */
+ } else if (me->me_dummy && !show_all_fs) {
continue;
- else if (fs_exclude_list && walk_name_list (fs_exclude_list, me->me_type))
+ /* skip excluded fstypes */
+ } else if (fs_exclude_list && walk_name_list (fs_exclude_list, me->me_type)) {
continue;
- else if (dp_exclude_list &&
+ /* skip excluded fs's */
+ } else if (dp_exclude_list &&
(walk_name_list (dp_exclude_list, me->me_devname) ||
- walk_name_list (dp_exclude_list, me->me_mountdir)))
+ walk_name_list (dp_exclude_list, me->me_mountdir))) {
continue;
- else
+ /* otherwise, get fs usage */
+ } else {
get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
+ }
if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
@@ -229,7 +260,7 @@
/* Override result if paths specified and not found */
temp_list = path_select_list;
while (temp_list) {
- if (temp_list->found != TRUE) {
+ if (!temp_list->found) {
asprintf (&output, _("%s [%s not found]"), output, temp_list->name);
result = STATE_CRITICAL;
}
@@ -285,6 +316,8 @@
se = (struct name_list *) malloc (sizeof (struct name_list));
se->name = strdup ("iso9660");
se->name_next = NULL;
+ se->found = 0;
+ se->found_len = 0;
*fstail = se;
fstail = &se->name_next;
@@ -388,6 +421,8 @@
se->c_df = c_df;
se->w_dfp = w_dfp;
se->c_dfp = c_dfp;
+ se->found = 0;
+ se->found_len = 0;
*pathtail = se;
pathtail = &se->name_next;
break;
@@ -399,6 +434,8 @@
se->c_df = 0;
se->w_dfp = -1.0;
se->c_dfp = -1.0;
+ se->found = 0;
+ se->found_len = 0;
*dptail = se;
dptail = &se->name_next;
break;
@@ -410,6 +447,8 @@
se->c_df = 0;
se->w_dfp = -1.0;
se->c_dfp = -1.0;
+ se->found = 0;
+ se->found_len = 0;
*fstail = se;
fstail = &se->name_next;
break;
@@ -458,6 +497,8 @@
se->c_df = c_df;
se->w_dfp = w_dfp;
se->c_dfp = c_dfp;
+ se->found =0;
+ se->found_len = 0;
*pathtail = se;
}
@@ -549,9 +590,16 @@
int
walk_name_list (struct name_list *list, const char *name)
{
+ int name_len;
+ name_len = strlen(name);
while (list) {
- if (! strcmp(list->name, name)) {
+ /* if the paths match up to the length of the mount path,
+ * AND if the mount path name is longer than the longest
+ * found match, we have a new winner */
+ if (name_len >= list->found_len &&
+ ! strncmp(list->name, name, name_len)) {
list->found = 1;
+ list->found_len = name_len;
/* if required for name_lists that have not saved w_df, etc (eg exclude lists) */
if (list->w_df) w_df = list->w_df;
if (list->c_df) c_df = list->c_df;

View file

@ -1,19 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 20_check_ntp_lessbeastlyregex.dpatch by <seanius@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins-scripts/check_ntp.pl nagios-plugins/plugins-scripts/check_ntp.pl
--- nagios-plugins~/plugins-scripts/check_ntp.pl 2005-05-25 16:05:41.000000000 +0200
+++ nagios-plugins/plugins-scripts/check_ntp.pl 2005-10-11 16:57:37.000000000 +0200
@@ -293,7 +293,7 @@
}
# match sys.peer or pps.peer
- if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9hm.]+)\s+([-0-9.mh]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
+ if (/^(\*|o)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
$syspeer = $2;
$stratum = $4;
$jitter = $11;

View file

@ -1,48 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 21_de.po_fixes.dpatch by <seanius@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/po/de.po nagios-plugins/po/de.po
--- nagios-plugins~/po/de.po 2005-10-13 11:00:06.000000000 +0200
+++ nagios-plugins/po/de.po 2005-10-13 11:03:58.000000000 +0200
@@ -717,7 +717,7 @@
#: plugins/check_dns.c:190
#, c-format
msgid "server %s is not authoritative for %s"
-msgstr "Server %s ist nicht authoritativ für %s"
+msgstr "Server %s ist nicht autoritativ für %s"
#: plugins/check_dns.c:202 plugins/check_dummy.c:59 plugins/check_http.c:999
#: plugins/check_http.c:1257 plugins/check_procs.c:282
@@ -900,11 +900,11 @@
#: plugins/check_fping.c:291
msgid "Packet size must be a positive integer"
-msgstr "Packet size muss ein positiver Integer sein"
+msgstr "Paketgröße muss ein positiver Integer sein"
#: plugins/check_fping.c:297
msgid "Packet count must be a positive integer"
-msgstr "Packet count muss ein positiver Integer sein"
+msgstr "Paketanzahl muss ein positiver Integer sein"
#: plugins/check_fping.c:303 plugins/check_time.c:307 plugins/check_udp.c:207
msgid "Hostname was not supplied"
@@ -913,12 +913,12 @@
#: plugins/check_fping.c:323
#, c-format
msgid "%s: Only one threshold may be packet loss (%s)\n"
-msgstr "%s: Nur ein Wert darf für packet loss angegeben werden (%s)\n"
+msgstr "%s: Nur ein Wert darf für paket loss angegeben werden (%s)\n"
#: plugins/check_fping.c:327
#, c-format
msgid "%s: Only one threshold must be packet loss (%s)\n"
-msgstr "%s: Nur ein Wert darf für packet loss angegeben werden (%s)\n"
+msgstr "%s: Nur ein Wert darf für paket loss angegeben werden (%s)\n"
#: plugins/check_fping.c:359
msgid ""

View file

@ -1,17 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 24_check_procs_localefix.dpatch by <seanius@debian.org>
##
## DP: make sure LC_NUMERIC is properly set because the plugin parses output
@DPATCH@
diff -urNad nagios-plugins-1.4.2~/plugins/check_procs.c nagios-plugins-1.4.2/plugins/check_procs.c
--- nagios-plugins-1.4.2~/plugins/check_procs.c 2005-09-15 10:27:58.000000000 +0200
+++ nagios-plugins-1.4.2/plugins/check_procs.c 2006-02-18 13:52:13.000000000 +0100
@@ -116,6 +116,7 @@
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ setlocale (LC_NUMERIC, "POSIX");
input_buffer = malloc (MAX_INPUT_BUFFER);
procprog = malloc (MAX_INPUT_BUFFER);