summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e9e1fe6)
raw | patch | inline | side by side (parent: e9e1fe6)
author | Benoit Mortier <opensides@users.sourceforge.net> | |
Sun, 5 Dec 2004 00:54:09 +0000 (00:54 +0000) | ||
committer | Benoit Mortier <opensides@users.sourceforge.net> | |
Sun, 5 Dec 2004 00:54:09 +0000 (00:54 +0000) |
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
on one word like in nagios
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1004 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 6f8ad9a42b52dd8f569e95720ae8f6c1c28c111b..dd0582199fdd721583ba54bf04331eeeed414ad5 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
} 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 45bfcc5ef6d111a1f387b9844951e6029cdd33c7..361e924e5207089fa7ceb0f17fa2969cc0300f1c 100644 (file)
--- a/plugins/check_icmp.c
+++ b/plugins/check_icmp.c
/*
- * 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.
#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>
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
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);
* 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 d8913bce950772f46808d200ee39c2677e550702..2d7e611da8f437f8052a046fff6535530bae076c 100644 (file)
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
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 4778fcf90bfe3a73c6af68e6ad6d04230b1ef4ea..91764666da93e02f76daf4d3de2e729b7680fa29 100644 (file)
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
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 ab1b950797d4c32bed480261f88fe14756c26851..b6c60c244ebf5ea73446fc28ca8a0a017e3fb3f4 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
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 3067f85cf240cc8a7e479a54e2a5eb0dd033e9fd..6e2ab7232af4d1ab35d4d101b3830ba037cefb28 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
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 4fc1305f8679c95b3e3cf72b51d519129f692e40..bdf1ee1f687963a002b0f33b4dd1ce17e27035af 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
/* $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 */
#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);
/* 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