[Nagiosplug-checkins] nagiosplug/plugins check_http.c,1.76,1.77 check_icmp.c,1.1,1.2 check_nwstat.c,1.27,1.28 check_ping.c,1.38,1.39 check_smtp.c,1.38,1.39 check_swap.c,1.42,1.43 utils.h,1.21,1.22
Benoit Mortier
opensides at users.sourceforge.net
Sat Dec 4 16:55:02 CET 2004
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29006
Modified Files:
check_http.c check_icmp.c check_nwstat.c check_ping.c
check_smtp.c check_swap.c utils.h
Log Message:
fix patch 998291
fix patch 1078934 expect check_ssh fix and check_nt perfdata should stay
on one word like in nagios
Index: check_smtp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_smtp.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- check_smtp.c 4 Dec 2004 12:12:29 -0000 1.38
+++ check_smtp.c 5 Dec 2004 00:54:09 -0000 1.39
@@ -218,11 +218,12 @@
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,
Index: utils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- utils.h 3 Dec 2004 17:48:53 -0000 1.21
+++ utils.h 5 Dec 2004 00:54:09 -0000 1.22
@@ -16,9 +16,9 @@
/* $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 @@
#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 @@
/* 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 *perfdata (const char *,
+ long int,
+ const char *,
+ int,
+ long int,
+ int,
+ long int,
+ int,
+ long int,
+ int,
+ long int);
-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 *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
Index: check_ping.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- check_ping.c 3 Dec 2004 23:55:29 -0000 1.38
+++ check_ping.c 5 Dec 2004 00:54:09 -0000 1.39
@@ -469,6 +469,8 @@
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)
Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- check_swap.c 4 Dec 2004 12:12:29 -0000 1.42
+++ check_swap.c 5 Dec 2004 00:54:09 -0000 1.43
@@ -56,10 +56,10 @@
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;
Index: check_icmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_icmp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- check_icmp.c 2 Dec 2004 08:44:36 -0000 1.1
+++ check_icmp.c 5 Dec 2004 00:54:09 -0000 1.2
@@ -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 int optind, opterr;
/*** Constants ***/
-#define REV_DATE "2004-09-06"
#define EMAIL "ae at op5.se"
-#define VERSION "0.8"
+#define VERSION "0.8.1"
#ifndef INADDR_NONE
# define INADDR_NONE 0xffffffU
@@ -441,7 +436,7 @@
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 @@
* 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 @@
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 */
Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- check_http.c 4 Dec 2004 12:12:29 -0000 1.76
+++ check_http.c 5 Dec 2004 00:54:09 -0000 1.77
@@ -676,17 +676,17 @@
} 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"),
Index: check_nwstat.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nwstat.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- check_nwstat.c 4 Dec 2004 12:12:29 -0000 1.27
+++ check_nwstat.c 5 Dec 2004 00:54:09 -0000 1.28
@@ -909,8 +909,7 @@
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();
More information about the Commits
mailing list