author | Florian Forster <octo@collectd.org> | |
Sun, 7 Apr 2013 17:20:14 +0000 (19:20 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 7 Apr 2013 17:20:14 +0000 (19:20 +0200) |
configure.in | patch | blob | history | |
src/filter_chain.c | patch | blob | history | |
src/mysql.c | patch | blob | history | |
src/netapp.c | patch | blob | history | |
src/network.c | patch | blob | history | |
src/nfs.c | patch | blob | history | |
src/notify_email.c | patch | blob | history | |
src/rrdcached.c | patch | blob | history | |
src/thermal.c | patch | blob | history | |
src/utils_parse_option.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 5e812a106bb23f119584b96072a3940789a3b457..b75386d0fe5d5896d677612f83685eb070ae8f54 100644 (file)
--- a/configure.in
+++ b/configure.in
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
- dummy = NULL;
+ dummy = NULL;
printf ("token = %s;\n", token);
}
]]]
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
- dummy = NULL;
+ dummy = NULL;
printf ("token = %s;\n", token);
}
]]]
if test -d "$with_java_home"
then
AC_MSG_CHECKING([for jni.h])
- TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- AC_MSG_RESULT([found in $TMPDIR])
- JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for jni_md.h])
- TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- AC_MSG_RESULT([found in $TMPDIR])
- JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for libjvm.so])
- TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- AC_MSG_RESULT([found in $TMPDIR])
- JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
else
AC_MSG_RESULT([not found])
fi
if test "x$JAVAC" = "x"
then
AC_MSG_CHECKING([for javac])
- TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name javac -type f | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- JAVAC="$TMPDIR"
+ JAVAC="$TMPVAR"
AC_MSG_RESULT([$JAVAC])
else
AC_MSG_RESULT([not found])
if test "x$JAR" = "x"
then
AC_MSG_CHECKING([for jar])
- TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name jar -type f | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- JAR="$TMPDIR"
+ JAR="$TMPVAR"
AC_MSG_RESULT([$JAR])
else
AC_MSG_RESULT([not found])
diff --git a/src/filter_chain.c b/src/filter_chain.c
index ed2df61c9c5b16f35a0e6953ab0f9ca5da03fc8b..7d8369b901def7d9633e78e6c73de5b14cc26f92 100644 (file)
--- a/src/filter_chain.c
+++ b/src/filter_chain.c
(*m->proc.destroy) (&m->user_data);
else if (m->user_data != NULL)
{
- ERROR ("Filter sybsystem: fc_free_matches: There is user data, but no "
+ ERROR ("Filter subsystem: fc_free_matches: There is user data, but no "
"destroy functions has been specified. "
"Memory will probably be lost!");
}
(*t->proc.destroy) (&t->user_data);
else if (t->user_data != NULL)
{
- ERROR ("Filter sybsystem: fc_free_targets: There is user data, but no "
+ ERROR ("Filter subsystem: fc_free_targets: There is user data, but no "
"destroy functions has been specified. "
"Memory will probably be lost!");
}
diff --git a/src/mysql.c b/src/mysql.c
index 6f2d69abbfd6501b830830f25c27a15b0ed4d5de..d2d0b4bfc57a9ad695b592835cadd4707935fac0 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
_Bool slave_sql_running;
MYSQL *con;
- int state;
+ _Bool is_connected;
};
typedef struct mysql_database_s mysql_database_t; /* }}} */
static MYSQL *getconnection (mysql_database_t *db)
{
- if (db->state != 0)
+ if (db->is_connected)
{
- int err;
- if ((err = mysql_ping (db->con)) != 0)
- {
- /* Assured by "mysql_config_database" */
- assert (db->instance != NULL);
- WARNING ("mysql_ping failed for instance \"%s\": %s",
- db->instance,
- mysql_error (db->con));
- db->state = 0;
- }
- else
- {
- db->state = 1;
+ int status;
+
+ status = mysql_ping (db->con);
+ if (status == 0)
return (db->con);
- }
+
+ WARNING ("mysql plugin: Lost connection to instance \"%s\": %s",
+ db->instance, mysql_error (db->con));
}
+ db->is_connected = 0;
- if ((db->con = mysql_init (db->con)) == NULL)
+ if (db->con == NULL)
{
- ERROR ("mysql_init failed: %s", mysql_error (db->con));
- db->state = 0;
- return (NULL);
+ db->con = mysql_init (NULL);
+ if (db->con == NULL)
+ {
+ ERROR ("mysql plugin: mysql_init failed: %s",
+ mysql_error (db->con));
+ return (NULL);
+ }
}
if (mysql_real_connect (db->con, db->host, db->user, db->pass,
(db->database != NULL) ? db->database : "<none>",
(db->host != NULL) ? db->host : "localhost",
mysql_error (db->con));
- db->state = 0;
return (NULL);
}
- else
- {
- INFO ("mysql plugin: Successfully connected to database %s "
- "at server %s (server version: %s, protocol version: %d)",
- (db->database != NULL) ? db->database : "<none>",
- mysql_get_host_info (db->con),
- mysql_get_server_info (db->con),
- mysql_get_proto_info (db->con));
- db->state = 1;
- return (db->con);
- }
+
+ INFO ("mysql plugin: Successfully connected to database %s "
+ "at server %s (server version: %s, protocol version: %d)",
+ (db->database != NULL) ? db->database : "<none>",
+ mysql_get_host_info (db->con),
+ mysql_get_server_info (db->con),
+ mysql_get_proto_info (db->con));
+
+ db->is_connected = 1;
+ return (db->con);
} /* static MYSQL *getconnection (mysql_database_t *db) */
static void set_host (mysql_database_t *db, char *buf, size_t buflen)
diff --git a/src/netapp.c b/src/netapp.c
index f7bc04d3b1db35c54ab5a607316c9f1fc146209d..d35a0910a1d2c483d77922ddf0b94a8eacf48b11 100644 (file)
--- a/src/netapp.c
+++ b/src/netapp.c
/* Submits all the caches used by WAFL. Uses "submit_cache_ratio". */
static int submit_wafl_data (const char *hostname, const char *instance, /* {{{ */
- cfg_wafl_t *old_data, const cfg_wafl_t *new_data, int interval)
+ cfg_wafl_t *old_data, const cfg_wafl_t *new_data, cdtime_t interval)
{
/* Submit requested counters */
if (HAS_ALL_FLAGS (old_data->flags, CFG_WAFL_NAME_CACHE | HAVE_WAFL_NAME_CACHE)
*/
/* Data corresponding to <WAFL /> */
static int cna_handle_wafl_data (const char *hostname, cfg_wafl_t *cfg_wafl, /* {{{ */
- na_elem_t *data, int interval)
+ na_elem_t *data, cdtime_t interval)
{
cfg_wafl_t perf_data;
const char *plugin_inst;
return (-1);
}
- status = cna_handle_wafl_data (host->name, host->cfg_wafl, data, host->interval);
+ status = cna_handle_wafl_data (host->name, host->cfg_wafl, data,
+ host->cfg_wafl->interval.interval);
if (status == 0)
host->cfg_wafl->interval.last_read = now;
return (-1);
}
- status = cna_handle_disk_data (host->name, host->cfg_disk, data, host->interval);
+ status = cna_handle_disk_data (host->name, host->cfg_disk, data,
+ host->cfg_disk->interval.interval);
if (status == 0)
host->cfg_disk->interval.last_read = now;
return (-1);
}
- status = cna_handle_volume_perf_data (host->name, host->cfg_volume_perf, data, host->interval);
+ status = cna_handle_volume_perf_data (host->name, host->cfg_volume_perf, data,
+ host->cfg_volume_perf->interval.interval);
if (status == 0)
host->cfg_volume_perf->interval.last_read = now;
} /* }}} end of 32-bit workaround */
} /* for (elem_volume) */
- return (cna_submit_volume_usage_data (host->name, cfg_volume, host->interval));
+ return (cna_submit_volume_usage_data (host->name, cfg_volume,
+ host->cfg_volume_usage->interval.interval));
} /* }}} int cna_handle_volume_usage_data */
static int cna_setup_volume_usage (cfg_volume_usage_t *cvu) /* {{{ */
return (-1);
}
- status = cna_handle_system_data (host->name, host->cfg_system, data, host->interval);
+ status = cna_handle_system_data (host->name, host->cfg_system, data,
+ host->cfg_system->interval.interval);
if (status == 0)
host->cfg_system->interval.last_read = now;
diff --git a/src/network.c b/src/network.c
index 3f0c6fa1a08858def27ffd167362475faf0fcbc8..4a5424605b3ead237e6311167d7fd3dc067319c1 100644 (file)
--- a/src/network.c
+++ b/src/network.c
/**
* collectd - src/network.c
- * Copyright (C) 2005-2010 Florian octo Forster
+ * Copyright (C) 2005-2013 Florian octo Forster
* Copyright (C) 2009 Aman Gupta
*
* This program is free software; you can redistribute it and/or modify it
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
* Aman Gupta <aman at tmm1.net>
**/
} /* }}} int network_dispatch_notification */
#if HAVE_LIBGCRYPT
+static void network_init_gcrypt (void) /* {{{ */
+{
+ /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
+ * Because you can't know in a library whether another library has
+ * already initialized the library */
+ if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
+ return;
+
+ gcry_check_version (NULL); /* before calling any other functions */
+ gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ gcry_control (GCRYCTL_INIT_SECMEM, 32768);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED);
+} /* }}} void network_init_gcrypt */
+
static gcry_cipher_hd_t network_get_aes256_cypher (sockent_t *se, /* {{{ */
const void *iv, size_t iv_size, const char *username)
{
{
if (se->data.client.security_level > SECURITY_LEVEL_NONE)
{
+ network_init_gcrypt ();
+
if ((se->data.client.username == NULL)
|| (se->data.client.password == NULL))
{
{
if (se->data.server.security_level > SECURITY_LEVEL_NONE)
{
+ network_init_gcrypt ();
+
if (se->data.server.auth_file == NULL)
{
ERROR ("network plugin: Server socket with "
have_init = 1;
#if HAVE_LIBGCRYPT
- /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
- * Because you can't know in a library whether another library has
- * already initialized the library
- */
- if (!gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
- {
- gcry_check_version(NULL); /* before calling any other functions */
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
- gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
- }
+ network_init_gcrypt ();
#endif
if (network_config_stats != 0)
diff --git a/src/nfs.c b/src/nfs.c
index 461e806f90ab76d0ed97747043ca1a1430a6f12c..1a4ed7487b0566378092edb3f6d8b3b84d49adab 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
/**
* collectd - src/nfs.c
* Copyright (C) 2005,2006 Jason Pepas
+ * Copyright (C) 2012,2013 Florian Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* Authors:
* Jason Pepas <cell at ices.utexas.edu>
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
* Cosmin Ioiart <cioiart at gmail.com>
**/
#if HAVE_LIBKSTAT
static int nfs_read_kstat (kstat_t *ksp, int nfs_version, char *inst,
- const char **proc_names, size_t proc_names_num)
+ char const **proc_names, size_t proc_names_num)
{
char plugin_instance[DATA_MAX_NAME_LEN];
value_t values[proc_names_num];
kstat_read(kc, ksp, NULL);
for (i = 0; i < proc_names_num; i++)
- values[i].counter = (derive_t) get_kstat_value (ksp,
- (char *)proc_names[i]);
+ {
+ /* The name passed to kstat_data_lookup() doesn't have the
+ * "const" modifier, so we need to copy the name here. */
+ char name[32];
+ sstrncpy (name, proc_names[i], sizeof (name));
+
+ values[i].counter = (derive_t) get_kstat_value (ksp, name);
+ }
nfs_procedures_submit (plugin_instance, proc_names, values,
proc_names_num);
diff --git a/src/notify_email.c b/src/notify_email.c
index cd216ca2da753a2e1a2895486f706c62c280e42d..24c66ec051b965aa5cbfedd228d774430d951c53 100644 (file)
--- a/src/notify_email.c
+++ b/src/notify_email.c
/* Let's make RFC822 message text with \r\n EOLs */
ssnprintf (buf, buf_len,
"MIME-Version: 1.0\r\n"
- "Content-Type: text/plain;\r\n"
+ "Content-Type: text/plain; charset=\"US-ASCII\"\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
"Subject: %s\r\n"
"\r\n"
diff --git a/src/rrdcached.c b/src/rrdcached.c
index 11c1c6a7f85c3e96c2380602094c81f09e4bb97f..3518f2dd0d28fddfad1c616b0347813602a9c6dd 100644 (file)
--- a/src/rrdcached.c
+++ b/src/rrdcached.c
/**
* collectd - src/rrdcached.c
- * Copyright (C) 2008 Florian octo Forster
+ * Copyright (C) 2008-2013 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
**/
#include "collectd.h"
sstrncpy (vl.host, daemon_address, sizeof (vl.host));
sstrncpy (vl.plugin, "rrdcached", sizeof (vl.plugin));
+ status = rrdc_connect (daemon_address);
+ if (status != 0)
+ {
+ ERROR ("rrdcached plugin: rrdc_connect (%s) failed with status %i.",
+ daemon_address, status);
+ return (-1);
+ }
+
head = NULL;
status = rrdc_stats_get (&head);
if (status != 0)
diff --git a/src/thermal.c b/src/thermal.c
index 0ad0d90a04377126132e35cad77e4d592a844a1d..603f85bbf6a96595ee04891127f37006d90730aa 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
v.gauge = value;
vl.values = &v;
+ vl.values_len = 1;
+
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "thermal", sizeof(vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
index 2168cd1af3d624801146905b853adb0c92db3d7b..820f14f58ef1da32cdfbe73c016c7fefdba4a0b0 100644 (file)
--- a/src/utils_parse_option.c
+++ b/src/utils_parse_option.c
/* Look for the equal sign */
buffer = key;
- while (isalnum ((int) *buffer))
+ while (isalnum ((int) *buffer) || *buffer == '_')
buffer++;
if ((*buffer != '=') || (buffer == key))
return (1);