summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d92c343)
raw | patch | inline | side by side (parent: d92c343)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 15 Mar 2007 18:34:46 +0000 (19:34 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 15 Mar 2007 18:34:46 +0000 (19:34 +0100) |
41 files changed:
diff --git a/src/Makefile.am b/src/Makefile.am
index 0610aa694fa01d66d8c8555353943476bced7d1e..adf83da6802e3399c16b167d3ac1a3aac2712412 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
bin_PROGRAMS = collectd-nagios
collectd_SOURCES = collectd.c collectd.h \
- utils_debug.c utils_debug.h \
utils_avltree.c utils_avltree.h \
utils_mount.c utils_mount.h \
utils_llist.c utils_llist.h \
diff --git a/src/apache.c b/src/apache.c
index 167ead1f2e6291a589a4e8ecd4ac9e25df2c0429..887977e423b4205cbae54542aa089be2934905e0 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_LIBCURL && HAVE_CURL_CURL_H
# define APACHE_HAVE_READ 1
if ((curl = curl_easy_init ()) == NULL)
{
- syslog (LOG_ERR, "apache: `curl_easy_init' failed.");
+ ERROR ("apache: `curl_easy_init' failed.");
return (-1);
}
{
if (snprintf (credentials, 1024, "%s:%s", user, pass == NULL ? "" : pass) >= 1024)
{
- syslog (LOG_ERR, "apache: Credentials would have been truncated.");
+ ERROR ("apache: Credentials would have been truncated.");
return (-1);
}
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- DBG ("type = %s; type_instance = %s; value = %llu;",
+ DEBUG ("type = %s; type_instance = %s; value = %llu;",
type, type_instance, value);
values[0].counter = value;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- DBG ("type = %s; type_instance = %s; value = %lf;",
+ DEBUG ("type = %s; type_instance = %s; value = %lf;",
type, type_instance, value);
values[0].gauge = value;
apache_buffer_len = 0;
if (curl_easy_perform (curl) != 0)
{
- syslog (LOG_ERR, "apache: curl_easy_perform failed: %s",
+ ERROR ("apache: curl_easy_perform failed: %s",
apache_curl_error);
return (-1);
}
diff --git a/src/apcups.c b/src/apcups.c
index 9fab78587440e961d33387372b4f2dc84e762bfe..b5b939a1ebe7ddb0be33703500185ed646696fcb 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
#include "common.h" /* rrd_update_file */
#include "plugin.h" /* plugin_register, plugin_submit */
#include "configfile.h" /* cf_register */
-#include "utils_debug.h"
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
if (global_sockfd < 0)
return (0);
- DBG ("Gracefully shutting down socket %i.", global_sockfd);
+ DEBUG ("Gracefully shutting down socket %i.", global_sockfd);
/* send EOF sentinel */
swrite (global_sockfd, (void *) &packet_size, sizeof (packet_size));
status = getaddrinfo (host, port_str, &ai_hints, &ai_return);
if (status != 0)
{
- DBG ("getaddrinfo failed: %s", status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
+ DEBUG ("getaddrinfo failed: %s", status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
return (-1);
}
if (sd < 0)
{
- DBG ("Unable to open a socket");
+ DEBUG ("Unable to open a socket");
freeaddrinfo (ai_return);
return (-1);
}
if (status != 0) /* `connect(2)' failed */
{
- DBG ("connect failed: %s", strerror (errno));
+ DEBUG ("connect failed: %s", strerror (errno));
close (sd);
return (-1);
}
- DBG ("Done opening a socket %i", sd);
+ DEBUG ("Done opening a socket %i", sd);
return (sd);
} /* int net_open (char *host, char *service, int port) */
packet_size = ntohs (packet_size);
if (packet_size > buflen)
{
- DBG ("record length too large");
+ DEBUG ("record length too large");
return (-2);
}
if (net_send (&global_sockfd, "status", 6) < 0)
{
- syslog (LOG_ERR, "apcups plugin: Writing to the socket failed.");
+ ERROR ("apcups plugin: Writing to the socket failed.");
return (-1);
}
if (n < 0)
{
- syslog (LOG_WARNING, "apcups plugin: Error reading from socket");
+ WARNING ("apcups plugin: Error reading from socket");
return (-1);
}
int port_tmp = atoi (value);
if (port_tmp < 1 || port_tmp > 65535)
{
- syslog (LOG_WARNING, "apcups plugin: Invalid port: %i", port_tmp);
+ WARNING ("apcups plugin: Invalid port: %i", port_tmp);
return (1);
}
conf_port = port_tmp;
*/
if (status != 0)
{
- DBG ("apc_query_server (%s, %i) = %i",
+ DEBUG ("apc_query_server (%s, %i) = %i",
conf_host == NULL
? APCUPS_DEFAULT_HOST
: conf_host,
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index 29d509157723e7939acbf2988ad899764025010e..f994b3194f373346baa2e1af6cff798d764ccd41 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#if HAVE_CTYPE_H
# include <ctype.h>
status = IOMasterPort (MACH_PORT_NULL, &io_master_port);
if (status != kIOReturnSuccess)
{
- syslog (LOG_ERR, "IOMasterPort failed: %s",
+ ERROR ("IOMasterPort failed: %s",
mach_error_string (status));
io_master_port = MACH_PORT_NULL;
return (-1);
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- DBG ("type = %s; type_instance = %s; val = %f;",
+ DEBUG ("type = %s; type_instance = %s; val = %f;",
type, type_instance, val);
values[0].gauge = val;
&iterator);
if (status != kIOReturnSuccess)
{
- syslog (LOG_ERR, "IOServiceGetMatchingServices failed: %s",
+ ERROR ("IOServiceGetMatchingServices failed: %s",
mach_error_string (status));
return (-1);
}
kNilOptions);
if (status != kIOReturnSuccess)
{
- DBG ("IORegistryEntryCreateCFProperties failed: %s",
+ DEBUG ("IORegistryEntryCreateCFProperties failed: %s",
mach_error_string (status));
continue;
}
}
else
{
- DBG ("apple_sensors: Read unknown sensor type: %s",
+ DEBUG ("apple_sensors: Read unknown sensor type: %s",
type);
value_double = (double) value_int;
}
diff --git a/src/battery.c b/src/battery.c
index 8a74b3db2768e7e71088dfe895356883402bf20a..85bfc00ac373cd644be8a6ca6249c60356056d3b 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
kCFStringEncodingASCII);
if (key_obj == NULL)
{
- DBG ("CFStringCreateWithCString (%s) failed.\n", key_string);
+ DEBUG ("CFStringCreateWithCString (%s) failed.\n", key_string);
return (INVALID_VALUE);
}
if ((val_obj = CFDictionaryGetValue (dict, key_obj)) == NULL)
{
- DBG ("CFDictionaryGetValue (%s) failed.", key_string);
+ DEBUG ("CFDictionaryGetValue (%s) failed.", key_string);
CFRelease (key_obj);
return (INVALID_VALUE);
}
}
else
{
- DBG ("CFGetTypeID (val_obj) = %i", (int) CFGetTypeID (val_obj));
+ DEBUG ("CFGetTypeID (val_obj) = %i", (int) CFGetTypeID (val_obj));
return (INVALID_VALUE);
}
ps_array = IOPSCopyPowerSourcesList (ps_raw);
ps_array_len = CFArrayGetCount (ps_array);
- DBG ("ps_array_len == %i", ps_array_len);
+ DEBUG ("ps_array_len == %i", ps_array_len);
for (i = 0; i < ps_array_len; i++)
{
if (ps_dict == NULL)
{
- DBG ("IOPSGetPowerSourceDescription failed.");
+ DEBUG ("IOPSGetPowerSourceDescription failed.");
continue;
}
if (CFGetTypeID (ps_dict) != CFDictionaryGetTypeID ())
{
- DBG ("IOPSGetPowerSourceDescription did not return a CFDictionaryRef");
+ DEBUG ("IOPSGetPowerSourceDescription did not return a CFDictionaryRef");
continue;
}
&iterator);
if (status != kIOReturnSuccess)
{
- DBG ("IOServiceGetMatchingServices failed.");
+ DEBUG ("IOServiceGetMatchingServices failed.");
return;
}
kNilOptions);
if (status != kIOReturnSuccess)
{
- DBG ("IORegistryEntryCreateCFProperties failed.");
+ DEBUG ("IORegistryEntryCreateCFProperties failed.");
continue;
}
if ((dh = opendir ("/proc/acpi/battery")) == NULL)
{
- syslog (LOG_ERR, "Cannot open `/proc/acpi/battery': %s", strerror (errno));
+ ERROR ("Cannot open `/proc/acpi/battery': %s", strerror (errno));
return (-1);
}
if ((fh = fopen (filename, "r")) == NULL)
{
- syslog (LOG_ERR, "Cannot open `%s': %s", filename, strerror (errno));
+ ERROR ("Cannot open `%s': %s", filename, strerror (errno));
continue;
}
diff --git a/src/collectd.c b/src/collectd.c
index 68a70bacd90e66fccd80fb46a8a5af1f6d1d8525..e873adc2d5f58890ae2590fd9993732b6efa3a3a 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
#include "collectd.h"
#include "common.h"
-#include "utils_debug.h"
#include "network.h"
#include "plugin.h"
return (-1);
}
}
- DBG ("hostname_g = %s;", hostname_g);
+ DEBUG ("hostname_g = %s;", hostname_g);
str = global_option_get ("Interval");
if (str == NULL)
"Please check your settings.\n");
return (-1);
}
- DBG ("interval_g = %i;", interval_g);
+ DEBUG ("interval_g = %i;", interval_g);
return (0);
} /* int init_global_variables */
if (dir == NULL)
{
- syslog (LOG_ERR, "strdup failed: %s", strerror (errno));
+ ERROR ("strdup failed: %s", strerror (errno));
return (-1);
}
{
if (mkdir (orig_dir, 0755) == -1)
{
- syslog (LOG_ERR, "mkdir (%s): %s", orig_dir,
+ ERROR ("mkdir (%s): %s", orig_dir,
strerror (errno));
return (-1);
}
else if (chdir (orig_dir) == -1)
{
- syslog (LOG_ERR, "chdir (%s): %s", orig_dir,
+ ERROR ("chdir (%s): %s", orig_dir,
strerror (errno));
return (-1);
}
}
else
{
- syslog (LOG_ERR, "chdir (%s): %s", orig_dir,
+ ERROR ("chdir (%s): %s", orig_dir,
strerror (errno));
return (-1);
}
if (kc == NULL)
{
if ((kc = kstat_open ()) == NULL)
- syslog (LOG_ERR, "Unable to open kstat control structure");
+ ERROR ("Unable to open kstat control structure");
}
else
{
kid = kstat_chain_update (kc);
if (kid > 0)
{
- syslog (LOG_INFO, "kstat chain has been updated");
+ INFO ("kstat chain has been updated");
plugin_init_all ();
}
else if (kid < 0)
- syslog (LOG_ERR, "kstat chain update failed");
+ ERROR ("kstat chain update failed");
/* else: everything works as expected */
}
#if HAVE_LIBSTATGRAB
if (sg_init ())
{
- syslog (LOG_ERR, "sg_init: %s", sg_str_error (sg_get_error ()));
+ ERROR ("sg_init: %s", sg_str_error (sg_get_error ()));
return (-1);
}
if (sg_drop_privileges ())
{
- syslog (LOG_ERR, "sg_drop_privileges: %s", sg_str_error (sg_get_error ()));
+ ERROR ("sg_drop_privileges: %s", sg_str_error (sg_get_error ()));
return (-1);
}
#endif
{
if (gettimeofday (&tv_next, NULL) < 0)
{
- syslog (LOG_ERR, "gettimeofday failed: %s", strerror (errno));
+ ERROR ("gettimeofday failed: %s", strerror (errno));
return (-1);
}
tv_next.tv_sec += interval_g;
if (gettimeofday (&tv_now, NULL) < 0)
{
- syslog (LOG_ERR, "gettimeofday failed: %s",
+ ERROR ("gettimeofday failed: %s",
strerror (errno));
return (-1);
}
if (timeval_sub_timespec (&tv_next, &tv_now, &ts_wait) != 0)
{
- syslog (LOG_WARNING, "Not sleeping because "
+ WARNING ("Not sleeping because "
"`timeval_sub_timespec' returned "
"non-zero!");
continue;
{
if (errno != EINTR)
{
- syslog (LOG_ERR, "nanosleep failed: %s", strerror (errno));
+ ERROR ("nanosleep failed: %s", strerror (errno));
return (-1);
}
}
} /* while (loop == 0) */
- DBG ("return (0);");
+ DEBUG ("return (0);");
return (0);
} /* int do_loop */
if ((fh = fopen (file, "w")) == NULL)
{
- syslog (LOG_ERR, "fopen (%s): %s", file, strerror (errno));
+ ERROR ("fopen (%s): %s", file, strerror (errno));
return (1);
}
{
const char *file = global_option_get ("PIDFile");
- DBG ("unlink (%s)", (file != NULL) ? file : "<null>");
+ DEBUG ("unlink (%s)", (file != NULL) ? file : "<null>");
return (unlink (file));
} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */
pid_t pid;
int daemonize = 1;
#endif
-#if COLLECT_DEBUG
- const char *logfile;
-#endif
-
- /* open syslog */
- openlog (PACKAGE, LOG_CONS | LOG_PID, LOG_DAEMON);
/* read options */
while (1)
} /* switch (c) */
} /* while (1) */
-#if COLLECT_DEBUG
- if ((logfile = global_option_get ("LogFile")) != NULL)
- DBG_STARTFILE (logfile, "Debug file opened.");
-#endif
-
/*
* Read options from the config file, the environment and the command
* line (in that order, with later options overwriting previous ones in
if (open ("/dev/null", O_RDWR) != 0)
{
- syslog (LOG_ERR, "Error: Could not connect `STDIN' to `/dev/null'");
+ ERROR ("Error: Could not connect `STDIN' to `/dev/null'");
return (1);
}
if (dup (0) != 1)
{
- syslog (LOG_ERR, "Error: Could not connect `STDOUT' to `/dev/null'");
+ ERROR ("Error: Could not connect `STDOUT' to `/dev/null'");
return (1);
}
if (dup (0) != 2)
{
- syslog (LOG_ERR, "Error: Could not connect `STDERR' to `/dev/null'");
+ ERROR ("Error: Could not connect `STDERR' to `/dev/null'");
return (1);
}
} /* if (daemonize) */
*/
do_init ();
do_loop ();
- do_shutdown ();
-
-#if COLLECT_DEBUG
- if (logfile != NULL)
- DBG_STOPFILE("debug file closed.");
-#endif
/* close syslog */
- syslog (LOG_INFO, "Exiting normally");
- closelog ();
+ INFO ("Exiting normally");
+
+ do_shutdown ();
#if COLLECT_DAEMON
if (daemonize)
diff --git a/src/common.c b/src/common.c
index 922bd15e4406077b162b40c5052e07b3ebddd5eb..ede2ea5c26aea81720b23c16555216d942aa99d2 100644 (file)
--- a/src/common.c
+++ b/src/common.c
**/
#include "common.h"
-#include "utils_debug.h"
+#include "plugin.h"
#ifdef HAVE_MATH_H
# include <math.h>
if((r = strdup (s)) == NULL)
{
- DBG ("Not enough memory.");
+ DEBUG ("Not enough memory.");
exit(3);
}
if ((r = malloc (size)) == NULL)
{
- DBG("Not enough memory.");
+ DEBUG("Not enough memory.");
exit(3);
}
if (status == 0)
{
- DBG ("Received EOF from fd %i. "
+ DEBUG ("Received EOF from fd %i. "
"Closing fd and returning error.",
fd);
close (fd);
*/
if (fields[i][0] == '.')
{
- syslog (LOG_ERR, "Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", file_orig);
+ ERROR ("Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", file_orig);
return (-2);
}
if (strjoin (dir + path_is_absolute, dir_len - path_is_absolute,
fields, i + 1, "/") < 0)
{
- syslog (LOG_ERR, "strjoin failed: `%s', component #%i", file_orig, i);
+ ERROR ("strjoin failed: `%s', component #%i", file_orig, i);
return (-1);
}
{
if (mkdir (dir, 0755) == -1)
{
- syslog (LOG_ERR, "mkdir (%s): %s", dir, strerror (errno));
+ ERROR ("mkdir (%s): %s", dir, strerror (errno));
return (-1);
}
}
else
{
- syslog (LOG_ERR, "stat (%s): %s", dir, strerror (errno));
+ ERROR ("stat (%s): %s", dir, strerror (errno));
return (-1);
}
}
else if (!S_ISDIR (statbuf.st_mode))
{
- syslog (LOG_ERR, "stat (%s): Not a directory!", dir);
+ ERROR ("stat (%s): Not a directory!", dir);
return (-1);
}
}
{
if ((*ksp_ptr = kstat_lookup (kc, module, instance, name)) == NULL)
{
- syslog (LOG_ERR, "Cound not find kstat %s", ident);
+ ERROR ("Cound not find kstat %s", ident);
return (-1);
}
if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED)
{
- syslog (LOG_WARNING, "kstat %s has wrong type", ident);
+ WARNING ("kstat %s has wrong type", ident);
*ksp_ptr = NULL;
return (-1);
}
if (kstat_read (kc, *ksp_ptr, NULL) == -1)
{
- syslog (LOG_WARNING, "kstat %s could not be read", ident);
+ WARNING ("kstat %s could not be read", ident);
return (-1);
}
if ((*ksp_ptr)->ks_type != KSTAT_TYPE_NAMED)
{
- syslog (LOG_WARNING, "kstat %s has wrong type", ident);
+ WARNING ("kstat %s has wrong type", ident);
return (-1);
}
else if (kn->data_type == KSTAT_DATA_UINT64)
retval = (long long) kn->value.ui64; /* XXX: Might overflow! */
else
- syslog (LOG_WARNING, "get_kstat_value: Not a numeric value: %s", name);
+ WARNING ("get_kstat_value: Not a numeric value: %s", name);
return (retval);
}
diff --git a/src/configfile.c b/src/configfile.c
index a5ae4961fda2bfd5901c41d19b164a75eb781410..3cc0379ba7aa82e420d2b350647277576a250eba 100644 (file)
--- a/src/configfile.c
+++ b/src/configfile.c
#include "plugin.h"
#include "configfile.h"
#include "network.h"
-#include "utils_debug.h"
#define ESCAPE_NULL(str) ((str) == NULL ? "(null)" : (str))
int ret;
int i;
- DBG ("type = %s, key = %s, value = %s",
+ DEBUG ("type = %s, key = %s, value = %s",
ESCAPE_NULL(type),
ESCAPE_NULL(orig_key),
ESCAPE_NULL(orig_value));
if ((cf_cb = cf_search (type)) == NULL)
{
- syslog (LOG_WARNING, "Plugin `%s' did not register a callback.", type);
+ WARNING ("Plugin `%s' did not register a callback.", type);
return (-1);
}
}
if (i >= cf_cb->keys_num)
- syslog (LOG_WARNING, "Plugin `%s' did not register for value `%s'.", type, key);
+ WARNING ("Plugin `%s' did not register for value `%s'.", type, key);
free (key);
free (value);
- DBG ("return (%i)", ret);
+ DEBUG ("return (%i)", ret);
return (ret);
} /* int cf_dispatch */
if (ci->children[i].children == NULL)
dispatch_value_plugin (name, ci->children + i);
else
- {DBG ("No nested config blocks allow for plugins. Yet.");}
+ {DEBUG ("No nested config blocks allow for plugins. Yet.");}
}
return (0);
{
int i;
- DBG ("option = %s; value = %s;", option, value);
+ DEBUG ("option = %s; value = %s;", option, value);
for (i = 0; i < cf_global_options_num; i++)
if (strcasecmp (cf_global_options[i].key, option) == 0)
conf = oconfig_parse_file (filename);
if (conf == NULL)
{
- syslog (LOG_ERR, "Unable to read config file %s.", filename);
+ ERROR ("Unable to read config file %s.", filename);
return (-1);
}
diff --git a/src/cpu.c b/src/cpu.c
index 285841e4d8b93d3f4c475653a791194450171848..6f18b4f4cc4b2970972cff2e111858677728decb 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#ifdef HAVE_MACH_KERN_RETURN_H
# include <mach/kern_return.h>
/* FIXME: Free `cpu_list' if it's not NULL */
if ((status = host_processors (port_host, &cpu_list, &cpu_list_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "cpu plugin: host_processors returned %i", (int) status);
+ ERROR ("cpu plugin: host_processors returned %i", (int) status);
cpu_list_len = 0;
return (-1);
}
- DBG ("host_processors returned %i %s", (int) cpu_list_len, cpu_list_len == 1 ? "processor" : "processors");
- syslog (LOG_INFO, "cpu plugin: Found %i processor%s.", (int) cpu_list_len, cpu_list_len == 1 ? "" : "s");
+ DEBUG ("host_processors returned %i %s", (int) cpu_list_len, cpu_list_len == 1 ? "processor" : "processors");
+ INFO ("cpu plugin: Found %i processor%s.", (int) cpu_list_len, cpu_list_len == 1 ? "" : "s");
collectd_step = atoi (COLLECTD_STEP);
if ((collectd_step > 0) && (collectd_step <= 86400))
if (sysctlbyname ("hw.ncpu", &numcpu, &numcpu_size, NULL, 0) < 0)
{
- syslog (LOG_WARNING, "cpu: sysctlbyname: %s", strerror (errno));
+ WARNING ("cpu: sysctlbyname: %s", strerror (errno));
return (-1);
}
if (numcpu != 1)
- syslog (LOG_NOTICE, "cpu: Only one processor supported when using `sysctlbyname' (found %i)", numcpu);
+ NOTICE ("cpu: Only one processor supported when using `sysctlbyname' (found %i)", numcpu);
#endif
return (0);
PROCESSOR_CPU_LOAD_INFO, &cpu_host,
(processor_info_t) &cpu_info, &cpu_info_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "cpu plugin: processor_info failed with status %i", (int) status);
+ ERROR ("cpu plugin: processor_info failed with status %i", (int) status);
continue;
}
if (cpu_info_len < CPU_STATE_MAX)
{
- syslog (LOG_ERR, "cpu plugin: processor_info returned only %i elements..", cpu_info_len);
+ ERROR ("cpu plugin: processor_info returned only %i elements..", cpu_info_len);
continue;
}
cpu_temp, &cpu_temp_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "cpu plugin: processor_info failed: %s",
+ ERROR ("cpu plugin: processor_info failed: %s",
mach_error_string (status));
cpu_temp_retry_counter = cpu_temp_retry_step;
if (cpu_temp_len != 1)
{
- DBG ("processor_info (PROCESSOR_TEMPERATURE) returned %i elements..?",
+ DEBUG ("processor_info (PROCESSOR_TEMPERATURE) returned %i elements..?",
(int) cpu_temp_len);
continue;
}
cpu_temp_retry_counter = 0;
cpu_temp_retry_step = 1;
- DBG ("cpu_temp = %i", (int) cpu_temp);
+ DEBUG ("cpu_temp = %i", (int) cpu_temp);
#endif /* PROCESSOR_TEMPERATURE */
}
/* #endif PROCESSOR_CPU_LOAD_INFO */
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 008ef39f1029b128c0d237994cb4293e5c9a9dff..46e8659882381443dc8dc482b008fa2e6e1a2e72 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
num_cpu++;
}
- syslog (LOG_INFO, "cpufreq plugin: Found %d CPU%s", num_cpu,
+ INFO ("cpufreq plugin: Found %d CPU%s", num_cpu,
(num_cpu == 1) ? "" : "s");
if (num_cpu == 0)
if ((fp = fopen (filename, "r")) == NULL)
{
- syslog (LOG_WARNING, "cpufreq: fopen: %s", strerror (errno));
+ WARNING ("cpufreq: fopen: %s", strerror (errno));
return (-1);
}
if (fgets (buffer, 16, fp) == NULL)
{
- syslog (LOG_WARNING, "cpufreq: fgets: %s", strerror (errno));
+ WARNING ("cpufreq: fgets: %s", strerror (errno));
fclose (fp);
return (-1);
}
if (fclose (fp))
- syslog (LOG_WARNING, "cpufreq: fclose: %s", strerror (errno));
+ WARNING ("cpufreq: fclose: %s", strerror (errno));
/* You're seeing correctly: The file is reporting kHz values.. */
val = atoll (buffer) * 1000;
diff --git a/src/csv.c b/src/csv.c
index f4b56fe0dc9254755f626bc5bf41b9acb2127510..62b6b2c77c48f34e898d90e5a1e496631168c731 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
#include "collectd.h"
#include "plugin.h"
#include "common.h"
-#include "utils_debug.h"
/*
* Private variables
now = time (NULL);
if (localtime_r (&now, &stm) == NULL)
{
- syslog (LOG_ERR, "csv plugin: localtime_r failed");
+ ERROR ("csv plugin: localtime_r failed");
return (1);
}
csv = fopen (filename, "w");
if (csv == NULL)
{
- syslog (LOG_ERR, "csv plugin: fopen (%s) failed: %s",
+ ERROR ("csv plugin: fopen (%s) failed: %s",
filename, strerror(errno));
return (-1);
}
if (value_list_to_filename (filename, sizeof (filename), ds, vl) != 0)
return (-1);
- DBG ("filename = %s;", filename);
+ DEBUG ("filename = %s;", filename);
if (value_list_to_string (values, sizeof (values), ds, vl) != 0)
return (-1);
}
else
{
- syslog (LOG_ERR, "stat(%s) failed: %s",
+ ERROR ("stat(%s) failed: %s",
filename, strerror (errno));
return (-1);
}
}
else if (!S_ISREG (statbuf.st_mode))
{
- syslog (LOG_ERR, "stat(%s): Not a regular file!",
+ ERROR ("stat(%s): Not a regular file!",
filename);
return (-1);
}
csv = fopen (filename, "a");
if (csv == NULL)
{
- syslog (LOG_ERR, "csv plugin: fopen (%s) failed: %s",
+ ERROR ("csv plugin: fopen (%s) failed: %s",
filename, strerror (errno));
return (-1);
}
status = fcntl (csv_fd, F_SETLK, &fl);
if (status != 0)
{
- syslog (LOG_ERR, "csv plugin: flock (%s) failed: %s",
+ ERROR ("csv plugin: flock (%s) failed: %s",
filename, strerror (errno));
fclose (csv);
return (-1);
diff --git a/src/df.c b/src/df.c
index fde5d9ae503692b492286604f561c747350f850a..6ec51fe314671fb28b885db27deaaa5b17882423 100644 (file)
--- a/src/df.c
+++ b/src/df.c
{
if (STATANYFS (mnt_ptr->dir, &statbuf) < 0)
{
- syslog (LOG_ERR, "statv?fs failed: %s", strerror (errno));
+ ERROR ("statv?fs failed: %s", strerror (errno));
continue;
}
diff --git a/src/disk.c b/src/disk.c
index af7c01a60e39da34d92635d9c0b9a0c5b1276621..36d7b4fab0b5317d50c92f535ed78fe4bd5c5ead 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
status = IOMasterPort (MACH_PORT_NULL, &io_master_port);
if (status != kIOReturnSuccess)
{
- syslog (LOG_ERR, "IOMasterPort failed: %s",
+ ERROR ("IOMasterPort failed: %s",
mach_error_string (status));
io_master_port = MACH_PORT_NULL;
return (-1);
assert (heartbeat >= step);
min_poll_count = 1 + (heartbeat / step);
- DBG ("min_poll_count = %i;", min_poll_count);
+ DEBUG ("min_poll_count = %i;", min_poll_count);
/* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
kCFStringEncodingASCII);
if (key_obj == NULL)
{
- DBG ("CFStringCreateWithCString (%s) failed.", key);
+ DEBUG ("CFStringCreateWithCString (%s) failed.", key);
return (-1LL);
}
@@ -241,13 +240,13 @@ static signed long long dict_get_value (CFDictionaryRef dict, const char *key)
if (val_obj == NULL)
{
- DBG ("CFDictionaryGetValue (%s) failed.", key);
+ DEBUG ("CFDictionaryGetValue (%s) failed.", key);
return (-1LL);
}
if (!CFNumberGetValue (val_obj, kCFNumberSInt64Type, &val_int))
{
- DBG ("CFNumberGetValue (%s) failed.", key);
+ DEBUG ("CFNumberGetValue (%s) failed.", key);
return (-1LL);
}
!= kIOReturnSuccess)
{
/* This fails for example for DVD/CD drives.. */
- DBG ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
+ DEBUG ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
IOObjectRelease (disk);
continue;
}
kNilOptions)
!= kIOReturnSuccess)
{
- syslog (LOG_ERR, "disk-plugin: IORegistryEntryCreateCFProperties failed.");
+ ERROR ("disk-plugin: IORegistryEntryCreateCFProperties failed.");
IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
if (props_dict == NULL)
{
- DBG ("IORegistryEntryCreateCFProperties (disk) failed.");
+ DEBUG ("IORegistryEntryCreateCFProperties (disk) failed.");
IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
if (stats_dict == NULL)
{
- DBG ("CFDictionaryGetValue (%s) failed.",
+ DEBUG ("CFDictionaryGetValue (%s) failed.",
kIOBlockStorageDriverStatisticsKey);
CFRelease (props_dict);
IOObjectRelease (disk_child);
kNilOptions)
!= kIOReturnSuccess)
{
- DBG ("IORegistryEntryCreateCFProperties (disk_child) failed.");
+ DEBUG ("IORegistryEntryCreateCFProperties (disk_child) failed.");
IOObjectRelease (disk_child);
CFRelease (props_dict);
IOObjectRelease (disk);
if (snprintf (disk_name, 64, "%i-%i", disk_major, disk_minor) >= 64)
{
- DBG ("snprintf (major, minor) failed.");
+ DEBUG ("snprintf (major, minor) failed.");
CFRelease (child_dict);
IOObjectRelease (disk_child);
CFRelease (props_dict);
IOObjectRelease (disk);
continue;
}
- DBG ("disk_name = %s", disk_name);
+ DEBUG ("disk_name = %s", disk_name);
if ((read_byt != -1LL) || (write_byt != -1LL))
disk_submit (disk_name, "disk_octets", read_byt, write_byt);
}
else
{
- DBG ("numfields = %i; => unknown file format.", numfields);
+ DEBUG ("numfields = %i; => unknown file format.", numfields);
continue;
}
ds->poll_count++;
if (ds->poll_count <= min_poll_count)
{
- DBG ("(ds->poll_count = %i) <= (min_poll_count = %i); => Not writing.",
+ DEBUG ("(ds->poll_count = %i) <= (min_poll_count = %i); => Not writing.",
ds->poll_count, min_poll_count);
continue;
}
if ((read_count == 0) && (write_count == 0))
{
- DBG ("((read_count == 0) && (write_count == 0)); => Not writing.");
+ DEBUG ("((read_count == 0) && (write_count == 0)); => Not writing.");
continue;
}
diff --git a/src/dns.c b/src/dns.c
index 56df1845ad512a3ea3c2e0f3f6061cd7760bb097..11dc287425fde2e2bc725fb67ccd8481ed536202 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_LIBPCAP && HAVE_LIBPTHREAD
# include "utils_dns.h"
@@ -117,14 +116,14 @@ static counter_list_t *counter_list_search (counter_list_t **list, unsigned int
{
counter_list_t *entry;
- DBG ("counter_list_search (list = %p, key = %u)",
+ DEBUG ("counter_list_search (list = %p, key = %u)",
(void *) *list, key);
for (entry = *list; entry != NULL; entry = entry->next)
if (entry->key == key)
break;
- DBG ("return (%p)", (void *) entry);
+ DEBUG ("return (%p)", (void *) entry);
return (entry);
}
{
counter_list_t *entry;
- DBG ("counter_list_create (list = %p, key = %u, value = %u)",
+ DEBUG ("counter_list_create (list = %p, key = %u, value = %u)",
(void *) *list, key, value);
entry = (counter_list_t *) malloc (sizeof (counter_list_t));
last->next = entry;
}
- DBG ("return (%p)", (void *) entry);
+ DEBUG ("return (%p)", (void *) entry);
return (entry);
}
{
counter_list_t *entry;
- DBG ("counter_list_add (list = %p, key = %u, increment = %u)",
+ DEBUG ("counter_list_add (list = %p, key = %u, increment = %u)",
(void *) *list, key, increment);
entry = counter_list_search (list, key);
{
counter_list_create (list, key, increment);
}
- DBG ("return ()");
+ DEBUG ("return ()");
}
static int dns_config (const char *key, const char *value)
}
/* Passing `pcap_device == NULL' is okay and the same as passign "any" */
- DBG ("Creating PCAP object..");
+ DEBUG ("Creating PCAP object..");
pcap_obj = pcap_open_live (pcap_device,
PCAP_SNAPLEN,
0 /* Not promiscuous */,
pcap_error);
if (pcap_obj == NULL)
{
- syslog (LOG_ERR, "dns plugin: Opening interface `%s' "
+ ERROR ("dns plugin: Opening interface `%s' "
"failed: %s",
(pcap_device != NULL) ? pcap_device : "any",
pcap_error);
memset (&fp, 0, sizeof (fp));
if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0)
{
- DBG ("pcap_compile failed");
- syslog (LOG_ERR, "dns plugin: pcap_compile failed");
+ DEBUG ("pcap_compile failed");
+ ERROR ("dns plugin: pcap_compile failed");
return (NULL);
}
if (pcap_setfilter (pcap_obj, &fp) < 0)
{
- DBG ("pcap_setfilter failed");
- syslog (LOG_ERR, "dns plugin: pcap_setfilter failed");
+ DEBUG ("pcap_setfilter failed");
+ ERROR ("dns plugin: pcap_setfilter failed");
return (NULL);
}
- DBG ("PCAP object created.");
+ DEBUG ("PCAP object created.");
dnstop_set_pcap_obj (pcap_obj);
dnstop_set_callback (dns_child_callback);
handle_pcap /* callback */,
NULL /* Whatever this means.. */);
if (status < 0)
- syslog (LOG_ERR, "dns plugin: Listener thread is exiting "
+ ERROR ("dns plugin: Listener thread is exiting "
"abnormally: %s", pcap_geterr (pcap_obj));
- DBG ("child is exiting");
+ DEBUG ("child is exiting");
pcap_close (pcap_obj);
listen_thread_init = 0;
(void *) 0);
if (status != 0)
{
- syslog (LOG_ERR, "dns plugin: pthread_create failed: %s",
+ ERROR ("dns plugin: pthread_create failed: %s",
strerror (status));
return (-1);
}
for (i = 0; i < len; i++)
{
- DBG ("qtype = %u; counter = %u;", keys[i], values[i]);
+ DEBUG ("qtype = %u; counter = %u;", keys[i], values[i]);
submit_counter ("dns_qtype", qtype_str (keys[i]), values[i]);
}
for (i = 0; i < len; i++)
{
- DBG ("opcode = %u; counter = %u;", keys[i], values[i]);
+ DEBUG ("opcode = %u; counter = %u;", keys[i], values[i]);
submit_counter ("dns_opcode", opcode_str (keys[i]), values[i]);
}
for (i = 0; i < len; i++)
{
- DBG ("rcode = %u; counter = %u;", keys[i], values[i]);
+ DEBUG ("rcode = %u; counter = %u;", keys[i], values[i]);
submit_counter ("dns_rcode", rcode_str (keys[i]), values[i]);
}
diff --git a/src/email.c b/src/email.c
index ed0f9a2f8a1a3692a9e2d1ea2920e3f33ab22f90..a0278336f059bd5a79fe1fde2d69c43e0e4b795e 100644 (file)
--- a/src/email.c
+++ b/src/email.c
#define MAX_CONNS 5
#define MAX_CONNS_LIMIT 16384
-#define log_err(...) syslog (LOG_ERR, MODULE_NAME": "__VA_ARGS__)
-#define log_warn(...) syslog (LOG_WARNING, MODULE_NAME": "__VA_ARGS__)
+#define log_err(...) ERROR (MODULE_NAME": "__VA_ARGS__)
+#define log_warn(...) WARNING (MODULE_NAME": "__VA_ARGS__)
/*
* Private data structures
diff --git a/src/exec.c b/src/exec.c
index 63401bec3c4c53f79b6206cf81a3bea3fb870d63..fa0196b3470a85b01fc309fde54973945c17245e 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#include <sys/types.h>
#include <pwd.h>
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- DBG ("type_instance = %s; value = %llu;", type_instance, value);
+ DEBUG ("type_instance = %s; value = %llu;", type_instance, value);
values[0].counter = value;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- DBG ("type_instance = %s; value = %lf;", type_instance, value);
+ DEBUG ("type_instance = %s; value = %lf;", type_instance, value);
values[0].gauge = value;
status = getpwnam_r (pl->user, &sp, pwnambuf, sizeof (pwnambuf), &sp_ptr);
if (status != 0)
{
- syslog (LOG_ERR, "exec plugin: getpwnam_r failed: %s", strerror (status));
+ ERROR ("exec plugin: getpwnam_r failed: %s", strerror (status));
exit (-1);
}
if (sp_ptr == NULL)
{
- syslog (LOG_ERR, "exec plugin: No such user: `%s'", pl->user);
+ ERROR ("exec plugin: No such user: `%s'", pl->user);
exit (-1);
}
uid = sp.pw_uid;
if (uid == 0)
{
- syslog (LOG_ERR, "exec plugin: Cowardly refusing to exec program as root.");
+ ERROR ("exec plugin: Cowardly refusing to exec program as root.");
exit (-1);
}
status = setuid (uid);
if (status != 0)
{
- syslog (LOG_ERR, "exec plugin: setuid failed: %s", strerror (errno));
+ ERROR ("exec plugin: setuid failed: %s", strerror (errno));
exit (-1);
}
status = execlp (pl->exec, arg0, (char *) 0);
- syslog (LOG_ERR, "exec plugin: exec failed: %s", strerror (errno));
+ ERROR ("exec plugin: exec failed: %s", strerror (errno));
exit (-1);
} /* void exec_child */
status = pipe (fd_pipe);
if (status != 0)
{
- syslog (LOG_ERR, "exec plugin: pipe failed: %s", strerror (errno));
+ ERROR ("exec plugin: pipe failed: %s", strerror (errno));
return (-1);
}
pl->pid = fork ();
if (pl->pid < 0)
{
- syslog (LOG_ERR, "exec plugin: fork failed: %s", strerror (errno));
+ ERROR ("exec plugin: fork failed: %s", strerror (errno));
return (-1);
}
else if (pl->pid == 0)
fh = fdopen (fd, "r");
if (fh == NULL)
{
- syslog (LOG_ERR, "exec plugin: fdopen (%i) failed: %s", fd,
+ ERROR ("exec plugin: fdopen (%i) failed: %s", fd,
strerror (errno));
kill (pl->pid, SIGTERM);
close (fd);
char *type_instance;
char *value;
- DBG ("buffer = %s", buffer);
+ DEBUG ("buffer = %s", buffer);
len = strlen (buffer);
if (len < 5)
if ((strcasecmp ("counter", type) != 0)
&& (strcasecmp ("gauge", type) != 0))
{
- syslog (LOG_WARNING, "exec plugin: Received invalid type: %s", type);
+ WARNING ("exec plugin: Received invalid type: %s", type);
continue;
}
*value = '\0';
value++;
- DBG ("value = %s", value);
+ DEBUG ("value = %s", value);
if (strcasecmp ("counter", type) == 0)
submit_counter (type_instance, atoll (value));
diff --git a/src/hddtemp.c b/src/hddtemp.c
index 353fbe3cae4196a07005a613286a403f761060f6..c2ff19e5773144717bd1657d6f94aa9e46fdc16e 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_NETDB_H && HAVE_SYS_SOCKET_H && HAVE_NETINET_IN_H \
&& HAVE_NETINET_TCP_H && HAVE_LIBGEN_H
if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
- syslog (LOG_ERR, "hddtemp: getaddrinfo (%s, %s): %s",
+ ERROR ("hddtemp: getaddrinfo (%s, %s): %s",
host, port,
ai_return == EAI_SYSTEM ? strerror (errno) : gai_strerror (ai_return));
return (-1);
/* create our socket descriptor */
if ((fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol)) < 0)
{
- syslog (LOG_ERR, "hddtemp: socket: %s",
+ ERROR ("hddtemp: socket: %s",
strerror (errno));
continue;
}
/* connect to the hddtemp daemon */
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
- DBG ("hddtemp: connect (%s, %s): %s", host, port,
+ DEBUG ("hddtemp: connect (%s, %s): %s", host, port,
strerror (errno));
close (fd);
fd = -1;
if (fd < 0)
{
- syslog (LOG_ERR, "hddtemp: Could not connect to daemon.");
+ ERROR ("hddtemp: Could not connect to daemon.");
return (-1);
}
if ((errno == EAGAIN) || (errno == EINTR))
continue;
- syslog (LOG_ERR, "hddtemp: Error reading from socket: %s",
+ ERROR ("hddtemp: Error reading from socket: %s",
strerror (errno));
close (fd);
return (-1);
if (buffer_fill >= buffer_size)
{
buffer[buffer_size - 1] = '\0';
- syslog (LOG_WARNING, "hddtemp: Message from hddtemp has been truncated.");
+ WARNING ("hddtemp: Message from hddtemp has been truncated.");
}
else if (buffer_fill == 0)
{
- syslog (LOG_WARNING, "hddtemp: Peer has unexpectedly shut down the socket. "
+ WARNING ("hddtemp: Peer has unexpectedly shut down the socket. "
"Buffer: `%s'", buffer);
close (fd);
return (-1);
if ((fh = fopen ("/proc/partitions", "r")) != NULL)
{
- DBG ("Looking at /proc/partitions...");
+ DEBUG ("Looking at /proc/partitions...");
while (fgets (buf, sizeof (buf), fh) != NULL)
{
/* Skip all other majors. */
default:
- DBG ("Skipping unknown major %i", major);
+ DEBUG ("Skipping unknown major %i", major);
continue;
} /* switch (major) */
if ((name = strdup (fields[3])) == NULL)
{
- syslog (LOG_ERR, "hddtemp: strdup(%s) == NULL", fields[3]);
+ ERROR ("hddtemp: strdup(%s) == NULL", fields[3]);
continue;
}
if ((entry = (hddname_t *) malloc (sizeof (hddname_t))) == NULL)
{
- syslog (LOG_ERR, "hddtemp: malloc (%u) == NULL",
+ ERROR ("hddtemp: malloc (%u) == NULL",
(unsigned int) sizeof (hddname_t));
free (name);
continue;
}
- DBG ("Found disk: %s (%u:%u).", name, major, minor);
+ DEBUG ("Found disk: %s (%u:%u).", name, major, minor);
entry->major = major;
entry->minor = minor;
fclose (fh);
}
else
- DBG ("Could not open /proc/partitions: %s",
+ DEBUG ("Could not open /proc/partitions: %s",
strerror (errno));
#endif /* KERNEL_LINUX */
if (list == NULL)
{
- DBG ("Don't know %s, keeping name as-is.", drive);
+ DEBUG ("Don't know %s, keeping name as-is.", drive);
return (strdup (drive));
}
diff --git a/src/iptables.c b/src/iptables.c
index b6aa938ea631f546fdceb221f254e36aaa9f48a1..bc15559317c3f533c9bca9dcf5e9e306e87f5747 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_LIBIPTC_LIBIPTC_H
# include <libiptc/libiptc.h>
diff --git a/src/irq.c b/src/irq.c
index 6c30e95a752bb4583ca6ce466279062cdfb7e094..d44ac0b3a53373c4f994398cfa05000b7091f0ff 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
if (temp == NULL)
{
fprintf (stderr, "irq plugin: Cannot allocate more memory.\n");
- syslog (LOG_ERR, "irq plugin: Cannot allocate more memory.");
+ ERROR ("irq plugin: Cannot allocate more memory.");
return (1);
}
irq_list = temp;
{
fprintf (stderr, "irq plugin: Irq value is not a "
"number: `%s'\n", value);
- syslog (LOG_ERR, "irq plugin: Irq value is not a "
+ ERROR ("irq plugin: Irq value is not a "
"number: `%s'", value);
return (1);
}
if ((fh = fopen ("/proc/interrupts", "r")) == NULL)
{
- syslog (LOG_WARNING, "irq plugin: fopen (/proc/interrupts): %s",
+ WARNING ("irq plugin: fopen (/proc/interrupts): %s",
strerror (errno));
return (-1);
}
diff --git a/src/load.c b/src/load.c
index 08766556f225ab600183a233f8144a30fd4a55eb..aaba3a5f2c650bcf54928000498ba47ec9b18565 100644 (file)
--- a/src/load.c
+++ b/src/load.c
if (getloadavg (load, 3) == 3)
load_submit (load[LOADAVG_1MIN], load[LOADAVG_5MIN], load[LOADAVG_15MIN]);
else
- syslog (LOG_WARNING, "load: getloadavg failed: %s", strerror (errno));
+ WARNING ("load: getloadavg failed: %s", strerror (errno));
/* #endif HAVE_GETLOADAVG */
#elif defined(KERNEL_LINUX)
if ((loadavg = fopen ("/proc/loadavg", "r")) == NULL)
{
- syslog (LOG_WARNING, "load: fopen: %s", strerror (errno));
+ WARNING ("load: fopen: %s", strerror (errno));
return;
}
if (fgets (buffer, 16, loadavg) == NULL)
{
- syslog (LOG_WARNING, "load: fgets: %s", strerror (errno));
+ WARNING ("load: fgets: %s", strerror (errno));
fclose (loadavg);
return;
}
if (fclose (loadavg))
- syslog (LOG_WARNING, "load: fclose: %s", strerror (errno));
+ WARNING ("load: fclose: %s", strerror (errno));
numfields = strsplit (buffer, fields, 8);
diff --git a/src/mbmon.c b/src/mbmon.c
index e03f2f9b627d5ad61454e4ccd77993e5d74ecd3f..241d7d042b57e8a88f165cb643c0f731c598c3af 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_NETDB_H && HAVE_SYS_SOCKET_H && HAVE_NETINET_IN_H && HAVE_NETINET_TCP_H
# include <netdb.h>
if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
- syslog (LOG_ERR, "mbmon: getaddrinfo (%s, %s): %s",
+ ERROR ("mbmon: getaddrinfo (%s, %s): %s",
host, port,
ai_return == EAI_SYSTEM ? strerror (errno) : gai_strerror (ai_return));
return (-1);
/* create our socket descriptor */
if ((fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol)) < 0)
{
- syslog (LOG_ERR, "mbmon: socket: %s",
+ ERROR ("mbmon: socket: %s",
strerror (errno));
continue;
}
/* connect to the mbmon daemon */
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
- DBG ("mbmon: connect (%s, %s): %s", host, port,
+ DEBUG ("mbmon: connect (%s, %s): %s", host, port,
strerror (errno));
close (fd);
fd = -1;
if (fd < 0)
{
- syslog (LOG_ERR, "mbmon: Could not connect to daemon.");
+ ERROR ("mbmon: Could not connect to daemon.");
return (-1);
}
if ((errno == EAGAIN) || (errno == EINTR))
continue;
- syslog (LOG_ERR, "mbmon: Error reading from socket: %s",
+ ERROR ("mbmon: Error reading from socket: %s",
strerror (errno));
close (fd);
return (-1);
if (buffer_fill >= buffer_size)
{
buffer[buffer_size - 1] = '\0';
- syslog (LOG_WARNING, "mbmon: Message from mbmon has been truncated.");
+ WARNING ("mbmon: Message from mbmon has been truncated.");
}
else if (buffer_fill == 0)
{
- syslog (LOG_WARNING, "mbmon: Peer has unexpectedly shut down the socket. "
+ WARNING ("mbmon: Peer has unexpectedly shut down the socket. "
"Buffer: `%s'", buffer);
close (fd);
return (-1);
value = strtod (t, &nextc);
if ((*nextc != '\n') && (*nextc != '\0'))
{
- syslog (LOG_ERR, "mbmon: value for `%s' contains invalid characters: `%s'", s, t);
+ ERROR ("mbmon: value for `%s' contains invalid characters: `%s'", s, t);
break;
}
diff --git a/src/memory.c b/src/memory.c
index 38a6dc2d3474d4d1d8924be78f1cd1bea95b44ce..916802794c94b8a1e4339036900c41048fedfc9a 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#ifdef HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
(host_info_t) &vm_data,
&vm_data_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "memory-plugin: host_statistics failed and returned the value %i", (int) status);
+ ERROR ("memory-plugin: host_statistics failed and returned the value %i", (int) status);
return (-1);
}
(void *) &sysctl_vals[i], &len,
NULL, 0)) < 0)
{
- syslog (LOG_ERR, "memory plugin: sysctlbyname (%s): %s",
+ ERROR ("memory plugin: sysctlbyname (%s): %s",
sysctl_keys[i], strerror (errno));
return (-1);
}
- DBG ("%26s: %6i", sysctl_keys[i], sysctl_vals[i]);
+ DEBUG ("%26s: %6i", sysctl_keys[i], sysctl_vals[i]);
} /* for i */
/* multiply all all page counts with the pagesize */
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
- syslog (LOG_WARNING, "memory: fopen: %s", strerror (errno));
+ WARNING ("memory: fopen: %s", strerror (errno));
return (-1);
}
}
if (fclose (fh))
- syslog (LOG_WARNING, "memory: fclose: %s", strerror (errno));
+ WARNING ("memory: fclose: %s", strerror (errno));
if (mem_used >= (mem_free + mem_buffered + mem_cached))
{
diff --git a/src/multimeter.c b/src/multimeter.c
index 8cb18c81227ae84e714f2f5a37eff8533250966b..04196bbefb3e9d5460aced62e0be2cac47188033 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
if (gettimeofday (&time_end, NULL) < 0)
{
- syslog (LOG_ERR, "multimeter plugin: gettimeofday failed: %s",
+ ERROR ("multimeter plugin: gettimeofday failed: %s",
strerror (errno));
return (-1);
}
if (gettimeofday (&time_now, NULL) < 0)
{
- syslog (LOG_ERR, "multimeter plugin: "
+ ERROR ("multimeter plugin: "
"gettimeofday failed: %s",
strerror (errno));
return (-1);
}
else /* status == -1 */
{
- syslog (LOG_ERR, "multimeter plugin: "
+ ERROR ("multimeter plugin: "
"select failed: %s",
strerror (errno));
break;
}
else
{
- syslog (LOG_INFO, "multimeter plugin: Device "
+ INFO ("multimeter plugin: Device "
"found at %s", device);
return (0);
}
}
}
- syslog (LOG_ERR, "multimeter plugin: No device found");
+ ERROR ("multimeter plugin: No device found");
return (-1);
}
#undef LINE_LENGTH
diff --git a/src/mysql.c b/src/mysql.c
index a2604e409629d3b6874036bac2a01bc4231a942e..f622d3d653c440244719ba546b7512da5d641049 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
int err;
if ((err = mysql_ping (con)) != 0)
{
- syslog (LOG_WARNING, "mysql_ping failed: %s", mysql_error (con));
+ WARNING ("mysql_ping failed: %s", mysql_error (con));
state = 0;
}
else
if ((con = mysql_init (con)) == NULL)
{
- syslog (LOG_ERR, "mysql_init failed: %s", mysql_error (con));
+ ERROR ("mysql_init failed: %s", mysql_error (con));
state = 0;
return (NULL);
}
if (mysql_real_connect (con, host, user, pass, db, 0, NULL, 0) == NULL)
{
- syslog (LOG_ERR, "mysql_real_connect failed: %s", mysql_error (con));
+ ERROR ("mysql_real_connect failed: %s", mysql_error (con));
state = 0;
return (NULL);
}
if (mysql_real_query (con, query, query_len))
{
- syslog (LOG_ERR, "mysql_real_query failed: %s\n",
+ ERROR ("mysql_real_query failed: %s\n",
mysql_error (con));
return (-1);
}
if ((res = mysql_store_result (con)) == NULL)
{
- syslog (LOG_ERR, "mysql_store_result failed: %s\n",
+ ERROR ("mysql_store_result failed: %s\n",
mysql_error (con));
return (-1);
}
diff --git a/src/network.c b/src/network.c
index cf2a01799cbb1723c710357be176810aac053fb6..6c6e0f60a69fc1478efab4ba46a3cdb03f0971b1 100644 (file)
--- a/src/network.c
+++ b/src/network.c
#include "plugin.h"
#include "common.h"
#include "configfile.h"
-#include "utils_debug.h"
#include "network.h"
if (buffer_len < (15))
{
- DBG ("packet is too short: buffer_len = %i", buffer_len);
+ DEBUG ("packet is too short: buffer_len = %i", buffer_len);
return (-1);
}
if (h_num != ((h_length - 6) / 9))
{
- DBG ("`length' and `num of values' don't match");
+ DEBUG ("`length' and `num of values' don't match");
return (-1);
}
uint16_t h_length;
uint16_t h_type;
- DBG ("ret_buffer = %p; ret_buffer_len = %i; output = %p; output_len = %i;",
+ DEBUG ("ret_buffer = %p; ret_buffer_len = %i; output = %p; output_len = %i;",
*ret_buffer, *ret_buffer_len,
(void *) output, output_len);
h_length = ntohs (ps.head->length);
h_type = ntohs (ps.head->type);
- DBG ("length = %hu; type = %hu;", h_length, h_type);
+ DEBUG ("length = %hu; type = %hu;", h_length, h_type);
if (buffer_len < h_length)
{
- DBG ("packet is too short");
+ DEBUG ("packet is too short");
return (-1);
}
assert ((h_type == TYPE_HOST)
ps.value = buffer + 4;
if (ps.value[h_length - 5] != '\0')
{
- DBG ("String does not end with a nullbyte");
+ DEBUG ("String does not end with a nullbyte");
return (-1);
}
if (output_len < (h_length - 4))
{
- DBG ("output buffer is too small");
+ DEBUG ("output buffer is too small");
return (-1);
}
strcpy (output, ps.value);
- DBG ("output = %s", output);
+ DEBUG ("output = %s", output);
*ret_buffer = (void *) (buffer + h_length);
*ret_buffer_len = buffer_len - h_length;
value_list_t vl = VALUE_LIST_INIT;
char type[DATA_MAX_NAME_LEN];
- DBG ("buffer = %p; buffer_len = %i;", buffer, buffer_len);
+ DEBUG ("buffer = %p; buffer_len = %i;", buffer, buffer_len);
memset (&vl, '\0', sizeof (vl));
memset (&type, '\0', sizeof (type));
if (status != 0)
{
- DBG ("parse_part_values failed.");
+ DEBUG ("parse_part_values failed.");
break;
}
&& (strlen (vl.plugin) > 0)
&& (strlen (type) > 0))
{
- DBG ("dispatching values");
+ DEBUG ("dispatching values");
plugin_dispatch_values (type, &vl);
}
else
{
- DBG ("NOT dispatching values");
+ DEBUG ("NOT dispatching values");
}
}
else if (header->type == ntohs (TYPE_TIME))
}
else
{
- DBG ("Unknown part type: 0x%0hx", header->type);
+ DEBUG ("Unknown part type: 0x%0hx", header->type);
buffer = ((char *) buffer) + header->length;
}
} /* while (buffer_len > sizeof (part_header_t)) */
if ((network_config_ttl < 1) || (network_config_ttl > 255))
return (-1);
- DBG ("ttl = %i", network_config_ttl);
+ DEBUG ("ttl = %i", network_config_ttl);
if (ai->ai_family == AF_INET)
{
&network_config_ttl,
sizeof (network_config_ttl)) == -1)
{
- syslog (LOG_ERR, "setsockopt: %s", strerror (errno));
+ ERROR ("setsockopt: %s", strerror (errno));
return (-1);
}
}
&network_config_ttl,
sizeof (network_config_ttl)) == -1)
{
- syslog (LOG_ERR, "setsockopt: %s", strerror (errno));
+ ERROR ("setsockopt: %s", strerror (errno));
return (-1);
}
}
@@ -533,11 +532,11 @@ static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
{
int loop = 1;
- DBG ("fd = %i; calling `bind'", se->fd);
+ DEBUG ("fd = %i; calling `bind'", se->fd);
if (bind (se->fd, ai->ai_addr, ai->ai_addrlen) == -1)
{
- syslog (LOG_ERR, "bind: %s", strerror (errno));
+ ERROR ("bind: %s", strerror (errno));
return (-1);
}
{
struct ip_mreq mreq;
- DBG ("fd = %i; IPv4 multicast address found", se->fd);
+ DEBUG ("fd = %i; IPv4 multicast address found", se->fd);
mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr;
mreq.imr_interface.s_addr = htonl (INADDR_ANY);
@@ -556,14 +555,14 @@ static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
if (setsockopt (se->fd, IPPROTO_IP, IP_MULTICAST_LOOP,
&loop, sizeof (loop)) == -1)
{
- syslog (LOG_ERR, "setsockopt: %s", strerror (errno));
+ ERROR ("setsockopt: %s", strerror (errno));
return (-1);
}
if (setsockopt (se->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
&mreq, sizeof (mreq)) == -1)
{
- syslog (LOG_ERR, "setsockopt: %s", strerror (errno));
+ ERROR ("setsockopt: %s", strerror (errno));
return (-1);
}
}
{
struct ipv6_mreq mreq;
- DBG ("fd = %i; IPv6 multicast address found", se->fd);
+ DEBUG ("fd = %i; IPv6 multicast address found", se->fd);
memcpy (&mreq.ipv6mr_multiaddr,
&addr->sin6_addr,
@@ -596,14 +595,14 @@ static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
if (setsockopt (se->fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
&loop, sizeof (loop)) == -1)
{
- syslog (LOG_ERR, "setsockopt: %s", strerror (errno));
+ ERROR ("setsockopt: %s", strerror (errno));
return (-1);
}
if (setsockopt (se->fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP,
&mreq, sizeof (mreq)) == -1)
{
- syslog (LOG_ERR, "setsockopt: %s", strerror (errno));
+ ERROR ("setsockopt: %s", strerror (errno));
return (-1);
}
}
sockent_t *se_head = NULL;
sockent_t *se_tail = NULL;
- DBG ("node = %s, service = %s", node, service);
+ DEBUG ("node = %s, service = %s", node, service);
memset (&ai_hints, '\0', sizeof (ai_hints));
ai_hints.ai_flags = 0;
ai_return = getaddrinfo (node, service, &ai_hints, &ai_list);
if (ai_return != 0)
{
- syslog (LOG_ERR, "getaddrinfo (%s, %s): %s",
+ ERROR ("getaddrinfo (%s, %s): %s",
(node == NULL) ? "(null)" : node,
(service == NULL) ? "(null)" : service,
(ai_return == EAI_SYSTEM)
if ((se = (sockent_t *) malloc (sizeof (sockent_t))) == NULL)
{
- syslog (LOG_EMERG, "malloc: %s", strerror (errno));
+ ERROR ("malloc: %s", strerror (errno));
continue;
}
if ((se->addr = (struct sockaddr_storage *) malloc (sizeof (struct sockaddr_storage))) == NULL)
{
- syslog (LOG_EMERG, "malloc: %s", strerror (errno));
+ ERROR ("malloc: %s", strerror (errno));
free (se);
continue;
}
if (se->fd == -1)
{
- syslog (LOG_ERR, "socket: %s", strerror (errno));
+ ERROR ("socket: %s", strerror (errno));
free (se->addr);
free (se);
continue;
if (listen_sockets_num == 0)
{
- syslog (LOG_ERR, "network: Failed to open a listening socket.");
+ ERROR ("network: Failed to open a listening socket.");
return (-1);
}
{
if (errno == EINTR)
continue;
- syslog (LOG_ERR, "poll failed: %s",
+ ERROR ("poll failed: %s",
strerror (errno));
return (-1);
}
0 /* no flags */);
if (buffer_len < 0)
{
- syslog (LOG_ERR, "recv failed: %s", strerror (errno));
+ ERROR ("recv failed: %s", strerror (errno));
return (-1);
}
sockent_t *se;
int status;
- DBG ("buffer_len = %i", buffer_len);
+ DEBUG ("buffer_len = %i", buffer_len);
for (se = sending_sockets; se != NULL; se = se->next)
{
{
if (errno == EINTR)
continue;
- syslog (LOG_ERR, "network plugin: sendto failed: %s",
+ ERROR ("network plugin: sendto failed: %s",
strerror (errno));
break;
}
vl->host, strlen (vl->host)) != 0)
return (-1);
strcpy (vl_def->host, vl->host);
- DBG ("host = %s", vl->host);
+ DEBUG ("host = %s", vl->host);
}
if (vl_def->time != vl->time)
(uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
- DBG ("time = %u", (unsigned int) vl->time);
+ DEBUG ("time = %u", (unsigned int) vl->time);
}
if (strcmp (vl_def->plugin, vl->plugin) != 0)
vl->plugin, strlen (vl->plugin)) != 0)
return (-1);
strcpy (vl_def->plugin, vl->plugin);
- DBG ("plugin = %s", vl->plugin);
+ DEBUG ("plugin = %s", vl->plugin);
}
if (strcmp (vl_def->plugin_instance, vl->plugin_instance) != 0)
strlen (vl->plugin_instance)) != 0)
return (-1);
strcpy (vl_def->plugin_instance, vl->plugin_instance);
- DBG ("plugin_instance = %s", vl->plugin_instance);
+ DEBUG ("plugin_instance = %s", vl->plugin_instance);
}
if (strcmp (type_def, ds->type) != 0)
ds->type, strlen (ds->type)) != 0)
return (-1);
strcpy (type_def, ds->type);
- DBG ("type = %s", ds->type);
+ DEBUG ("type = %s", ds->type);
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
strlen (vl->type_instance)) != 0)
return (-1);
strcpy (vl_def->type_instance, vl->type_instance);
- DBG ("type_instance = %s", vl->type_instance);
+ DEBUG ("type_instance = %s", vl->type_instance);
}
if (write_part_values (&buffer, &buffer_size, ds, vl) != 0)
if (status < 0)
{
- syslog (LOG_ERR, "network plugin: Unable to append to the "
+ ERROR ("network plugin: Unable to append to the "
"buffer for some weird reason");
}
else if ((sizeof (send_buffer) - send_buffer_fill) < 15)
static int network_shutdown (void)
{
- DBG ("Shutting down.");
+ DEBUG ("Shutting down.");
listen_loop++;
receive_thread, NULL /* no argument */);
if (status != 0)
- syslog (LOG_ERR, "network: pthread_create failed: %s",
+ ERROR ("network: pthread_create failed: %s",
strerror (errno));
}
return (0);
diff --git a/src/nfs.c b/src/nfs.c
index 004c8f5e968a9305be5a4c7e2eafbb0f3438ab97..81f07937eb5f3c315c87756ac378df420ee24ea8 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#define MODULE_NAME "nfs"
values[0].counter = val[i];
strncpy (vl.type_instance, names[i],
sizeof (vl.type_instance));
- DBG ("%s-%s/nfs_procedure-%s = %llu",
+ DEBUG ("%s-%s/nfs_procedure-%s = %llu",
vl.plugin, vl.plugin_instance,
vl.type_instance, val[i]);
plugin_dispatch_values ("nfs_procedure", &vl);
if ((numfields - 2) != nfs2_procedures_names_num)
{
- syslog (LOG_WARNING, "nfs plugin: Wrong "
+ WARNING ("nfs plugin: Wrong "
"number of fields (= %i) "
"for NFSv2 statistics.",
numfields - 2);
values = (unsigned long long *) malloc (nfs2_procedures_names_num * sizeof (unsigned long long));
if (values == NULL)
{
- syslog (LOG_ERR, "nfs plugin: malloc "
+ ERROR ("nfs plugin: malloc "
"failed: %s",
strerror (errno));
continue;
if ((numfields - 2) != nfs3_procedures_names_num)
{
- syslog (LOG_WARNING, "nfs plugin: Wrong "
+ WARNING ("nfs plugin: Wrong "
"number of fields (= %i) "
"for NFSv3 statistics.",
numfields - 2);
values = (unsigned long long *) malloc (nfs3_procedures_names_num * sizeof (unsigned long long));
if (values == NULL)
{
- syslog (LOG_ERR, "nfs plugin: malloc "
+ ERROR ("nfs plugin: malloc "
"failed: %s",
strerror (errno));
continue;
diff --git a/src/ntpd.c b/src/ntpd.c
index e4a230b3cc7942ea39b4707f6656b59d365bd19f..668e302dee53f43cedd355e14cae4a556396e6f1 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_SYS_SOCKET_H
# define NTPD_HAVE_READ 1
if (sock_descr >= 0)
return (sock_descr);
- DBG ("Opening a new socket");
+ DEBUG ("Opening a new socket");
host = ntpd_host;
if (host == NULL)
if ((status = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
- DBG ("getaddrinfo (%s, %s): %s",
+ DEBUG ("getaddrinfo (%s, %s): %s",
host, port,
status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
- syslog (LOG_ERR, "ntpd plugin: getaddrinfo (%s, %s): %s",
+ ERROR ("ntpd plugin: getaddrinfo (%s, %s): %s",
host, port,
status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
return (-1);
if (sock_descr < 0)
{
- DBG ("Unable to connect to server.");
- syslog (LOG_ERR, "ntpd plugin: Unable to connect to server.");
+ DEBUG ("Unable to connect to server.");
+ ERROR ("ntpd plugin: Unable to connect to server.");
}
return (sock_descr);
if (gettimeofday (&time_end, NULL) < 0)
{
- syslog (LOG_ERR, "ntpd plugin: gettimeofday failed: %s",
+ ERROR ("ntpd plugin: gettimeofday failed: %s",
strerror (errno));
return (-1);
}
{
if (gettimeofday (&time_now, NULL) < 0)
{
- syslog (LOG_ERR, "ntpd plugin: gettimeofday failed: %s",
+ ERROR ("ntpd plugin: gettimeofday failed: %s",
strerror (errno));
return (-1);
}
poll_s.events = POLLIN | POLLPRI;
poll_s.revents = 0;
- DBG ("Polling for %ims", timeout);
+ DEBUG ("Polling for %ims", timeout);
status = poll (&poll_s, 1, timeout);
if ((status < 0) && ((errno == EAGAIN) || (errno == EINTR)))
@@ -503,15 +502,15 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
if (status < 0)
{
- DBG ("poll failed: %s", strerror (errno));
- syslog (LOG_ERR, "ntpd plugin: poll failed: %s",
+ DEBUG ("poll failed: %s", strerror (errno));
+ ERROR ("ntpd plugin: poll failed: %s",
strerror (errno));
return (-1);
}
if (status == 0) /* timeout */
{
- DBG ("timeout reached.");
+ DEBUG ("timeout reached.");
break;
}
@@ -523,50 +522,50 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
if (status < 0)
{
- DBG ("recv(2) failed: %s", strerror (errno));
- DBG ("Closing socket #%i", sd);
+ DEBUG ("recv(2) failed: %s", strerror (errno));
+ DEBUG ("Closing socket #%i", sd);
close (sd);
sock_descr = sd = -1;
return (-1);
}
- DBG ("recv'd %i bytes", status);
+ DEBUG ("recv'd %i bytes", status);
/*
* Do some sanity checks first
*/
if (status < RESP_HEADER_SIZE)
{
- syslog (LOG_WARNING, "ntpd plugin: Short (%i bytes) packet received",
+ WARNING ("ntpd plugin: Short (%i bytes) packet received",
(int) status);
continue;
}
if (INFO_MODE (res.rm_vn_mode) != MODE_PRIVATE)
{
- syslog (LOG_NOTICE, "ntpd plugin: Packet received with mode %i",
+ NOTICE ("ntpd plugin: Packet received with mode %i",
INFO_MODE (res.rm_vn_mode));
continue;
}
if (INFO_IS_AUTH (res.auth_seq))
{
- syslog (LOG_NOTICE, "ntpd plugin: Encrypted packet received");
+ NOTICE ("ntpd plugin: Encrypted packet received");
continue;
}
if (!ISRESPONSE (res.rm_vn_mode))
{
- syslog (LOG_NOTICE, "ntpd plugin: Received request packet, "
+ NOTICE ("ntpd plugin: Received request packet, "
"wanted response");
continue;
}
if (INFO_MBZ (res.mbz_itemsize))
{
- syslog (LOG_WARNING, "ntpd plugin: Received packet with nonzero "
+ WARNING ("ntpd plugin: Received packet with nonzero "
"MBZ field!");
continue;
}
if (res.implementation != IMPL_XNTPD)
{
- syslog (LOG_WARNING, "ntpd plugin: Asked for request of type %i, "
+ WARNING ("ntpd plugin: Asked for request of type %i, "
"got %i", (int) IMPL_XNTPD, (int) res.implementation);
continue;
}
/* Check for error code */
if (INFO_ERR (res.err_nitems) != 0)
{
- syslog (LOG_ERR, "ntpd plugin: Received error code %i",
+ ERROR ("ntpd plugin: Received error code %i",
(int) INFO_ERR(res.err_nitems));
return ((int) INFO_ERR (res.err_nitems));
}
@@ -582,13 +581,13 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
/* extract number of items in this packet and the size of these items */
pkt_item_num = INFO_NITEMS (res.err_nitems);
pkt_item_len = INFO_ITEMSIZE (res.mbz_itemsize);
- DBG ("pkt_item_num = %i; pkt_item_len = %i;",
+ DEBUG ("pkt_item_num = %i; pkt_item_len = %i;",
pkt_item_num, pkt_item_len);
/* Check if the reported items fit in the packet */
if ((pkt_item_num * pkt_item_len) > (status - RESP_HEADER_SIZE))
{
- syslog (LOG_ERR, "ntpd plugin: %i items * %i bytes > "
+ ERROR ("ntpd plugin: %i items * %i bytes > "
"%i bytes - %i bytes header",
(int) pkt_item_num, (int) pkt_item_len,
(int) status, (int) RESP_HEADER_SIZE);
@@ -600,14 +599,14 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
* items have the same size. Discard invalid packets. */
if (items_num == 0) /* first packet */
{
- DBG ("*res_size = %i", pkt_item_len);
+ DEBUG ("*res_size = %i", pkt_item_len);
*res_size = pkt_item_len;
}
else if (*res_size != pkt_item_len)
{
- DBG ("Error: *res_size = %i; pkt_item_len = %i;",
+ DEBUG ("Error: *res_size = %i; pkt_item_len = %i;",
*res_size, pkt_item_len);
- syslog (LOG_ERR, "Item sizes differ.");
+ ERROR ("Item sizes differ.");
continue;
}
@@ -615,14 +614,14 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
pkt_padding = 0;
if (res_item_size > pkt_item_len)
pkt_padding = res_item_size - pkt_item_len;
- DBG ("res_item_size = %i; pkt_padding = %i;",
+ DEBUG ("res_item_size = %i; pkt_padding = %i;",
res_item_size, pkt_padding);
/* Extract the sequence number */
pkt_sequence = INFO_SEQ (res.auth_seq);
if ((pkt_sequence < 0) || (pkt_sequence > MAXSEQ))
{
- syslog (LOG_ERR, "ntpd plugin: Received packet with sequence %i",
+ ERROR ("ntpd plugin: Received packet with sequence %i",
pkt_sequence);
continue;
}
/* Check if this sequence has been received before. If so, discard it. */
if (pkt_recvd[pkt_sequence] != '\0')
{
- syslog (LOG_NOTICE, "ntpd plugin: Sequence %i received twice",
+ NOTICE ("ntpd plugin: Sequence %i received twice",
pkt_sequence);
continue;
}
@@ -641,20 +640,20 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
{
if (pkt_lastseq != -1)
{
- syslog (LOG_ERR, "ntpd plugin: Two packets which both "
+ ERROR ("ntpd plugin: Two packets which both "
"claim to be the last one in the "
"sequence have been received.");
continue;
}
pkt_lastseq = pkt_sequence;
- DBG ("Last sequence = %i;", pkt_lastseq);
+ DEBUG ("Last sequence = %i;", pkt_lastseq);
}
/*
* Enough with the checks. Copy the data now.
* We start by allocating some more memory.
*/
- DBG ("realloc (%p, %i)", (void *) *res_data,
+ DEBUG ("realloc (%p, %i)", (void *) *res_data,
(items_num + pkt_item_num) * res_item_size);
items = realloc ((void *) *res_data,
(items_num + pkt_item_num) * res_item_size);
if (items == NULL)
{
items = *res_data;
- syslog (LOG_ERR, "ntpd plugin: realloc failed.");
+ ERROR ("ntpd plugin: realloc failed.");
continue;
}
*res_data = items;
@@ -721,13 +720,13 @@ static int ntpd_send_request (int req_code, int req_items, int req_size, char *r
if (req_data != NULL)
memcpy ((void *) req.data, (const void *) req_data, req_data_len);
- DBG ("req_items = %i; req_size = %i; req_data = %p;",
+ DEBUG ("req_items = %i; req_size = %i; req_data = %p;",
req_items, req_size, (void *) req_data);
status = swrite (sd, (const char *) &req, REQ_LEN_NOMAC);
if (status < 0)
{
- DBG ("`swrite' failed. Closing socket #%i", sd);
+ DEBUG ("`swrite' failed. Closing socket #%i", sd);
close (sd);
sock_descr = sd = -1;
return (status);
if (status != 0)
{
- DBG ("ntpd_do_query failed with status %i", status);
+ DEBUG ("ntpd_do_query failed with status %i", status);
return (-1);
}
if ((ik == NULL) || (ik_num == 0) || (ik_size == 0))
{
- DBG ("ntpd_do_query returned: ik = %p; ik_num = %i; ik_size = %i;",
+ DEBUG ("ntpd_do_query returned: ik = %p; ik_num = %i; ik_size = %i;",
(void *) ik, ik_num, ik_size);
return (-1);
}
/* kerninfo -> estimated error */
- DBG ("info_kernel:\n"
+ DEBUG ("info_kernel:\n"
" pll offset = %.8f\n"
" pll frequency = %.8f\n" /* drift compensation */
" est error = %.8f\n",
sizeof (struct info_peer_summary));
if (status != 0)
{
- DBG ("ntpd_do_query failed with status %i", status);
+ DEBUG ("ntpd_do_query failed with status %i", status);
return (-1);
}
if ((ps == NULL) || (ps_num == 0) || (ps_size == 0))
{
- DBG ("ntpd_do_query returned: ps = %p; ps_num = %i; ps_size = %i;",
+ DEBUG ("ntpd_do_query returned: ps = %p; ps_num = %i; ps_size = %i;",
(void *) ps, ps_num, ps_size);
return (-1);
}
NULL, 0, 0 /* no flags */);
if (status != 0)
{
- syslog (LOG_ERR, "ntpd plugin: getnameinfo failed: %s",
+ ERROR ("ntpd plugin: getnameinfo failed: %s",
status == EAI_SYSTEM
? strerror (errno)
: gai_strerror (status));
}
}
- DBG ("peer %i:\n"
+ DEBUG ("peer %i:\n"
" peername = %s\n"
" srcadr = 0x%08x\n"
" delay = %f\n"
diff --git a/src/ping.c b/src/ping.c
index 48cea55c57f6e173d348e280d0f12bba976404ce..48a0ac87ef513c72b28bc73c8922083b088398ac 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#include <netinet/in.h>
#include "liboping/oping.h"
hl_prev = NULL;
while (hl_this != NULL)
{
- DBG ("host = %s, wait_left = %i, wait_time = %i, next = %p",
+ DEBUG ("host = %s, wait_left = %i, wait_time = %i, next = %p",
hl_this->host, hl_this->wait_left, hl_this->wait_time, (void *) hl_this->next);
if (hl_this->wait_left <= 0)
{
if (ping_host_add (pingobj, hl_this->host) == 0)
{
- DBG ("Successfully added host %s", hl_this->host);
+ DEBUG ("Successfully added host %s", hl_this->host);
/* Remove the host from the linked list */
if (hl_prev != NULL)
hl_prev->next = hl_this->next;
{
if ((pingobj = ping_construct ()) == NULL)
{
- syslog (LOG_ERR, "ping: `ping_construct' failed: %s",
+ ERROR ("ping: `ping_construct' failed: %s",
ping_get_error (pingobj));
return (1);
}
if ((hl = (hostlist_t *) malloc (sizeof (hostlist_t))) == NULL)
{
- syslog (LOG_ERR, "ping plugin: malloc failed: %s",
+ ERROR ("ping plugin: malloc failed: %s",
strerror (errno));
return (1);
}
if ((host = strdup (value)) == NULL)
{
free (hl);
- syslog (LOG_ERR, "ping plugin: strdup failed: %s",
+ ERROR ("ping plugin: strdup failed: %s",
strerror (errno));
return (1);
}
int ttl = atoi (value);
if (ping_setopt (pingobj, PING_DEF_TIMEOUT, (void *) &ttl))
{
- syslog (LOG_WARNING, "ping: liboping did not accept the TTL value %i", ttl);
+ WARNING ("ping: liboping did not accept the TTL value %i", ttl);
return (1);
}
}
if (ping_send (pingobj) < 0)
{
- syslog (LOG_ERR, "ping: `ping_send' failed: %s",
+ ERROR ("ping: `ping_send' failed: %s",
ping_get_error (pingobj));
return (-1);
}
&latency, &buf_len))
continue;
- DBG ("host = %s, latency = %f", host, latency);
+ DEBUG ("host = %s, latency = %f", host, latency);
ping_submit (host, latency);
}
diff --git a/src/plugin.c b/src/plugin.c
index f2e205af8479e42cbcd7129d9ab10060192a0dad..87fdcce69b88bb4fd123ae1ccbd86965f25fadbe 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
#include "plugin.h"
#include "configfile.h"
#include "utils_llist.h"
-#include "utils_debug.h"
/*
* Private structures
lt_dlhandle dlh;
void (*reg_handle) (void);
- DBG ("file = %s", file);
+ DEBUG ("file = %s", file);
lt_dlinit ();
lt_dlerror (); /* clear errors */
{
const char *error = lt_dlerror ();
- syslog (LOG_ERR, "lt_dlopen failed: %s", error);
- DBG ("lt_dlopen failed: %s", error);
+ ERROR ("lt_dlopen failed: %s", error);
+ DEBUG ("lt_dlopen failed: %s", error);
return (1);
}
if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
{
- syslog (LOG_WARNING, "Couldn't find symbol ``module_register'' in ``%s'': %s\n",
+ WARNING ("Couldn't find symbol ``module_register'' in ``%s'': %s\n",
file, lt_dlerror ());
lt_dlclose (dlh);
return (-1);
if (dir == NULL)
plugindir = NULL;
else if ((plugindir = strdup (dir)) == NULL)
- syslog (LOG_ERR, "strdup failed: %s", strerror (errno));
+ ERROR ("strdup failed: %s", strerror (errno));
}
#define BUFSIZE 512
struct stat statbuf;
struct dirent *de;
- DBG ("type = %s", type);
+ DEBUG ("type = %s", type);
dir = plugin_get_dir ();
ret = 1;
* type when matching the filename */
if (snprintf (typename, BUFSIZE, "%s.so", type) >= BUFSIZE)
{
- syslog (LOG_WARNING, "snprintf: truncated: `%s.so'", type);
+ WARNING ("snprintf: truncated: `%s.so'", type);
return (-1);
}
typename_len = strlen (typename);
if ((dh = opendir (dir)) == NULL)
{
- syslog (LOG_ERR, "opendir (%s): %s", dir, strerror (errno));
+ ERROR ("opendir (%s): %s", dir, strerror (errno));
return (-1);
}
if (snprintf (filename, BUFSIZE, "%s/%s", dir, de->d_name) >= BUFSIZE)
{
- syslog (LOG_WARNING, "snprintf: truncated: `%s/%s'", dir, de->d_name);
+ WARNING ("snprintf: truncated: `%s/%s'", dir, de->d_name);
continue;
}
if (lstat (filename, &statbuf) == -1)
{
- syslog (LOG_WARNING, "stat %s: %s", filename, strerror (errno));
+ WARNING ("stat %s: %s", filename, strerror (errno));
continue;
}
else if (!S_ISREG (statbuf.st_mode))
rf = (read_func_t *) malloc (sizeof (read_func_t));
if (rf == NULL)
{
- syslog (LOG_ERR, "plugin_register_read: malloc failed: %s",
+ ERROR ("plugin_register_read: malloc failed: %s",
strerror (errno));
return (-1);
}
if (status != 0)
{
- syslog (LOG_ERR, "Initialization of plugin `%s' "
+ ERROR ("Initialization of plugin `%s' "
"failed with status %i. "
"Plugin will be unloaded. TODO!",
le->key, status);
if (rf->wait_time > 86400)
rf->wait_time = 86400;
- syslog (LOG_NOTICE, "read-function of plugin `%s' "
+ NOTICE ("read-function of plugin `%s' "
"failed. Will syspend it for %i "
"seconds.", le->key, rf->wait_left);
}
le = llist_search (list_data_set, name);
if (le == NULL)
{
- DBG ("No such dataset registered: %s", name);
+ DEBUG ("No such dataset registered: %s", name);
return (-1);
}
ds = (data_set_t *) le->value;
- DBG ("time = %u; host = %s; "
+ DEBUG ("time = %u; host = %s; "
"plugin = %s; plugin_instance = %s; "
"type = %s; type_instance = %s;",
(unsigned int) vl->time, vl->host,
message[511] = '\0';
va_end (ap);
- syslog (level, message);
+ plugin_log (level, message);
}
void plugin_relief (int level, complain_t *c, const char *format, ...)
message[511] = '\0';
va_end (ap);
- syslog (level, message);
+ plugin_log (level, message);
}
diff --git a/src/processes.c b/src/processes.c
index 37d0a75ec0ba70d87175eec77fd026f28b9cfc99..e5c25126939e842a8d16ba84a50a677a123573f5 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#include "configfile.h"
/* Include header files for the mach system, if they exist.. */
{
if (pse->age > 10)
{
- DBG ("Removing this procstat entry cause it's too old: "
+ DEBUG ("Removing this procstat entry cause it's too old: "
"id = %lu; name = %s;",
pse->id, ps->name);
&pset_list,
&pset_list_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "host_processor_sets failed: %s\n",
+ ERROR ("host_processor_sets failed: %s\n",
mach_error_string (status));
pset_list = NULL;
pset_list_len = 0;
#elif KERNEL_LINUX
pagesize_g = sysconf(_SC_PAGESIZE);
- DBG ("pagesize_g = %li; CONFIG_HZ = %i;",
+ DEBUG ("pagesize_g = %li; CONFIG_HZ = %i;",
pagesize_g, CONFIG_HZ);
#endif /* KERNEL_LINUX */
vl.values_len = 2;
plugin_dispatch_values ("ps_pagefaults", &vl);
- DBG ("name = %s; num_proc = %lu; num_lwp = %lu; vmem_rss = %lu; "
+ DEBUG ("name = %s; num_proc = %lu; num_lwp = %lu; vmem_rss = %lu; "
"vmem_minflt_counter = %lu; vmem_majflt_counter = %lu; "
"cpu_user_counter = %lu; cpu_system_counter = %lu;",
ps->name, ps->num_proc, ps->num_lwp, ps->vmem_rss,
if ((dh = opendir (dirname)) == NULL)
{
- DBG ("Failed to open directory `%s'", dirname);
+ DEBUG ("Failed to open directory `%s'", dirname);
return (NULL);
}
{
if (list != NULL)
free (list);
- syslog (LOG_ERR, "processes plugin: "
+ ERROR ("processes plugin: "
"Failed to allocate more memory.");
return (NULL);
}
fields_len = strsplit (buffer, fields, 64);
if (fields_len < 24)
{
- DBG ("`%s' has only %i fields..",
+ DEBUG ("`%s' has only %i fields..",
filename, fields_len);
return (-1);
}
else if (fields_len != 41)
{
- DBG ("WARNING: (fields_len = %i) != 41", fields_len);
+ DEBUG ("WARNING: (fields_len = %i) != 41", fields_len);
}
/* copy the name, strip brackets in the process */
name_len = strlen (fields[1]) - 2;
if ((fields[1][0] != '(') || (fields[1][name_len + 1] != ')'))
{
- DBG ("No brackets found in process name: `%s'", fields[1]);
+ DEBUG ("No brackets found in process name: `%s'", fields[1]);
return (-1);
}
fields[1] = fields[1] + 1;
if ((tasks = ps_read_tasks (pid)) == NULL)
{
/* This happends for zombied, e.g. */
- DBG ("ps_read_tasks (%i) failed.", pid);
+ DEBUG ("ps_read_tasks (%i) failed.", pid);
*state = 'Z';
ps->num_lwp = 0;
ps->num_proc = 0;
/* Leave the rest at zero if this is only an LWP */
if (ps->num_proc == 0)
{
- DBG ("This is only an LWP: pid = %i; name = %s;",
+ DEBUG ("This is only an LWP: pid = %i; name = %s;",
pid, ps->name);
return (0);
}
@@ -721,7 +720,7 @@ static int mach_get_task_name (task_t t, int *pid, char *name, size_t name_max_l
strncpy (name, kp.kp_proc.p_comm, name_max_len - 1);
name[name_max_len - 1] = '\0';
- DBG ("pid = %i; name = %s;", *pid, name);
+ DEBUG ("pid = %i; name = %s;", *pid, name);
/* We don't do the special handling for `p_comm == "LaunchCFMApp"' as
* `top' does it, because it is a lot of work and only used when
pset_list[pset],
&port_pset_priv)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "host_processor_set_priv failed: %s\n",
+ ERROR ("host_processor_set_priv failed: %s\n",
mach_error_string (status));
continue;
}
&task_list,
&task_list_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "processor_set_tasks failed: %s\n",
+ ERROR ("processor_set_tasks failed: %s\n",
mach_error_string (status));
mach_port_deallocate (port_task_self, port_pset_priv);
continue;
&task_basic_info_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "task_info failed: %s",
+ ERROR ("task_info failed: %s",
mach_error_string (status));
continue; /* with next thread_list */
}
&task_events_info_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "task_info failed: %s",
+ ERROR ("task_info failed: %s",
mach_error_string (status));
continue; /* with next thread_list */
}
&task_absolutetime_info_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "task_info failed: %s",
+ ERROR ("task_info failed: %s",
mach_error_string (status));
continue; /* with next thread_list */
}
* thread is nonsense, since the task/process
* is dead. */
zombies++;
- DBG ("task_threads failed: %s",
+ DEBUG ("task_threads failed: %s",
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
&thread_data_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "thread_info failed: %s",
+ ERROR ("thread_info failed: %s",
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
* There's only zombie tasks, which are
* handled above. */
default:
- syslog (LOG_WARNING,
- "Unknown thread status: %s",
+ WARNING ("Unknown thread status: %s",
thread_data.run_state);
break;
} /* switch (thread_data.run_state) */
status = mach_port_deallocate (port_task_self,
thread_list[thread]);
if (status != KERN_SUCCESS)
- syslog (LOG_ERR, "mach_port_deallocate failed: %s",
+ ERROR ("mach_port_deallocate failed: %s",
mach_error_string (status));
}
} /* for (thread_list) */
thread_list_len * sizeof (thread_act_t)))
!= KERN_SUCCESS)
{
- syslog (LOG_ERR, "vm_deallocate failed: %s",
+ ERROR ("vm_deallocate failed: %s",
mach_error_string (status));
}
thread_list = NULL;
status = mach_port_deallocate (port_task_self,
task_list[task]);
if (status != KERN_SUCCESS)
- syslog (LOG_ERR, "mach_port_deallocate failed: %s",
+ ERROR ("mach_port_deallocate failed: %s",
mach_error_string (status));
}
(vm_address_t) task_list,
task_list_len * sizeof (task_t))) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "vm_deallocate failed: %s",
+ ERROR ("vm_deallocate failed: %s",
mach_error_string (status));
}
task_list = NULL;
if ((status = mach_port_deallocate (port_task_self, port_pset_priv))
!= KERN_SUCCESS)
{
- syslog (LOG_ERR, "mach_port_deallocate failed: %s",
+ ERROR ("mach_port_deallocate failed: %s",
mach_error_string (status));
}
} /* for (pset_list) */
if ((proc = opendir ("/proc")) == NULL)
{
- syslog (LOG_ERR, "Cannot open `/proc': %s", strerror (errno));
+ ERROR ("Cannot open `/proc': %s", strerror (errno));
return (-1);
}
status = ps_read_process (pid, &ps, &state);
if (status != 0)
{
- DBG ("ps_read_process failed: %i", status);
+ DEBUG ("ps_read_process failed: %i", status);
continue;
}
diff --git a/src/rrdtool.c b/src/rrdtool.c
index f19f2693943f4400aa00b99439abd8a3929a9c3e..ec04642c8313a3f1b215dc9ab88c40535ad8e964 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
#include "plugin.h"
#include "common.h"
#include "utils_avltree.h"
-#include "utils_debug.h"
/*
* Private types
rra_types[j], xff,
cdp_len, cdp_num) >= sizeof (buffer))
{
- syslog (LOG_ERR, "rra_get: Buffer would have been truncated.");
+ ERROR ("rra_get: Buffer would have been truncated.");
continue;
}
}
#if COLLECT_DEBUG
- DBG ("rra_num = %i", rra_num);
+ DEBUG ("rra_num = %i", rra_num);
for (i = 0; i < rra_num; i++)
- DBG (" %s", rra_def[i]);
+ DEBUG (" %s", rra_def[i]);
#endif
*ret = rra_def;
char max[32];
char buffer[128];
- DBG ("ds->ds_num = %i", ds->ds_num);
+ DEBUG ("ds->ds_num = %i", ds->ds_num);
ds_def = (char **) malloc (ds->ds_num * sizeof (char *));
if (ds_def == NULL)
{
- syslog (LOG_ERR, "rrdtool plugin: malloc failed: %s",
+ ERROR ("rrdtool plugin: malloc failed: %s",
strerror (errno));
return (-1);
}
type = "GAUGE";
else
{
- syslog (LOG_ERR, "rrdtool plugin: Unknown DS type: %i",
+ ERROR ("rrdtool plugin: Unknown DS type: %i",
d->type);
break;
}
#if COLLECT_DEBUG
{
int i;
- DBG ("ds_num = %i", ds_num);
+ DEBUG ("ds_num = %i", ds_num);
for (i = 0; i < ds_num; i++)
- DBG (" %s", ds_def[i]);
+ DEBUG (" %s", ds_def[i]);
}
#endif
if ((rra_num = rra_get (&rra_def)) < 1)
{
- syslog (LOG_ERR, "rrd_create_file failed: Could not calculate RRAs");
+ ERROR ("rrd_create_file failed: Could not calculate RRAs");
return (-1);
}
if ((ds_num = ds_get (&ds_def, ds)) < 1)
{
- syslog (LOG_ERR, "rrd_create_file failed: Could not calculate DSes");
+ ERROR ("rrd_create_file failed: Could not calculate DSes");
return (-1);
}
if ((argv = (char **) malloc (sizeof (char *) * (argc + 1))) == NULL)
{
- syslog (LOG_ERR, "rrd_create failed: %s", strerror (errno));
+ ERROR ("rrd_create failed: %s", strerror (errno));
return (-1);
}
"%i", stepsize);
if ((status < 1) || (status >= sizeof (stepsize_str)))
{
- syslog (LOG_ERR, "rrdtool plugin: snprintf failed.");
+ ERROR ("rrdtool plugin: snprintf failed.");
return (-1);
}
rrd_clear_error ();
if (rrd_create (argc, argv) == -1)
{
- syslog (LOG_ERR, "rrd_create failed: %s: %s", filename, rrd_get_error ());
+ ERROR ("rrd_create failed: %s: %s", filename, rrd_get_error ());
status = -1;
}
(rc->values_num + 1) * sizeof (char *));
if (rc->values == NULL)
{
- syslog (LOG_ERR, "rrdtool plugin: realloc failed: %s",
+ ERROR ("rrdtool plugin: realloc failed: %s",
strerror (errno));
if (cache != NULL)
{
if (cache_key == NULL)
{
- syslog (LOG_ERR, "rrdtool plugin: strdup failed: %s",
+ ERROR ("rrdtool plugin: strdup failed: %s",
strerror (errno));
sfree (rc->values[0]);
sfree (rc->values);
avl_insert (cache, cache_key, rc);
}
- DBG ("rrd_cache_insert (%s, %s) = %p", filename, value, (void *) rc);
+ DEBUG ("rrd_cache_insert (%s, %s) = %p", filename, value, (void *) rc);
return (rc);
} /* rrd_cache_t *rrd_cache_insert */
memcpy (argv + 2, rc->values, rc->values_num * sizeof (char *));
argv[argc] = NULL;
- DBG ("rrd_update (argc = %i, argv = %p)", argc, (void *) argv);
+ DEBUG ("rrd_update (argc = %i, argv = %p)", argc, (void *) argv);
optind = 0; /* bug in librrd? */
rrd_clear_error ();
if (status != 0)
{
- syslog (LOG_WARNING, "rrd_update failed: %s: %s",
+ WARNING ("rrd_update failed: %s: %s",
filename, rrd_get_error ());
return (-1);
}
if (cache == NULL)
return;
- DBG ("Flushing cache, timeout = %i", timeout);
+ DEBUG ("Flushing cache, timeout = %i", timeout);
now = time (NULL);
iter = avl_get_iterator (cache);
while (avl_iterator_next (iter, (void *) &key, (void *) &rc) == 0)
{
- DBG ("key = %s; age = %i;", key, now - rc->first_value);
+ DEBUG ("key = %s; age = %i;", key, now - rc->first_value);
if ((now - rc->first_value) >= timeout)
{
keys = (char **) realloc ((void *) keys,
(keys_num + 1) * sizeof (char *));
if (keys == NULL)
{
- DBG ("realloc failed: %s", strerror (errno));
- syslog (LOG_ERR, "rrdtool plugin: "
+ DEBUG ("realloc failed: %s", strerror (errno));
+ ERROR ("rrdtool plugin: "
"realloc failed: %s",
strerror (errno));
avl_iterator_destroy (iter);
{
if (avl_remove (cache, keys[i], (void *) &key, (void *) &rc) != 0)
{
- DBG ("avl_remove (%s) failed.", keys[i]);
+ DEBUG ("avl_remove (%s) failed.", keys[i]);
continue;
}
} /* for (i = 0..keys_num) */
free (keys);
- DBG ("Flushed %i value(s)", keys_num);
+ DEBUG ("Flushed %i value(s)", keys_num);
cache_flush_last = now;
} /* void rrd_cache_flush */
}
else
{
- syslog (LOG_ERR, "stat(%s) failed: %s",
+ ERROR ("stat(%s) failed: %s",
filename, strerror (errno));
return (-1);
}
}
else if (!S_ISREG (statbuf.st_mode))
{
- syslog (LOG_ERR, "stat(%s): Not a regular file!",
+ ERROR ("stat(%s): Not a regular file!",
filename);
return (-1);
}
now = time (NULL);
- DBG ("age (%s) = %i", filename, now - rc->first_value);
+ DEBUG ("age (%s) = %i", filename, now - rc->first_value);
/* `rc' is not free'd here, because we'll likely reuse it. If not, then
* the next flush will remove this entry. */
heartbeat = 2 * interval_g;
if (heartbeat < interval_g)
- syslog (LOG_WARNING, "rrdtool plugin: Your `heartbeat' is "
+ WARNING ("rrdtool plugin: Your `heartbeat' is "
"smaller than your `interval'. This will "
"likely cause problems.");
else if (stepsize < interval_g)
- syslog (LOG_WARNING, "rrdtool plugin: Your `stepsize' is "
+ WARNING ("rrdtool plugin: Your `stepsize' is "
"smaller than your `interval'. This will "
"create needlessly big RRD-files.");
plugin_register_shutdown ("rrdtool", rrd_shutdown);
}
- DBG ("datadir = %s; stepsize = %i; heartbeat = %i; rrarows = %i; xff = %lf;",
+ DEBUG ("datadir = %s; stepsize = %i; heartbeat = %i; rrarows = %i; xff = %lf;",
(datadir == NULL) ? "(null)" : datadir,
stepsize, heartbeat, rrarows, xff);
diff --git a/src/sensors.c b/src/sensors.c
index b1454a6e7e970c7cdf706ce92a408e750372f530..4bb544d566839e1e1f6f5a9dfd95ed57eeaa3cca 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
#include "plugin.h"
#include "configfile.h"
#include "utils_ignorelist.h"
-#include "utils_debug.h"
#if defined(HAVE_SENSORS_SENSORS_H)
# include <sensors/sensors.h>
{
if (ignorelist_add (sensor_list, value))
{
- syslog (LOG_ERR, "sensors plugin: "
+ ERROR ("sensors plugin: "
"Cannot add value to ignorelist.");
return (1);
}
status = stat (conffile, &statbuf);
if (status != 0)
{
- syslog (LOG_ERR, "sensors plugin: stat (%s) failed: %s",
+ ERROR ("sensors plugin: stat (%s) failed: %s",
conffile, strerror (errno));
sensors_config_mtime = 0;
}
if (sensors_config_mtime != 0)
{
- syslog (LOG_NOTICE, "sensors plugin: Reloading config from %s",
+ NOTICE ("sensors plugin: Reloading config from %s",
conffile);
sensors_free_features ();
sensors_config_mtime = 0;
fh = fopen (conffile, "r");
if (fh == NULL)
{
- syslog (LOG_ERR, "sensors plugin: fopen(%s) failed: %s",
+ ERROR ("sensors plugin: fopen(%s) failed: %s",
conffile, strerror(errno));
return;
}
fclose (fh);
if (status != 0)
{
- syslog (LOG_ERR, "sensors plugin: Cannot initialize sensors. "
+ ERROR ("sensors plugin: Cannot initialize sensors. "
"Data will not be collected.");
return;
}
if (sensors_get_ignored (*chip, data->number) == 0)
break;
- DBG ("Adding feature: %s-%s-%s",
+ DEBUG ("Adding feature: %s-%s-%s",
chip->prefix,
sensor_to_type[known_features[i].type],
data->name);
if ((new_feature = (featurelist_t *) malloc (sizeof (featurelist_t))) == NULL)
{
- DBG ("malloc: %s", strerror (errno));
- syslog (LOG_ERR, "sensors plugin: malloc: %s",
+ DEBUG ("malloc: %s", strerror (errno));
+ ERROR ("sensors plugin: malloc: %s",
strerror (errno));
break;
}
if (first_feature == NULL)
{
sensors_cleanup ();
- syslog (LOG_INFO, "sensors plugin: lm_sensors reports no "
+ INFO ("sensors plugin: lm_sensors reports no "
"features. Data will not be collected.");
}
} /* void sensors_load_conf */
diff --git a/src/serial.c b/src/serial.c
index 8f8e433b8f494a5f3eee387ca594657b802b6a07..0cfa382309b0ba8655638f74f3cd5daeaee3fb7e 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
if ((fh = fopen ("/proc/tty/driver/serial", "r")) == NULL &&
(fh = fopen ("/proc/tty/driver/ttyS", "r")) == NULL)
{
- syslog (LOG_WARNING, "serial: fopen: %s", strerror (errno));
+ WARNING ("serial: fopen: %s", strerror (errno));
return (-1);
}
diff --git a/src/swap.c b/src/swap.c
index 8e040443773eab4bab77d3d7498b7e5058d6f24e..945c7580aef84dfdc944a0dd8f2e268773159d2a 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
NULL)) /* errstr */
== NULL)
{
- syslog (LOG_ERR, "swap plugin: kvm_open failed.");
+ ERROR ("swap plugin: kvm_open failed.");
return (-1);
}
/* #endif HAVE_LIBKVM */
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
- syslog (LOG_WARNING, "memory: fopen: %s", strerror (errno));
+ WARNING ("memory: fopen: %s", strerror (errno));
return (-1);
}
}
if (fclose (fh))
- syslog (LOG_WARNING, "memory: fclose: %s", strerror (errno));
+ WARNING ("memory: fclose: %s", strerror (errno));
if ((swap_total == 0LL) || ((swap_free + swap_cached) > swap_total))
return (-1);
if (swapctl (SC_AINFO, &ai) == -1)
{
- syslog (LOG_ERR, "swap plugin: swapctl failed: %s",
+ ERROR ("swap plugin: swapctl failed: %s",
strerror (errno));
return (-1);
}
diff --git a/src/traffic.c b/src/traffic.c
index 619208c88438e3bc4b352057166a9f8741c85ca9..7f62450220072538e1944b3deccb0fce372939d1 100644 (file)
--- a/src/traffic.c
+++ b/src/traffic.c
temp = (char **) realloc (if_list, (if_list_num + 1) * sizeof (char *));
if (temp == NULL)
{
- syslog (LOG_EMERG, "Cannot allocate more memory.");
+ ERROR ("Cannot allocate more memory.");
return (1);
}
if_list = temp;
if ((if_list[if_list_num] = strdup (value)) == NULL)
{
- syslog (LOG_EMERG, "Cannot allocate memory.");
+ ERROR ("Cannot allocate memory.");
return (1);
}
if_list_num++;
if ((fh = fopen ("/proc/net/dev", "r")) == NULL)
{
- syslog (LOG_WARNING, "traffic: fopen: %s", strerror (errno));
+ WARNING ("traffic: fopen: %s", strerror (errno));
return (-1);
}
diff --git a/src/unixsock.c b/src/unixsock.c
index 0008b2242ccfa68862a58084d973c78bc43d1f03..17956a177fa7486ec329a156fa4dd181387cd354 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
/* Folks without pthread will need to disable this plugin. */
#include <pthread.h>
value_cache_t *vc;
int i;
- DBG ("ds->ds_num = %i; vl->values_len = %i;",
+ DEBUG ("ds->ds_num = %i; vl->values_len = %i;",
ds->ds_num, vl->values_len);
assert (ds->ds_num == vl->values_len);
if (vc == NULL)
{
pthread_mutex_unlock (&cache_lock);
- syslog (LOG_ERR, "unixsock plugin: malloc failed: %s",
+ ERROR ("unixsock plugin: malloc failed: %s",
strerror (errno));
return (-1);
}
if (vc->gauge == NULL)
{
pthread_mutex_unlock (&cache_lock);
- syslog (LOG_ERR, "unixsock plugin: malloc failed: %s",
+ ERROR ("unixsock plugin: malloc failed: %s",
strerror (errno));
free (vc);
return (-1);
if (vc->counter == NULL)
{
pthread_mutex_unlock (&cache_lock);
- syslog (LOG_ERR, "unixsock plugin: malloc failed: %s",
+ ERROR ("unixsock plugin: malloc failed: %s",
strerror (errno));
free (vc->gauge);
free (vc);
ds->type, vl->type_instance) != 0)
{
pthread_mutex_unlock (&cache_lock);
- syslog (LOG_ERR, "unixsock plugin: cache_alloc_name failed.");
+ ERROR ("unixsock plugin: cache_alloc_name failed.");
free (vc->counter);
free (vc->gauge);
free (vc);
sock_fd = socket (PF_UNIX, SOCK_STREAM, 0);
if (sock_fd < 0)
{
- syslog (LOG_ERR, "unixsock plugin: socket failed: %s",
+ ERROR ("unixsock plugin: socket failed: %s",
strerror (errno));
return (-1);
}
status = bind (sock_fd, (struct sockaddr *) &sa, sizeof (sa));
if (status != 0)
{
- DBG ("bind failed: %s; sa.sun_path = %s",
+ DEBUG ("bind failed: %s; sa.sun_path = %s",
strerror (errno), sa.sun_path);
- syslog (LOG_ERR, "unixsock plugin: bind failed: %s",
+ ERROR ("unixsock plugin: bind failed: %s",
strerror (errno));
close (sock_fd);
sock_fd = -1;
status = listen (sock_fd, 8);
if (status != 0)
{
- syslog (LOG_ERR, "unixsock plugin: listen failed: %s",
+ ERROR ("unixsock plugin: listen failed: %s",
strerror (errno));
close (sock_fd);
sock_fd = -1;
status = getgrnam_r (grpname, &sg, grbuf, sizeof (grbuf), &g);
if (status != 0)
{
- syslog (LOG_WARNING, "unixsock plugin: getgrnam_r (%s) failed: %s",
+ WARNING ("unixsock plugin: getgrnam_r (%s) failed: %s",
grpname, strerror (status));
break;
}
if (g == NULL)
{
- syslog (LOG_WARNING, "unixsock plugin: No such group: `%s'",
+ WARNING ("unixsock plugin: No such group: `%s'",
grpname);
break;
}
if (chown ((sock_file != NULL) ? sock_file : US_DEFAULT_PATH,
(uid_t) -1, g->gr_gid) != 0)
{
- syslog (LOG_WARNING, "unixsock plugin: chown (%s, -1, %i) failed: %s",
+ WARNING ("unixsock plugin: chown (%s, -1, %i) failed: %s",
(sock_file != NULL) ? sock_file : US_DEFAULT_PATH,
(int) g->gr_gid,
strerror (errno));
pthread_mutex_lock (&cache_lock);
- DBG ("vc = cache_search (%s)", name);
+ DEBUG ("vc = cache_search (%s)", name);
vc = cache_search (name);
if (vc == NULL)
{
- DBG ("Did not find cache entry.");
+ DEBUG ("Did not find cache entry.");
fprintf (fh, "-1 No such value");
}
else
{
- DBG ("Found cache entry.");
+ DEBUG ("Found cache entry.");
fprintf (fh, "%i", vc->values_num);
for (i = 0; i < vc->values_num; i++)
{
free (arg);
arg = NULL;
- DBG ("Reading from fd #%i", fd);
+ DEBUG ("Reading from fd #%i", fd);
fh = fdopen (fd, "r+");
if (fh == NULL)
{
- syslog (LOG_ERR, "unixsock plugin: fdopen failed: %s",
+ ERROR ("unixsock plugin: fdopen failed: %s",
strerror (errno));
close (fd);
pthread_exit ((void *) 1);
if (len == 0)
continue;
- DBG ("fgets -> buffer = %s; len = %i;", buffer, len);
+ DEBUG ("fgets -> buffer = %s; len = %i;", buffer, len);
fields_num = strsplit (buffer, fields,
sizeof (fields) / sizeof (fields[0]));
}
} /* while (fgets) */
- DBG ("Exiting..");
+ DEBUG ("Exiting..");
close (fd);
pthread_exit ((void *) 0);
while (42)
{
- DBG ("Calling accept..");
+ DEBUG ("Calling accept..");
status = accept (sock_fd, NULL, NULL);
if (status < 0)
{
if (errno == EINTR)
continue;
- syslog (LOG_ERR, "unixsock plugin: accept failed: %s",
+ ERROR ("unixsock plugin: accept failed: %s",
strerror (errno));
close (sock_fd);
sock_fd = -1;
remote_fd = (int *) malloc (sizeof (int));
if (remote_fd == NULL)
{
- syslog (LOG_WARNING, "unixsock plugin: malloc failed: %s",
+ WARNING ("unixsock plugin: malloc failed: %s",
strerror (errno));
close (status);
continue;
}
*remote_fd = status;
- DBG ("Spawning child to handle connection on fd #%i", *remote_fd);
+ DEBUG ("Spawning child to handle connection on fd #%i", *remote_fd);
pthread_attr_init (&th_attr);
pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
status = pthread_create (&th, &th_attr, us_handle_client, (void *) remote_fd);
if (status != 0)
{
- syslog (LOG_WARNING, "unixsock plugin: pthread_create failed: %s",
+ WARNING ("unixsock plugin: pthread_create failed: %s",
strerror (status));
close (*remote_fd);
free (remote_fd);
status = pthread_create (&listen_thread, NULL, us_server_thread, NULL);
if (status != 0)
{
- syslog (LOG_ERR, "unixsock plugin: pthread_create failed: %s",
+ ERROR ("unixsock plugin: pthread_create failed: %s",
strerror (status));
return (-1);
}
diff --git a/src/utils_debug.c b/src/utils_debug.c
index 9fc9040b23ff74ee16be33305174d9cada4e1fe7..cc5ca8e565716b581ff3efcb0871887df29b0372 100644 (file)
--- a/src/utils_debug.c
+++ b/src/utils_debug.c
va_list ap;
if(cu_debug_file != NULL) {
- DBG("Don't call this function more then once without"
+ DBG ("Don't call this function more then once without"
" calling cu_debug_stopfile().");
return EXIT_FAILURE;
}
cu_debug_file = fopen(cu_debug_filename, "a");
if(cu_debug_file == NULL) {
- DBG("Cannot open debug file %s: %s.\n",
+ DEBUG("Cannot open debug file %s: %s.\n",
cu_debug_filename, strerror(errno));
return EXIT_FAILURE;
}
va_end(ap);
if(cu_debug_file == NULL) {
- DBG("Don't call this function more then once or without"
+ DEBUG("Don't call this function more then once or without"
" calling cu_debug_startfile().");
return EXIT_FAILURE;
}
if(fclose(cu_debug_file) != 0) {
- DBG("Cannot close debug file %s: %s.\n",
+ DEBUG("Cannot close debug file %s: %s.\n",
cu_debug_filename, strerror(errno));
return EXIT_FAILURE;
}
const char *filename)
{
if(filename == NULL) {
- DBG("You have to set filename when calling this function!\n");
+ DEBUG("You have to set filename when calling this function!\n");
return EXIT_FAILURE;
}
if(cu_debug_file != NULL) {
diff --git a/src/utils_ignorelist.c b/src/utils_ignorelist.c
index 532eb4b0029837318cf60a2adbecf901a2590b3a..f71ac1d7abef01e6336acf9858c1fdea482bce28 100644 (file)
--- a/src/utils_ignorelist.c
+++ b/src/utils_ignorelist.c
**/
#include "common.h"
-#include "utils_debug.h"
+#include "plugin.h"
#include "utils_ignorelist.h"
/*
/* create buffer */
if ((regtemp = malloc(sizeof(regex_t))) == NULL)
{
- syslog (LOG_ERR, "cannot allocate new config entry");
+ ERROR ("cannot allocate new config entry");
return (1);
}
memset (regtemp, '\0', sizeof(regex_t));
{
fprintf (stderr, "Cannot compile regex %s: %i/%s",
entry, rcompile, regerr);
- syslog (LOG_ERR, "Cannot compile regex %s: %i/%s",
+ ERROR ("Cannot compile regex %s: %i/%s",
entry, rcompile, regerr);
}
else
{
fprintf (stderr, "Cannot compile regex %s: %i",
entry, rcompile);
- syslog (LOG_ERR, "Cannot compile regex %s: %i",
+ ERROR ("Cannot compile regex %s: %i",
entry, rcompile);
}
regfree (regtemp);
return (1);
}
- DBG("regex compiled: %s - %i", entry, rcompile);
+ DEBUG("regex compiled: %s - %i", entry, rcompile);
/* create new entry */
if ((new = malloc(sizeof(ignorelist_item_t))) == NULL)
{
- syslog (LOG_ERR, "cannot allocate new config entry");
+ ERROR ("cannot allocate new config entry");
regfree (regtemp);
return (1);
}
/* create new entry */
if ((new = malloc(sizeof(ignorelist_item_t))) == NULL )
{
- syslog (LOG_ERR, "cannot allocate new entry");
+ ERROR ("cannot allocate new entry");
return (1);
}
memset (new, '\0', sizeof(ignorelist_item_t));
/* smalloc exits if it failes */
il = (ignorelist_t *) smalloc (sizeof (ignorelist_t));
- DBG("Ignorelist created 0x%p, default is %s",
+ DEBUG("Ignorelist created 0x%p, default is %s",
(void *) il,
invert ? "collect" : "ignore");
ignorelist_item_t *this;
ignorelist_item_t *next;
- DBG ("(il = 0x%p)", (void *) il);
+ DEBUG ("(il = 0x%p)", (void *) il);
if (il == NULL)
return;
{
if (il == NULL)
{
- DBG("ignore call with ignorelist_t == NULL");
+ DEBUG("ignore call with ignorelist_t == NULL");
return;
}
if (il == NULL)
{
- DBG ("add called with ignorelist_t == NULL");
+ DEBUG ("add called with ignorelist_t == NULL");
return (1);
}
/* append nothing */
if (entry_len == 0)
{
- DBG("not appending: empty entry");
+ DEBUG("not appending: empty entry");
return (1);
}
memset (entry_copy, '\0', entry_len);
strncpy (entry_copy, entry + 1, entry_len - 2);
- DBG("I'm about to add regex entry: %s", entry_copy);
+ DEBUG("I'm about to add regex entry: %s", entry_copy);
ret = ignorelist_append_regex(il, entry_copy);
sfree (entry_copy);
}
else
#endif
{
- DBG("to add entry: %s", entry);
+ DEBUG("to add entry: %s", entry);
ret = ignorelist_append_string(il, entry);
}
diff --git a/src/utils_mount.c b/src/utils_mount.c
index 7748c610bc871faf99a2f75a30f6db99e6c6fbbb..61eb6d1c109ea5ee556fea4762ab70f3ca9f35a4 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
#define XFS_SUPER_MAGIC2_STR "BSFX"
#endif
-#include "utils_debug.h"
+#include "plugin.h"
#include "utils_mount.h"
#if HAVE_GETVFSSTAT
return get_spec_by_x(UUID, uuid);
bad_uuid:
- DBG("Found an invalid UUID: %s", s);
+ DEBUG("Found an invalid UUID: %s", s);
return NULL;
}
}
else if (strncmp (optstr, "UUID=", 5) == 0)
{
- DBG ("TODO: check UUID= code!");
+ DEBUG ("TODO: check UUID= code!");
rc = get_spec_by_uuid (optstr + 5);
}
else if (strncmp (optstr, "LABEL=", 6) == 0)
{
- DBG ("TODO: check LABEL= code!");
+ DEBUG ("TODO: check LABEL= code!");
rc = get_spec_by_volume_label (optstr + 6);
}
else
if(!rc)
{
- DBG ("Error checking device name: optstr = %s", optstr);
+ DEBUG ("Error checking device name: optstr = %s", optstr);
}
return rc;
}
struct tabmntent *mntlist;
if(listmntent(&mntlist, COLLECTD_MNTTAB, NULL, NULL) < 0) {
- DBG("calling listmntent() failed: %s", strerror(errno));
+ DEBUG("calling listmntent() failed: %s", strerror(errno));
}
for(p = mntlist; p; p = p->next) {
if(loop == NULL) { /* no loop= mount */
device = get_device_name(mnt->mnt_fsname);
if(device == NULL) {
- DBG("can't get devicename for fs (%s) %s (%s)"
+ DEBUG("can't get devicename for fs (%s) %s (%s)"
": ignored", mnt->mnt_type,
mnt->mnt_dir, mnt->mnt_fsname);
continue;
/* Get the number of mounted file systems */
if ((bufsize = CMD_STATFS (NULL, 0, FLAGS_STATFS)) < 1)
{
- DBG ("getv?fsstat failed: %s", strerror (errno));
+ DEBUG ("getv?fsstat failed: %s", strerror (errno));
return (NULL);
}
* manpage.. -octo */
if ((num = CMD_STATFS (buf, bufsize * sizeof (STRUCT_STATFS), FLAGS_STATFS)) < 1)
{
- DBG ("getv?fsstat failed: %s", strerror (errno));
+ DEBUG ("getv?fsstat failed: %s", strerror (errno));
free (buf);
return (NULL);
}
cu_mount_t *last = NULL;
cu_mount_t *new = NULL;
- DBG ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
+ DEBUG ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
if ((fp = fopen (COLLECTD_MNTTAB, "r")) == NULL)
{
- syslog (LOG_ERR, "fopen (%s): %s", COLLECTD_MNTTAB, strerror (errno));
+ ERROR ("fopen (%s): %s", COLLECTD_MNTTAB, strerror (errno));
return (NULL);
}
cu_mount_t *last = NULL;
cu_mount_t *new = NULL;
- DBG ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
+ DEBUG ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
if ((fp = setmntent (COLLECTD_MNTTAB, "r")) == NULL)
{
- syslog (LOG_ERR, "setmntent (%s): %s", COLLECTD_MNTTAB, strerror (errno));
+ ERROR ("setmntent (%s): %s", COLLECTD_MNTTAB, strerror (errno));
return (NULL);
}
new->device = get_device_name (new->options);
new->next = NULL;
- DBG ("new = {dir = %s, spec_device = %s, type = %s, options = %s, device = %s}",
+ DEBUG ("new = {dir = %s, spec_device = %s, type = %s, options = %s, device = %s}",
new->dir, new->spec_device, new->type, new->options, new->device);
/* Append to list */
endmntent (fp);
- DBG ("return (0x%p)", (void *) first);
+ DEBUG ("return (0x%p)", (void *) first);
return (first);
}
cu_mount_t *this;
cu_mount_t *next;
- DBG ("(list = 0x%p)", (void *) list);
+ DEBUG ("(list = 0x%p)", (void *) list);
for (this = list; this != NULL; this = next)
{
diff --git a/src/vserver.c b/src/vserver.c
index 00a1e6ad49ca671839e1823bd42d3200e700c493..fef45587a456c455a84e042ad0fd04458ee0e742 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
#include "plugin.h"
#include <dirent.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
#include <sys/types.h>
-#include <unistd.h>
#define BUFSIZE 512
continue;
if (NULL == (fh = fopen (file, "r")))
- syslog (LOG_ERR, "Cannot open '%s': %s", file, strerror (errno));
+ ERROR ("Cannot open '%s': %s", file, strerror (errno));
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
continue;
if (NULL == (fh = fopen (file, "r")))
- syslog (LOG_ERR, "Cannot open '%s': %s", file, strerror (errno));
+ ERROR ("Cannot open '%s': %s", file, strerror (errno));
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
continue;
if (NULL == (fh = fopen (file, "r")))
- syslog (LOG_ERR, "Cannot open '%s': %s", file, strerror (errno));
+ ERROR ("Cannot open '%s': %s", file, strerror (errno));
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
diff --git a/src/wireless.c b/src/wireless.c
index 104145315b88a9aa3e366f6adf2bf24fb7402e96..a704047572ecdffddf2598ab8941a8453dfbf1b9 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
/* there are a variety of names for the wireless device */
if ((fh = fopen (WIRELESS_PROC_FILE, "r")) == NULL)
{
- syslog (LOG_WARNING, "wireless: fopen: %s", strerror (errno));
+ WARNING ("wireless: fopen: %s", strerror (errno));
return (-1);
}