aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benoit Mortier <opensides@users.sourceforge.net> 2004-12-05 00:54:09 +0000
committerGravatar Benoit Mortier <opensides@users.sourceforge.net> 2004-12-05 00:54:09 +0000
commit2ab4d8fc278413b01ff9c4e4496f892398f80a4c (patch)
tree6d402f5bf1b4673d00f97bbb84b1ea6b4badd060
parente9e1fe6ef5720adf355b605ffdbe94cd608cc46c (diff)
downloadmonitoring-plugins-2ab4d8fc278413b01ff9c4e4496f892398f80a4c.tar.gz
fix patch 998291
fix patch 1078934 expect check_ssh fix and check_nt perfdata should stay on one word like in nagios git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1004 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_http.c16
-rw-r--r--plugins/check_icmp.c23
-rw-r--r--plugins/check_nwstat.c3
-rw-r--r--plugins/check_ping.c2
-rw-r--r--plugins/check_smtp.c3
-rw-r--r--plugins/check_swap.c2
-rw-r--r--plugins/utils.h71
7 files changed, 59 insertions, 61 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 6f8ad9a4..dd058219 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -676,17 +676,17 @@ check_document_dates (const char *headers)
} else if (!document_date || !*document_date) {
die (STATE_CRITICAL, _("Document modification date unknown\n"));
} else {
- time_t sd = parse_time_string (server_date);
- time_t dd = parse_time_string (document_date);
+ time_t srv_data = parse_time_string (server_date);
+ time_t doc_data = parse_time_string (document_date);
- if (sd <= 0) {
+ if (srv_data <= 0) {
die (STATE_CRITICAL, _("CRITICAL - Server date \"%100s\" unparsable"), server_date);
- } else if (dd <= 0) {
+ } else if (doc_data <= 0) {
die (STATE_CRITICAL, _("CRITICAL - Document date \"%100s\" unparsable"), document_date);
- } else if (dd > sd + 30) {
- die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), dd - sd);
- } else if (dd < sd - maximum_age) {
- int n = (sd - dd);
+ } else if (doc_data > srv_data + 30) {
+ die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data);
+ } else if (doc_data < srv_data - maximum_age) {
+ int n = (srv_data - doc_data);
if (n > (60 * 60 * 24 * 2))
die (STATE_CRITICAL,
_("CRITICAL - Last modified %.1f days ago\n"),
diff --git a/plugins/check_icmp.c b/plugins/check_icmp.c
index 45bfcc5e..361e924e 100644
--- a/plugins/check_icmp.c
+++ b/plugins/check_icmp.c
@@ -1,6 +1,8 @@
/*
- * check_icmp - A hack of fping2 to work with nagios.
- * This way we don't have to use the output parser.
+ * $Id$
+ *
+ * This is a hack of fping2 made to work with nagios.
+ * It's fast and removes the necessity of parsing another programs output.
*
* VIEWING NOTES:
* This file was formatted with tab indents at a tab stop of 4.
@@ -40,14 +42,8 @@
#include <netinet/in_systm.h>
#include <netinet/in.h>
-/* Linux has bizarre ip.h and ip_icmp.h */
-/* Taken from the fping distro. Thank you. */
-#if defined( __linux__ )
-#include "linux.h"
-#else
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
-#endif /* defined(__linux__) */
#include <arpa/inet.h>
#include <netdb.h>
@@ -70,9 +66,8 @@ extern char *optarg;
extern int optind, opterr;
/*** Constants ***/
-#define REV_DATE "2004-09-06"
#define EMAIL "ae@op5.se"
-#define VERSION "0.8"
+#define VERSION "0.8.1"
#ifndef INADDR_NONE
# define INADDR_NONE 0xffffffU
@@ -441,7 +436,7 @@ int main(int argc, char **argv)
break;
case 'v':
- printf("%s: Version %s $Date$\n", prog, VERSION, REV_DATE);
+ printf("%s: Version %s $Date$\n", prog, VERSION);
printf("%s: comments to %s\n", prog, EMAIL);
exit(STATE_OK);
@@ -1275,7 +1270,7 @@ void u_sleep(int u_sec)
* crash on any other errrors
************************************************************/
/* TODO: add MSG_DONTWAIT to recvfrom flags (currently 0) */
-int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo)
+int recvfrom_wto(int lsock, char *buf, int len, struct sockaddr *saddr, int timo)
{
int nfound = 0, slen, n;
struct timeval to;
@@ -1289,8 +1284,8 @@ int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo)
FD_ZERO(&readset);
FD_ZERO(&writeset);
- FD_SET(sock, &readset);
- nfound = select(sock + 1, &readset, &writeset, NULL, &to);
+ FD_SET(lsock, &readset);
+ nfound = select(lsock + 1, &readset, &writeset, NULL, &to);
if(nfound < 0) crash("select() in recvfrom_wto");
if(nfound == 0) return -1; /* timeout */
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index d8913bce..2d7e611d 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -909,8 +909,7 @@ void print_help(void)
printf (_("\
This plugin attempts to contact the MRTGEXT NLM running on a\n\
-Novell server to gather the requested system information.\n\n"),
- progname);
+Novell server to gather the requested system information.\n\n"));
print_usage();
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 4778fcf9..91764666 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -469,6 +469,8 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr);
else if (strstr (buf, "unknown host" ))
die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr);
+ else if (strstr (buf, "Time to live exceeded"))
+ die (STATE_CRITICAL, _("CRITICAL - Time to live exceeded (%s)"), addr);
if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) {
if (warn_text == NULL)
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index ab1b9507..b6c60c24 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -218,11 +218,12 @@ main (int argc, char **argv)
microsec = deltime (tv);
elapsed_time = (double)microsec / 1.0e6;
- if (result == STATE_OK)
+ if (result == STATE_OK) {
if (check_critical_time && elapsed_time > (double) critical_time)
result = STATE_CRITICAL;
else if (check_warning_time && elapsed_time > (double) warning_time)
result = STATE_WARNING;
+ }
printf (_("SMTP %s - %.3f sec. response time%s%s|%s\n"),
state_text (result), elapsed_time,
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 3067f85c..6e2ab723 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -56,10 +56,10 @@ main (int argc, char **argv)
int result = STATE_UNKNOWN;
char input_buffer[MAX_INPUT_BUFFER];
char *perf;
- int conv_factor = SWAP_CONVERSION;
#ifdef HAVE_PROC_MEMINFO
FILE *fp;
#else
+ int conv_factor = SWAP_CONVERSION;
# ifdef HAVE_SWAP
char *temp_buffer;
char *swap_command;
diff --git a/plugins/utils.h b/plugins/utils.h
index 4fc1305f..bdf1ee1f 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -16,9 +16,9 @@ suite of plugins. */
/* $Id$ */
void support (void);
-char *clean_revstring (const char *revstring);
+char *clean_revstring (const char *);
void print_revision (const char *, const char *);
-void die (int result, const char *fmt, ...) __attribute__((noreturn,format(printf, 2, 3)));
+void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)));
/* Handle timeouts */
@@ -57,7 +57,7 @@ struct timeval {
#endif
#ifndef HAVE_GETTIMEOFDAY
-int gettimeofday(struct timeval *tv, struct timezone *tz);
+int gettimeofday(struct timeval *, struct timezone *);
#endif
double delta_time (struct timeval tv);
@@ -65,46 +65,47 @@ long deltime (struct timeval tv);
/* Handle strings safely */
-void strip (char *buffer);
-char *strscpy (char *dest, const 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);
+void strip (char *);
+char *strscpy (char *, const char *);
+char *strnl (char *);
+char *strpcpy (char *, const char *, const char *);
+char *strpcat (char *, const char *, const char *);
int max_state (int a, int b);
-void usage (const char *msg) __attribute__((noreturn));
-void usage2(const char *msg, const char *arg) __attribute__((noreturn));
-void usage3(const char *msg, int arg) __attribute__((noreturn));
+void usage (const char *) __attribute__((noreturn));
+void usage2(const char *, const char *) __attribute__((noreturn));
+void usage3(const char *, int) __attribute__((noreturn));
+void usage4(const char *);
-const char *state_text (int result);
+const char *state_text (int);
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
-char *perfdata (const char *label,
- long int val,
- const char *uom,
- int warnp,
- long int warn,
- int critp,
- long int crit,
- int minp,
- long int minv,
- int maxp,
- long int maxv);
-
-char *fperfdata (const char *label,
- double val,
- const char *uom,
- int warnp,
- double warn,
- int critp,
- double crit,
- int minp,
- double minv,
- int maxp,
- double maxv);
+char *perfdata (const char *,
+ long int,
+ const char *,
+ int,
+ long int,
+ int,
+ long int,
+ int,
+ long int,
+ int,
+ long int);
+
+char *fperfdata (const char *,
+ double,
+ const char *,
+ int,
+ double,
+ int,
+ double,
+ int,
+ double,
+ int,
+ double);
/* The idea here is that, although not every plugin will use all of these,
most will or should. Therefore, for consistency, these very common