summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ff7d99)
raw | patch | inline | side by side (parent: 0ff7d99)
author | M. Sean Finney <seanius@users.sourceforge.net> | |
Mon, 31 Oct 2005 20:03:19 +0000 (20:03 +0000) | ||
committer | M. Sean Finney <seanius@users.sourceforge.net> | |
Mon, 31 Oct 2005 20:03:19 +0000 (20:03 +0000) |
unused variables and explicit casting issues, but there were a
couple gotchas in there too.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1267 f882894a-f735-0410-b71e-b25c423dba1c
couple gotchas in there too.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1267 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/configure.in b/configure.in
index 368bbf75fa88238338345ab4023b21ef0ae6e888..a3dbd72562845c4cef44835a5e1b5bcc4e720275 100644 (file)
--- a/configure.in
+++ b/configure.in
dnl
dnl check for math-related functions needing -lm
+AC_CHECK_HEADERS(math.h)
AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
AC_SUBST(MATHLIBS)
AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
[Number of columns in ps command])
EXTRAS="$EXTRAS check_procs check_nagios"
+ if echo "$ac_cv_ps_varlist" | grep -q "procetime"; then
+ AC_DEFINE(PS_USES_PROCETIME,"yes",
+ [Whether the ps utility uses the "procetime" field])
+ fi
fi
AC_PATH_PROG(PATH_TO_PING,ping)
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 912072c24d8eb26bd28e0fa29d8029a6312f8a7e..8548bbdbdfe2a662e230f42c6a06a84294320c90 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
{
char *command_line;
int result = STATE_UNKNOWN;
- FILE *fp;
char *p, *ret[QSTAT_MAX_RETURN_ARGS];
size_t i = 0;
output chld_out;
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 413d501d9b9e6b1cb532a62bd361b42f9d8367ba..9ff572e90d8c473c46ed3d3de0778223e24377ac 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
double elapsed_time;
int page_len = 0;
int result = STATE_UNKNOWN;
-#ifdef HAVE_SSL
- int sslerr;
-#endif
/* try to connect to the host at the given port number */
if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf);
}
- asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data));
+ asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data));
asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF);
}
else {
if (verbose)
printf ("%s://%s:%d%s is %d characters\n",
use_ssl ? "https" : "http", server_address,
- server_port, server_url, pagesize);
+ server_port, server_url, (int)pagesize);
/* find status line and null-terminate it */
status_line = page;
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index 0ae488fffc0742ebc0b9ea17ba78d63cdf5c8966..ab9c877b557a0aac3d57dca0a2699739a21c1e98 100644 (file)
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
int procrss = 0;
float procpcpu = 0;
char procstat[8];
- /* procetime is unused in most configurations, but may be in PS_VAR_LIST
- * so it must be here in spite of it producing compiler warnings */
+#ifdef PS_USES_PROCETIME
char procetime[MAX_INPUT_BUFFER];
+#endif /* PS_USES_PROCETIME */
char procprog[MAX_INPUT_BUFFER];
char *procargs;
int pos, cols;
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 97c86a3a5b07d74cbc8435bf304706c7e501c537..db106f267cdcacd20fc9553ce63462cc809156c2 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
labels_size += 8;
labels = realloc (labels, labels_size);
if (labels == NULL)
- die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), nlabels);
+ die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), (int)nlabels);
}
labels[nlabels - 1] = optarg;
ptr = thisarg (optarg);
unitv_size += 8;
unitv = realloc (unitv, unitv_size);
if (unitv == NULL)
- die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), nunits);
+ die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), (int)nunits);
}
unitv[nunits - 1] = optarg;
ptr = thisarg (optarg);
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index aeeb9ba0a8872044e55dc1064a91f00c38cbac0e..74b9daf628aca9451da17971199c55097e57a9f8 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
}
else if (strstr (optarg, ",") &&
strstr (optarg, "%") &&
- sscanf (optarg, "%g,%d%%", &warn_size, &warn_percent) == 2) {
+ sscanf (optarg, "%lf,%d%%", &warn_size, &warn_percent) == 2) {
warn_size = floor(warn_size);
break;
}
}
else if (strstr (optarg, ",") &&
strstr (optarg, "%") &&
- sscanf (optarg, "%g,%d%%", &crit_size, &crit_percent) == 2) {
+ sscanf (optarg, "%lf,%d%%", &crit_size, &crit_percent) == 2) {
crit_size = floor(crit_size);
break;
}
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 2a77637c93c626e2fb9795ebc99f46dd43da07b4..cb7a869d071d35d011852865e155066e13a4d4c1 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
#ifdef HAVE_SSL
static int check_cert = FALSE;
static int days_till_exp;
-static char *randbuff = "";
# define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len))
# define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0))
#else
static int PROTOCOL = IPPROTO_TCP; /* most common is default */
static int PORT = 0;
-static char timestamp[17] = "";
static int server_port = 0;
static char *server_address = NULL;
static char *server_send = NULL;
if(flags & FLAG_VERBOSE) {
printf("Using service %s\n", SERVICE);
printf("Port: %d\n", PORT);
- printf("flags: 0x%x\n", flags);
+ printf("flags: 0x%x\n", (int)flags);
}
if(EXPECT && !server_expect_count)
}
if(flags & FLAG_VERBOSE) {
- printf("server_expect_count: %d\n", server_expect_count);
+ printf("server_expect_count: %d\n", (int)server_expect_count);
for(i = 0; i < server_expect_count; i++)
printf("\t%d: %s\n", i, server_expect[i]);
}
/* print raw output if we're debugging */
if(flags & FLAG_VERBOSE)
printf("received %d bytes from host\n#-raw-recv-------#\n%s\n#-raw-recv-------#\n",
- len + 1, status);
+ (int)len + 1, status);
while(isspace(status[len])) status[len--] = '\0';
for (i = 0; i < server_expect_count; i++) {
diff --git a/plugins/common.h b/plugins/common.h
index 5eac63e4a00de32ae34a1d47bc5db7cba9389e66..b4699cef1347c983715b19a8f88e80504eebd6c6 100644 (file)
--- a/plugins/common.h
+++ b/plugins/common.h
#include <stdlib.h>
#include <errno.h>
-#ifdef HUGE_VAL_NEEDS_MATH_H
+#ifdef HAVE_MATH_H
#include <math.h>
#endif
diff --git a/plugins/netutils.c b/plugins/netutils.c
index 6f3a151019ee7b47d7635de3e2269855337eec9d..b4c3944b4ebbc122c39132b0e44a6bb3834361ff 100644 (file)
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
*
****************************************************************************/
+#define LOCAL_TIMEOUT_ALARM_HANDLER
+
#include "common.h"
#include "netutils.h"
/* else the hostname is interpreted as a path to a unix socket */
else {
if(strlen(host_name) >= UNIX_PATH_MAX){
- die(_("Supplied path too long unix domain socket"));
+ die(STATE_UNKNOWN, _("Supplied path too long unix domain socket"));
}
memset(&su, 0, sizeof(su));
su.sun_family = AF_UNIX;
strncpy(su.sun_path, host_name, UNIX_PATH_MAX);
*sd = socket(PF_UNIX, SOCK_STREAM, 0);
if(sd < 0){
- die(_("Socket creation failed"));
+ die(STATE_UNKNOWN, _("Socket creation failed"));
}
result = connect(*sd, (struct sockaddr *)&su, sizeof(su));
if (result < 0 && errno == ECONNREFUSED)
diff --git a/plugins/netutils.h b/plugins/netutils.h
index 8bc7bd619254516fb47eebf4b3a9cc26ca6d0912..1168f9f82eb688579da061cb891a434739f0fdac 100644 (file)
--- a/plugins/netutils.h
+++ b/plugins/netutils.h
#include "config.h"
#include "common.h"
+#include "utils.h"
#include <netinet/in.h>
#include <arpa/inet.h>
int is_host (const char *);
int is_addr (const char *);
int resolve_host_or_addr (const char *, int);
+void host_or_die(const char *str);
#define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET)
#ifdef USE_IPV6
# define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6)
diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index d785fb755588df3f306395d8efa1e967937b1b65..66c729956050f7acb964e704d2904f7a216f95e6 100644 (file)
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
*
****************************************************************************/
+#define LOCAL_TIMEOUT_ALARM_HANDLER
#include "common.h"
#include "netutils.h"