projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d92c343
)
Replace all syslog-calls with one of the new logging-macros.
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:
src/Makefile.am
patch
|
blob
|
history
src/apache.c
patch
|
blob
|
history
src/apcups.c
patch
|
blob
|
history
src/apple_sensors.c
patch
|
blob
|
history
src/battery.c
patch
|
blob
|
history
src/collectd.c
patch
|
blob
|
history
src/common.c
patch
|
blob
|
history
src/configfile.c
patch
|
blob
|
history
src/cpu.c
patch
|
blob
|
history
src/cpufreq.c
patch
|
blob
|
history
src/csv.c
patch
|
blob
|
history
src/df.c
patch
|
blob
|
history
src/disk.c
patch
|
blob
|
history
src/dns.c
patch
|
blob
|
history
src/email.c
patch
|
blob
|
history
src/exec.c
patch
|
blob
|
history
src/hddtemp.c
patch
|
blob
|
history
src/iptables.c
patch
|
blob
|
history
src/irq.c
patch
|
blob
|
history
src/load.c
patch
|
blob
|
history
src/mbmon.c
patch
|
blob
|
history
src/memory.c
patch
|
blob
|
history
src/multimeter.c
patch
|
blob
|
history
src/mysql.c
patch
|
blob
|
history
src/network.c
patch
|
blob
|
history
src/nfs.c
patch
|
blob
|
history
src/ntpd.c
patch
|
blob
|
history
src/ping.c
patch
|
blob
|
history
src/plugin.c
patch
|
blob
|
history
src/processes.c
patch
|
blob
|
history
src/rrdtool.c
patch
|
blob
|
history
src/sensors.c
patch
|
blob
|
history
src/serial.c
patch
|
blob
|
history
src/swap.c
patch
|
blob
|
history
src/traffic.c
patch
|
blob
|
history
src/unixsock.c
patch
|
blob
|
history
src/utils_debug.c
patch
|
blob
|
history
src/utils_ignorelist.c
patch
|
blob
|
history
src/utils_mount.c
patch
|
blob
|
history
src/vserver.c
patch
|
blob
|
history
src/wireless.c
patch
|
blob
|
history
diff --git
a/src/Makefile.am
b/src/Makefile.am
index
0610aa6
..
adf83da
100644
(file)
--- a/
src/Makefile.am
+++ b/
src/Makefile.am
@@
-11,7
+11,6
@@
sbin_PROGRAMS = collectd
bin_PROGRAMS = collectd-nagios
collectd_SOURCES = collectd.c collectd.h \
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 \
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
167ead1
..
887977e
100644
(file)
--- a/
src/apache.c
+++ b/
src/apache.c
@@
-26,7
+26,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#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 HAVE_LIBCURL && HAVE_CURL_CURL_H
# define APACHE_HAVE_READ 1
@@
-159,7
+158,7
@@
static int init (void)
if ((curl = curl_easy_init ()) == NULL)
{
if ((curl = curl_easy_init ()) == NULL)
{
-
syslog (LOG_ERR,
"apache: `curl_easy_init' failed.");
+
ERROR (
"apache: `curl_easy_init' failed.");
return (-1);
}
return (-1);
}
@@
-171,7
+170,7
@@
static int init (void)
{
if (snprintf (credentials, 1024, "%s:%s", user, pass == NULL ? "" : pass) >= 1024)
{
{
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);
}
return (-1);
}
@@
-197,7
+196,7
@@
static void submit_counter (const char *type, const char *type_instance,
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- D
B
G ("type = %s; type_instance = %s; value = %llu;",
+ D
EBU
G ("type = %s; type_instance = %s; value = %llu;",
type, type_instance, value);
values[0].counter = value;
type, type_instance, value);
values[0].counter = value;
@@
-219,7
+218,7
@@
static void submit_gauge (const char *type, const char *type_instance,
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- D
B
G ("type = %s; type_instance = %s; value = %lf;",
+ D
EBU
G ("type = %s; type_instance = %s; value = %lf;",
type, type_instance, value);
values[0].gauge = value;
type, type_instance, value);
values[0].gauge = value;
@@
-309,7
+308,7
@@
static int apache_read (void)
apache_buffer_len = 0;
if (curl_easy_perform (curl) != 0)
{
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);
}
apache_curl_error);
return (-1);
}
diff --git
a/src/apcups.c
b/src/apcups.c
index
9fab785
..
b5b939a
100644
(file)
--- a/
src/apcups.c
+++ b/
src/apcups.c
@@
-33,7
+33,6
@@
#include "common.h" /* rrd_update_file */
#include "plugin.h" /* plugin_register, plugin_submit */
#include "configfile.h" /* cf_register */
#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 HAVE_SYS_TYPES_H
# include <sys/types.h>
@@
-148,7
+147,7
@@
static int apcups_shutdown (void)
if (global_sockfd < 0)
return (0);
if (global_sockfd < 0)
return (0);
- D
B
G ("Gracefully shutting down socket %i.", global_sockfd);
+ D
EBU
G ("Gracefully shutting down socket %i.", global_sockfd);
/* send EOF sentinel */
swrite (global_sockfd, (void *) &packet_size, sizeof (packet_size));
/* send EOF sentinel */
swrite (global_sockfd, (void *) &packet_size, sizeof (packet_size));
@@
-187,7
+186,7
@@
static int net_open (char *host, char *service, int port)
status = getaddrinfo (host, port_str, &ai_hints, &ai_return);
if (status != 0)
{
status = getaddrinfo (host, port_str, &ai_hints, &ai_return);
if (status != 0)
{
- D
B
G ("getaddrinfo failed: %s", status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
+ D
EBU
G ("getaddrinfo failed: %s", status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
return (-1);
}
return (-1);
}
@@
-203,7
+202,7
@@
static int net_open (char *host, char *service, int port)
if (sd < 0)
{
if (sd < 0)
{
- D
B
G ("Unable to open a socket");
+ D
EBU
G ("Unable to open a socket");
freeaddrinfo (ai_return);
return (-1);
}
freeaddrinfo (ai_return);
return (-1);
}
@@
-214,12
+213,12
@@
static int net_open (char *host, char *service, int port)
if (status != 0) /* `connect(2)' failed */
{
if (status != 0) /* `connect(2)' failed */
{
- D
B
G ("connect failed: %s", strerror (errno));
+ D
EBU
G ("connect failed: %s", strerror (errno));
close (sd);
return (-1);
}
close (sd);
return (-1);
}
- D
B
G ("Done opening a socket %i", sd);
+ D
EBU
G ("Done opening a socket %i", sd);
return (sd);
} /* int net_open (char *host, char *service, int port) */
return (sd);
} /* int net_open (char *host, char *service, int port) */
@@
-247,7
+246,7
@@
static int net_recv (int *sockfd, char *buf, int buflen)
packet_size = ntohs (packet_size);
if (packet_size > buflen)
{
packet_size = ntohs (packet_size);
if (packet_size > buflen)
{
- D
B
G ("record length too large");
+ D
EBU
G ("record length too large");
return (-2);
}
return (-2);
}
@@
-333,7
+332,7
@@
static int apc_query_server (char *host, int port,
if (net_send (&global_sockfd, "status", 6) < 0)
{
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);
}
return (-1);
}
@@
-379,7
+378,7
@@
static int apc_query_server (char *host, int port,
if (n < 0)
{
if (n < 0)
{
-
syslog (LOG_WARNING,
"apcups plugin: Error reading from socket");
+
WARNING (
"apcups plugin: Error reading from socket");
return (-1);
}
return (-1);
}
@@
-403,7
+402,7
@@
static int apcups_config (const char *key, const char *value)
int port_tmp = atoi (value);
if (port_tmp < 1 || port_tmp > 65535)
{
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;
return (1);
}
conf_port = port_tmp;
@@
-470,7
+469,7
@@
static int apcups_read (void)
*/
if (status != 0)
{
*/
if (status != 0)
{
- D
B
G ("apc_query_server (%s, %i) = %i",
+ D
EBU
G ("apc_query_server (%s, %i) = %i",
conf_host == NULL
? APCUPS_DEFAULT_HOST
: conf_host,
conf_host == NULL
? APCUPS_DEFAULT_HOST
: conf_host,
diff --git
a/src/apple_sensors.c
b/src/apple_sensors.c
index
29d5091
..
f994b31
100644
(file)
--- a/
src/apple_sensors.c
+++ b/
src/apple_sensors.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#if HAVE_CTYPE_H
# include <ctype.h>
#if HAVE_CTYPE_H
# include <ctype.h>
@@
-95,7
+94,7
@@
static int as_init (void)
status = IOMasterPort (MACH_PORT_NULL, &io_master_port);
if (status != kIOReturnSuccess)
{
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);
mach_error_string (status));
io_master_port = MACH_PORT_NULL;
return (-1);
@@
-110,7
+109,7
@@
static void as_submit (const char *type, const char *type_instance,
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- D
B
G ("type = %s; type_instance = %s; val = %f;",
+ D
EBU
G ("type = %s; type_instance = %s; val = %f;",
type, type_instance, val);
values[0].gauge = val;
type, type_instance, val);
values[0].gauge = val;
@@
-148,7
+147,7
@@
static int as_read (void)
&iterator);
if (status != kIOReturnSuccess)
{
&iterator);
if (status != kIOReturnSuccess)
{
-
syslog (LOG_ERR,
"IOServiceGetMatchingServices failed: %s",
+
ERROR (
"IOServiceGetMatchingServices failed: %s",
mach_error_string (status));
return (-1);
}
mach_error_string (status));
return (-1);
}
@@
-162,7
+161,7
@@
static int as_read (void)
kNilOptions);
if (status != kIOReturnSuccess)
{
kNilOptions);
if (status != kIOReturnSuccess)
{
- D
B
G ("IORegistryEntryCreateCFProperties failed: %s",
+ D
EBU
G ("IORegistryEntryCreateCFProperties failed: %s",
mach_error_string (status));
continue;
}
mach_error_string (status));
continue;
}
@@
-246,7
+245,7
@@
static int as_read (void)
}
else
{
}
else
{
- D
B
G ("apple_sensors: Read unknown sensor type: %s",
+ D
EBU
G ("apple_sensors: Read unknown sensor type: %s",
type);
value_double = (double) value_int;
}
type);
value_double = (double) value_int;
}
diff --git
a/src/battery.c
b/src/battery.c
index
8a74b3d
..
85bfc00
100644
(file)
--- a/
src/battery.c
+++ b/
src/battery.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
@@
-151,13
+150,13
@@
double dict_get_double (CFDictionaryRef dict, char *key_string)
kCFStringEncodingASCII);
if (key_obj == NULL)
{
kCFStringEncodingASCII);
if (key_obj == NULL)
{
- D
B
G ("CFStringCreateWithCString (%s) failed.\n", key_string);
+ D
EBU
G ("CFStringCreateWithCString (%s) failed.\n", key_string);
return (INVALID_VALUE);
}
if ((val_obj = CFDictionaryGetValue (dict, key_obj)) == NULL)
{
return (INVALID_VALUE);
}
if ((val_obj = CFDictionaryGetValue (dict, key_obj)) == NULL)
{
- D
B
G ("CFDictionaryGetValue (%s) failed.", key_string);
+ D
EBU
G ("CFDictionaryGetValue (%s) failed.", key_string);
CFRelease (key_obj);
return (INVALID_VALUE);
}
CFRelease (key_obj);
return (INVALID_VALUE);
}
@@
-181,7
+180,7
@@
double dict_get_double (CFDictionaryRef dict, char *key_string)
}
else
{
}
else
{
- D
B
G ("CFGetTypeID (val_obj) = %i", (int) CFGetTypeID (val_obj));
+ D
EBU
G ("CFGetTypeID (val_obj) = %i", (int) CFGetTypeID (val_obj));
return (INVALID_VALUE);
}
return (INVALID_VALUE);
}
@@
-207,7
+206,7
@@
static void get_via_io_power_sources (double *ret_charge,
ps_array = IOPSCopyPowerSourcesList (ps_raw);
ps_array_len = CFArrayGetCount (ps_array);
ps_array = IOPSCopyPowerSourcesList (ps_raw);
ps_array_len = CFArrayGetCount (ps_array);
- D
B
G ("ps_array_len == %i", ps_array_len);
+ D
EBU
G ("ps_array_len == %i", ps_array_len);
for (i = 0; i < ps_array_len; i++)
{
for (i = 0; i < ps_array_len; i++)
{
@@
-216,13
+215,13
@@
static void get_via_io_power_sources (double *ret_charge,
if (ps_dict == NULL)
{
if (ps_dict == NULL)
{
- D
B
G ("IOPSGetPowerSourceDescription failed.");
+ D
EBU
G ("IOPSGetPowerSourceDescription failed.");
continue;
}
if (CFGetTypeID (ps_dict) != CFDictionaryGetTypeID ())
{
continue;
}
if (CFGetTypeID (ps_dict) != CFDictionaryGetTypeID ())
{
- D
B
G ("IOPSGetPowerSourceDescription did not return a CFDictionaryRef");
+ D
EBU
G ("IOPSGetPowerSourceDescription did not return a CFDictionaryRef");
continue;
}
continue;
}
@@
-283,7
+282,7
@@
static void get_via_generic_iokit (double *ret_charge,
&iterator);
if (status != kIOReturnSuccess)
{
&iterator);
if (status != kIOReturnSuccess)
{
- D
B
G ("IOServiceGetMatchingServices failed.");
+ D
EBU
G ("IOServiceGetMatchingServices failed.");
return;
}
return;
}
@@
-295,7
+294,7
@@
static void get_via_generic_iokit (double *ret_charge,
kNilOptions);
if (status != kIOReturnSuccess)
{
kNilOptions);
if (status != kIOReturnSuccess)
{
- D
B
G ("IORegistryEntryCreateCFProperties failed.");
+ D
EBU
G ("IORegistryEntryCreateCFProperties failed.");
continue;
}
continue;
}
@@
-458,7
+457,7
@@
static int battery_read (void)
if ((dh = opendir ("/proc/acpi/battery")) == NULL)
{
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);
}
return (-1);
}
@@
-475,7
+474,7
@@
static int battery_read (void)
if ((fh = fopen (filename, "r")) == NULL)
{
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;
}
continue;
}
diff --git
a/src/collectd.c
b/src/collectd.c
index
68a70ba
..
e873adc
100644
(file)
--- a/
src/collectd.c
+++ b/
src/collectd.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "collectd.h"
#include "common.h"
-#include "utils_debug.h"
#include "network.h"
#include "plugin.h"
#include "network.h"
#include "plugin.h"
@@
-67,7
+66,7
@@
static int init_global_variables (void)
return (-1);
}
}
return (-1);
}
}
- D
B
G ("hostname_g = %s;", hostname_g);
+ D
EBU
G ("hostname_g = %s;", hostname_g);
str = global_option_get ("Interval");
if (str == NULL)
str = global_option_get ("Interval");
if (str == NULL)
@@
-79,7
+78,7
@@
static int init_global_variables (void)
"Please check your settings.\n");
return (-1);
}
"Please check your settings.\n");
return (-1);
}
- D
B
G ("interval_g = %i;", interval_g);
+ D
EBU
G ("interval_g = %i;", interval_g);
return (0);
} /* int init_global_variables */
return (0);
} /* int init_global_variables */
@@
-92,7
+91,7
@@
static int change_basedir (const char *orig_dir)
if (dir == NULL)
{
if (dir == NULL)
{
-
syslog (LOG_ERR,
"strdup failed: %s", strerror (errno));
+
ERROR (
"strdup failed: %s", strerror (errno));
return (-1);
}
return (-1);
}
@@
-112,20
+111,20
@@
static int change_basedir (const char *orig_dir)
{
if (mkdir (orig_dir, 0755) == -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)
{
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
{
strerror (errno));
return (-1);
}
}
else
{
-
syslog (LOG_ERR,
"chdir (%s): %s", orig_dir,
+
ERROR (
"chdir (%s): %s", orig_dir,
strerror (errno));
return (-1);
}
strerror (errno));
return (-1);
}
@@
-140,7
+139,7
@@
static void update_kstat (void)
if (kc == NULL)
{
if ((kc = kstat_open ()) == NULL)
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
{
}
else
{
@@
-148,11
+147,11
@@
static void update_kstat (void)
kid = kstat_chain_update (kc);
if (kid > 0)
{
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)
plugin_init_all ();
}
else if (kid < 0)
-
syslog (LOG_ERR,
"kstat chain update failed");
+
ERROR (
"kstat chain update failed");
/* else: everything works as expected */
}
/* else: everything works as expected */
}
@@
-201,13
+200,13
@@
static int do_init (void)
#if HAVE_LIBSTATGRAB
if (sg_init ())
{
#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 ())
{
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
return (-1);
}
#endif
@@
-228,7
+227,7
@@
static int do_loop (void)
{
if (gettimeofday (&tv_next, NULL) < 0)
{
{
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;
return (-1);
}
tv_next.tv_sec += interval_g;
@@
-242,14
+241,14
@@
static int do_loop (void)
if (gettimeofday (&tv_now, NULL) < 0)
{
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)
{
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;
"`timeval_sub_timespec' returned "
"non-zero!");
continue;
@@
-259,13
+258,13
@@
static int do_loop (void)
{
if (errno != EINTR)
{
{
if (errno != EINTR)
{
-
syslog (LOG_ERR,
"nanosleep failed: %s", strerror (errno));
+
ERROR (
"nanosleep failed: %s", strerror (errno));
return (-1);
}
}
} /* while (loop == 0) */
return (-1);
}
}
} /* while (loop == 0) */
- D
B
G ("return (0);");
+ D
EBU
G ("return (0);");
return (0);
} /* int do_loop */
return (0);
} /* int do_loop */
@@
-283,7
+282,7
@@
static int pidfile_create (void)
if ((fh = fopen (file, "w")) == NULL)
{
if ((fh = fopen (file, "w")) == NULL)
{
-
syslog (LOG_ERR,
"fopen (%s): %s", file, strerror (errno));
+
ERROR (
"fopen (%s): %s", file, strerror (errno));
return (1);
}
return (1);
}
@@
-297,7
+296,7
@@
static int pidfile_remove (void)
{
const char *file = global_option_get ("PIDFile");
{
const char *file = global_option_get ("PIDFile");
- D
B
G ("unlink (%s)", (file != NULL) ? file : "<null>");
+ D
EBU
G ("unlink (%s)", (file != NULL) ? file : "<null>");
return (unlink (file));
} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */
return (unlink (file));
} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */
@@
-313,12
+312,6
@@
int main (int argc, char **argv)
pid_t pid;
int daemonize = 1;
#endif
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)
/* read options */
while (1)
@@
-353,11
+346,6
@@
int main (int argc, char **argv)
} /* switch (c) */
} /* 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
/*
* Read options from the config file, the environment and the command
* line (in that order, with later options overwriting previous ones in
@@
-432,17
+420,17
@@
int main (int argc, char **argv)
if (open ("/dev/null", O_RDWR) != 0)
{
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)
{
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)
{
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) */
return (1);
}
} /* if (daemonize) */
@@
-464,16
+452,11
@@
int main (int argc, char **argv)
*/
do_init ();
do_loop ();
*/
do_init ();
do_loop ();
- do_shutdown ();
-
-#if COLLECT_DEBUG
- if (logfile != NULL)
- DBG_STOPFILE("debug file closed.");
-#endif
/* close syslog */
/* close syslog */
- syslog (LOG_INFO, "Exiting normally");
- closelog ();
+ INFO ("Exiting normally");
+
+ do_shutdown ();
#if COLLECT_DAEMON
if (daemonize)
#if COLLECT_DAEMON
if (daemonize)
diff --git
a/src/common.c
b/src/common.c
index
922bd15
..
ede2ea5
100644
(file)
--- a/
src/common.c
+++ b/
src/common.c
@@
-21,7
+21,7
@@
**/
#include "common.h"
**/
#include "common.h"
-#include "
utils_debug
.h"
+#include "
plugin
.h"
#ifdef HAVE_MATH_H
# include <math.h>
#ifdef HAVE_MATH_H
# include <math.h>
@@
-51,7
+51,7
@@
char *sstrdup (const char *s)
if((r = strdup (s)) == NULL)
{
if((r = strdup (s)) == NULL)
{
- D
B
G ("Not enough memory.");
+ D
EBU
G ("Not enough memory.");
exit(3);
}
exit(3);
}
@@
-64,7
+64,7
@@
void *smalloc (size_t size)
if ((r = malloc (size)) == NULL)
{
if ((r = malloc (size)) == NULL)
{
- D
B
G("Not enough memory.");
+ D
EBU
G("Not enough memory.");
exit(3);
}
exit(3);
}
@@
-105,7
+105,7
@@
ssize_t sread (int fd, void *buf, size_t count)
if (status == 0)
{
if (status == 0)
{
- D
B
G ("Received EOF from fd %i. "
+ D
EBU
G ("Received EOF from fd %i. "
"Closing fd and returning error.",
fd);
close (fd);
"Closing fd and returning error.",
fd);
close (fd);
@@
-351,7
+351,7
@@
int check_create_dir (const char *file_orig)
*/
if (fields[i][0] == '.')
{
*/
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);
}
return (-2);
}
@@
-362,7
+362,7
@@
int check_create_dir (const char *file_orig)
if (strjoin (dir + path_is_absolute, dir_len - path_is_absolute,
fields, i + 1, "/") < 0)
{
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);
}
return (-1);
}
@@
-372,19
+372,19
@@
int check_create_dir (const char *file_orig)
{
if (mkdir (dir, 0755) == -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
{
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))
{
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);
}
}
return (-1);
}
}
@@
-407,13
+407,13
@@
int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name)
{
if ((*ksp_ptr = kstat_lookup (kc, module, instance, name)) == NULL)
{
{
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)
{
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);
}
*ksp_ptr = NULL;
return (-1);
}
@@
-426,13
+426,13
@@
int get_kstat (kstat_t **ksp_ptr, char *module, int instance, char *name)
if (kstat_read (kc, *ksp_ptr, NULL) == -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)
{
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);
}
return (-1);
}
@@
-472,7
+472,7
@@
long long get_kstat_value (kstat_t *ksp, char *name)
else if (kn->data_type == KSTAT_DATA_UINT64)
retval = (long long) kn->value.ui64; /* XXX: Might overflow! */
else
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);
}
return (retval);
}
diff --git
a/src/configfile.c
b/src/configfile.c
index
a5ae496
..
3cc0379
100644
(file)
--- a/
src/configfile.c
+++ b/
src/configfile.c
@@
-28,7
+28,6
@@
#include "plugin.h"
#include "configfile.h"
#include "network.h"
#include "plugin.h"
#include "configfile.h"
#include "network.h"
-#include "utils_debug.h"
#define ESCAPE_NULL(str) ((str) == NULL ? "(null)" : (str))
#define ESCAPE_NULL(str) ((str) == NULL ? "(null)" : (str))
@@
-112,14
+111,14
@@
static int cf_dispatch (const char *type, const char *orig_key,
int ret;
int i;
int ret;
int i;
- D
B
G ("type = %s, key = %s, value = %s",
+ D
EBU
G ("type = %s, key = %s, value = %s",
ESCAPE_NULL(type),
ESCAPE_NULL(orig_key),
ESCAPE_NULL(orig_value));
if ((cf_cb = cf_search (type)) == NULL)
{
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);
}
return (-1);
}
@@
-143,12
+142,12
@@
static int cf_dispatch (const char *type, const char *orig_key,
}
if (i >= cf_cb->keys_num)
}
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);
free (key);
free (value);
- D
B
G ("return (%i)", ret);
+ D
EBU
G ("return (%i)", ret);
return (ret);
} /* int cf_dispatch */
return (ret);
} /* int cf_dispatch */
@@
-265,7
+264,7
@@
static int dispatch_block_plugin (oconfig_item_t *ci)
if (ci->children[i].children == NULL)
dispatch_value_plugin (name, ci->children + i);
else
if (ci->children[i].children == NULL)
dispatch_value_plugin (name, ci->children + i);
else
- {D
B
G ("No nested config blocks allow for plugins. Yet.");}
+ {D
EBU
G ("No nested config blocks allow for plugins. Yet.");}
}
return (0);
}
return (0);
@@
-287,7
+286,7
@@
int global_option_set (const char *option, const char *value)
{
int i;
{
int i;
- D
B
G ("option = %s; value = %s;", option, value);
+ D
EBU
G ("option = %s; value = %s;", option, value);
for (i = 0; i < cf_global_options_num; i++)
if (strcasecmp (cf_global_options[i].key, option) == 0)
for (i = 0; i < cf_global_options_num; i++)
if (strcasecmp (cf_global_options[i].key, option) == 0)
@@
-372,7
+371,7
@@
int cf_read (char *filename)
conf = oconfig_parse_file (filename);
if (conf == NULL)
{
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);
}
return (-1);
}
diff --git
a/src/cpu.c
b/src/cpu.c
index
285841e
..
6f18b4f
100644
(file)
--- a/
src/cpu.c
+++ b/
src/cpu.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#ifdef HAVE_MACH_KERN_RETURN_H
# include <mach/kern_return.h>
#ifdef HAVE_MACH_KERN_RETURN_H
# include <mach/kern_return.h>
@@
-125,13
+124,13
@@
static int init (void)
/* FIXME: Free `cpu_list' if it's not NULL */
if ((status = host_processors (port_host, &cpu_list, &cpu_list_len)) != KERN_SUCCESS)
{
/* 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);
}
cpu_list_len = 0;
return (-1);
}
- D
B
G ("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");
+ D
EBU
G ("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))
collectd_step = atoi (COLLECTD_STEP);
if ((collectd_step > 0) && (collectd_step <= 86400))
@@
-162,12
+161,12
@@
static int init (void)
if (sysctlbyname ("hw.ncpu", &numcpu, &numcpu_size, NULL, 0) < 0)
{
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)
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);
#endif
return (0);
@@
-221,13
+220,13
@@
static int cpu_read (void)
PROCESSOR_CPU_LOAD_INFO, &cpu_host,
(processor_info_t) &cpu_info, &cpu_info_len)) != KERN_SUCCESS)
{
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)
{
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;
}
continue;
}
@@
-257,7
+256,7
@@
static int cpu_read (void)
cpu_temp, &cpu_temp_len);
if (status != KERN_SUCCESS)
{
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;
mach_error_string (status));
cpu_temp_retry_counter = cpu_temp_retry_step;
@@
-270,7
+269,7
@@
static int cpu_read (void)
if (cpu_temp_len != 1)
{
if (cpu_temp_len != 1)
{
- D
B
G ("processor_info (PROCESSOR_TEMPERATURE) returned %i elements..?",
+ D
EBU
G ("processor_info (PROCESSOR_TEMPERATURE) returned %i elements..?",
(int) cpu_temp_len);
continue;
}
(int) cpu_temp_len);
continue;
}
@@
-278,7
+277,7
@@
static int cpu_read (void)
cpu_temp_retry_counter = 0;
cpu_temp_retry_step = 1;
cpu_temp_retry_counter = 0;
cpu_temp_retry_step = 1;
- D
B
G ("cpu_temp = %i", (int) cpu_temp);
+ D
EBU
G ("cpu_temp = %i", (int) cpu_temp);
#endif /* PROCESSOR_TEMPERATURE */
}
/* #endif PROCESSOR_CPU_LOAD_INFO */
#endif /* PROCESSOR_TEMPERATURE */
}
/* #endif PROCESSOR_CPU_LOAD_INFO */
diff --git
a/src/cpufreq.c
b/src/cpufreq.c
index
008ef39
..
46e8659
100644
(file)
--- a/
src/cpufreq.c
+++ b/
src/cpufreq.c
@@
-69,7
+69,7
@@
static int cpufreq_init (void)
num_cpu++;
}
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)
(num_cpu == 1) ? "" : "s");
if (num_cpu == 0)
@@
-117,19
+117,19
@@
static int cpufreq_read (void)
if ((fp = fopen (filename, "r")) == NULL)
{
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)
{
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))
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;
/* 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
f4b56fe
..
62b6b2c
100644
(file)
--- a/
src/csv.c
+++ b/
src/csv.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "plugin.h"
#include "common.h"
#include "collectd.h"
#include "plugin.h"
#include "common.h"
-#include "utils_debug.h"
/*
* Private variables
/*
* Private variables
@@
-121,7
+120,7
@@
static int value_list_to_filename (char *buffer, int buffer_len,
now = time (NULL);
if (localtime_r (&now, &stm) == NULL)
{
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);
}
return (1);
}
@@
-143,7
+142,7
@@
static int csv_create_file (const char *filename, const data_set_t *ds)
csv = fopen (filename, "w");
if (csv == NULL)
{
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);
}
filename, strerror(errno));
return (-1);
}
@@
-200,7
+199,7
@@
static int csv_write (const data_set_t *ds, const value_list_t *vl)
if (value_list_to_filename (filename, sizeof (filename), ds, vl) != 0)
return (-1);
if (value_list_to_filename (filename, sizeof (filename), ds, vl) != 0)
return (-1);
- D
B
G ("filename = %s;", filename);
+ D
EBU
G ("filename = %s;", filename);
if (value_list_to_string (values, sizeof (values), ds, vl) != 0)
return (-1);
if (value_list_to_string (values, sizeof (values), ds, vl) != 0)
return (-1);
@@
-214,14
+213,14
@@
static int csv_write (const data_set_t *ds, const value_list_t *vl)
}
else
{
}
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))
{
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);
}
filename);
return (-1);
}
@@
-229,7
+228,7
@@
static int csv_write (const data_set_t *ds, const value_list_t *vl)
csv = fopen (filename, "a");
if (csv == NULL)
{
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);
}
filename, strerror (errno));
return (-1);
}
@@
-245,7
+244,7
@@
static int csv_write (const data_set_t *ds, const value_list_t *vl)
status = fcntl (csv_fd, F_SETLK, &fl);
if (status != 0)
{
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);
filename, strerror (errno));
fclose (csv);
return (-1);
diff --git
a/src/df.c
b/src/df.c
index
fde5d9a
..
6ec51fe
100644
(file)
--- a/
src/df.c
+++ b/
src/df.c
@@
-174,7
+174,7
@@
static int df_read (void)
{
if (STATANYFS (mnt_ptr->dir, &statbuf) < 0)
{
{
if (STATANYFS (mnt_ptr->dir, &statbuf) < 0)
{
-
syslog (LOG_ERR,
"statv?fs failed: %s", strerror (errno));
+
ERROR (
"statv?fs failed: %s", strerror (errno));
continue;
}
continue;
}
diff --git
a/src/disk.c
b/src/disk.c
index
af7c01a
..
36d7b4f
100644
(file)
--- a/
src/disk.c
+++ b/
src/disk.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
@@
-152,7
+151,7
@@
static int disk_init (void)
status = IOMasterPort (MACH_PORT_NULL, &io_master_port);
if (status != kIOReturnSuccess)
{
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);
mach_error_string (status));
io_master_port = MACH_PORT_NULL;
return (-1);
@@
-170,7
+169,7
@@
static int disk_init (void)
assert (heartbeat >= step);
min_poll_count = 1 + (heartbeat / step);
assert (heartbeat >= step);
min_poll_count = 1 + (heartbeat / step);
- D
B
G ("min_poll_count = %i;", min_poll_count);
+ D
EBU
G ("min_poll_count = %i;", min_poll_count);
/* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
/* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
@@
-230,7
+229,7
@@
static signed long long dict_get_value (CFDictionaryRef dict, const char *key)
kCFStringEncodingASCII);
if (key_obj == NULL)
{
kCFStringEncodingASCII);
if (key_obj == NULL)
{
- D
B
G ("CFStringCreateWithCString (%s) failed.", key);
+ D
EBU
G ("CFStringCreateWithCString (%s) failed.", key);
return (-1LL);
}
return (-1LL);
}
@@
-241,13
+240,13
@@
static signed long long dict_get_value (CFDictionaryRef dict, const char *key)
if (val_obj == NULL)
{
if (val_obj == NULL)
{
- D
B
G ("CFDictionaryGetValue (%s) failed.", key);
+ D
EBU
G ("CFDictionaryGetValue (%s) failed.", key);
return (-1LL);
}
if (!CFNumberGetValue (val_obj, kCFNumberSInt64Type, &val_int))
{
return (-1LL);
}
if (!CFNumberGetValue (val_obj, kCFNumberSInt64Type, &val_int))
{
- D
B
G ("CFNumberGetValue (%s) failed.", key);
+ D
EBU
G ("CFNumberGetValue (%s) failed.", key);
return (-1LL);
}
return (-1LL);
}
@@
-305,7
+304,7
@@
static int disk_read (void)
!= kIOReturnSuccess)
{
/* This fails for example for DVD/CD drives.. */
!= kIOReturnSuccess)
{
/* This fails for example for DVD/CD drives.. */
- D
B
G ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
+ D
EBU
G ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
IOObjectRelease (disk);
continue;
}
IOObjectRelease (disk);
continue;
}
@@
-317,7
+316,7
@@
static int disk_read (void)
kNilOptions)
!= kIOReturnSuccess)
{
kNilOptions)
!= kIOReturnSuccess)
{
-
syslog (LOG_ERR,
"disk-plugin: IORegistryEntryCreateCFProperties failed.");
+
ERROR (
"disk-plugin: IORegistryEntryCreateCFProperties failed.");
IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
@@
-325,7
+324,7
@@
static int disk_read (void)
if (props_dict == NULL)
{
if (props_dict == NULL)
{
- D
B
G ("IORegistryEntryCreateCFProperties (disk) failed.");
+ D
EBU
G ("IORegistryEntryCreateCFProperties (disk) failed.");
IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
@@
-336,7
+335,7
@@
static int disk_read (void)
if (stats_dict == NULL)
{
if (stats_dict == NULL)
{
- D
B
G ("CFDictionaryGetValue (%s) failed.",
+ D
EBU
G ("CFDictionaryGetValue (%s) failed.",
kIOBlockStorageDriverStatisticsKey);
CFRelease (props_dict);
IOObjectRelease (disk_child);
kIOBlockStorageDriverStatisticsKey);
CFRelease (props_dict);
IOObjectRelease (disk_child);
@@
-350,7
+349,7
@@
static int disk_read (void)
kNilOptions)
!= kIOReturnSuccess)
{
kNilOptions)
!= kIOReturnSuccess)
{
- D
B
G ("IORegistryEntryCreateCFProperties (disk_child) failed.");
+ D
EBU
G ("IORegistryEntryCreateCFProperties (disk_child) failed.");
IOObjectRelease (disk_child);
CFRelease (props_dict);
IOObjectRelease (disk);
IOObjectRelease (disk_child);
CFRelease (props_dict);
IOObjectRelease (disk);
@@
-382,14
+381,14
@@
static int disk_read (void)
if (snprintf (disk_name, 64, "%i-%i", disk_major, disk_minor) >= 64)
{
if (snprintf (disk_name, 64, "%i-%i", disk_major, disk_minor) >= 64)
{
- D
B
G ("snprintf (major, minor) failed.");
+ D
EBU
G ("snprintf (major, minor) failed.");
CFRelease (child_dict);
IOObjectRelease (disk_child);
CFRelease (props_dict);
IOObjectRelease (disk);
continue;
}
CFRelease (child_dict);
IOObjectRelease (disk_child);
CFRelease (props_dict);
IOObjectRelease (disk);
continue;
}
- D
B
G ("disk_name = %s", disk_name);
+ D
EBU
G ("disk_name = %s", disk_name);
if ((read_byt != -1LL) || (write_byt != -1LL))
disk_submit (disk_name, "disk_octets", read_byt, write_byt);
if ((read_byt != -1LL) || (write_byt != -1LL))
disk_submit (disk_name, "disk_octets", read_byt, write_byt);
@@
-516,7
+515,7
@@
static int disk_read (void)
}
else
{
}
else
{
- D
B
G ("numfields = %i; => unknown file format.", numfields);
+ D
EBU
G ("numfields = %i; => unknown file format.", numfields);
continue;
}
continue;
}
@@
-540,14
+539,14
@@
static int disk_read (void)
ds->poll_count++;
if (ds->poll_count <= min_poll_count)
{
ds->poll_count++;
if (ds->poll_count <= min_poll_count)
{
- D
B
G ("(ds->poll_count = %i) <= (min_poll_count = %i); => Not writing.",
+ D
EBU
G ("(ds->poll_count = %i) <= (min_poll_count = %i); => Not writing.",
ds->poll_count, min_poll_count);
continue;
}
if ((read_count == 0) && (write_count == 0))
{
ds->poll_count, min_poll_count);
continue;
}
if ((read_count == 0) && (write_count == 0))
{
- D
B
G ("((read_count == 0) && (write_count == 0)); => Not writing.");
+ D
EBU
G ("((read_count == 0) && (write_count == 0)); => Not writing.");
continue;
}
continue;
}
diff --git
a/src/dns.c
b/src/dns.c
index
56df184
..
11dc287
100644
(file)
--- a/
src/dns.c
+++ b/
src/dns.c
@@
-23,7
+23,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_LIBPCAP && HAVE_LIBPTHREAD
# include "utils_dns.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;
{
counter_list_t *entry;
- D
B
G ("counter_list_search (list = %p, key = %u)",
+ D
EBU
G ("counter_list_search (list = %p, key = %u)",
(void *) *list, key);
for (entry = *list; entry != NULL; entry = entry->next)
if (entry->key == key)
break;
(void *) *list, key);
for (entry = *list; entry != NULL; entry = entry->next)
if (entry->key == key)
break;
- D
B
G ("return (%p)", (void *) entry);
+ D
EBU
G ("return (%p)", (void *) entry);
return (entry);
}
return (entry);
}
@@
-133,7
+132,7
@@
static counter_list_t *counter_list_create (counter_list_t **list,
{
counter_list_t *entry;
{
counter_list_t *entry;
- D
B
G ("counter_list_create (list = %p, key = %u, value = %u)",
+ D
EBU
G ("counter_list_create (list = %p, key = %u, value = %u)",
(void *) *list, key, value);
entry = (counter_list_t *) malloc (sizeof (counter_list_t));
(void *) *list, key, value);
entry = (counter_list_t *) malloc (sizeof (counter_list_t));
@@
-159,7
+158,7
@@
static counter_list_t *counter_list_create (counter_list_t **list,
last->next = entry;
}
last->next = entry;
}
- D
B
G ("return (%p)", (void *) entry);
+ D
EBU
G ("return (%p)", (void *) entry);
return (entry);
}
return (entry);
}
@@
-168,7
+167,7
@@
static void counter_list_add (counter_list_t **list,
{
counter_list_t *entry;
{
counter_list_t *entry;
- D
B
G ("counter_list_add (list = %p, key = %u, increment = %u)",
+ D
EBU
G ("counter_list_add (list = %p, key = %u, increment = %u)",
(void *) *list, key, increment);
entry = counter_list_search (list, key);
(void *) *list, key, increment);
entry = counter_list_search (list, key);
@@
-181,7
+180,7
@@
static void counter_list_add (counter_list_t **list,
{
counter_list_create (list, key, increment);
}
{
counter_list_create (list, key, increment);
}
- D
B
G ("return ()");
+ D
EBU
G ("return ()");
}
static int dns_config (const char *key, const char *value)
}
static int dns_config (const char *key, const char *value)
@@
-253,7
+252,7
@@
static void *dns_child_loop (void *dummy)
}
/* Passing `pcap_device == NULL' is okay and the same as passign "any" */
}
/* Passing `pcap_device == NULL' is okay and the same as passign "any" */
- D
B
G ("Creating PCAP object..");
+ D
EBU
G ("Creating PCAP object..");
pcap_obj = pcap_open_live (pcap_device,
PCAP_SNAPLEN,
0 /* Not promiscuous */,
pcap_obj = pcap_open_live (pcap_device,
PCAP_SNAPLEN,
0 /* Not promiscuous */,
@@
-261,7
+260,7
@@
static void *dns_child_loop (void *dummy)
pcap_error);
if (pcap_obj == NULL)
{
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);
"failed: %s",
(pcap_device != NULL) ? pcap_device : "any",
pcap_error);
@@
-271,18
+270,18
@@
static void *dns_child_loop (void *dummy)
memset (&fp, 0, sizeof (fp));
if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0)
{
memset (&fp, 0, sizeof (fp));
if (pcap_compile (pcap_obj, &fp, "udp port 53", 1, 0) < 0)
{
- D
B
G ("pcap_compile failed");
-
syslog (LOG_ERR,
"dns plugin: pcap_compile failed");
+ D
EBU
G ("pcap_compile failed");
+
ERROR (
"dns plugin: pcap_compile failed");
return (NULL);
}
if (pcap_setfilter (pcap_obj, &fp) < 0)
{
return (NULL);
}
if (pcap_setfilter (pcap_obj, &fp) < 0)
{
- D
B
G ("pcap_setfilter failed");
-
syslog (LOG_ERR,
"dns plugin: pcap_setfilter failed");
+ D
EBU
G ("pcap_setfilter failed");
+
ERROR (
"dns plugin: pcap_setfilter failed");
return (NULL);
}
return (NULL);
}
- D
B
G ("PCAP object created.");
+ D
EBU
G ("PCAP object created.");
dnstop_set_pcap_obj (pcap_obj);
dnstop_set_callback (dns_child_callback);
dnstop_set_pcap_obj (pcap_obj);
dnstop_set_callback (dns_child_callback);
@@
-292,10
+291,10
@@
static void *dns_child_loop (void *dummy)
handle_pcap /* callback */,
NULL /* Whatever this means.. */);
if (status < 0)
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));
"abnormally: %s", pcap_geterr (pcap_obj));
- D
B
G ("child is exiting");
+ D
EBU
G ("child is exiting");
pcap_close (pcap_obj);
listen_thread_init = 0;
pcap_close (pcap_obj);
listen_thread_init = 0;
@@
-321,7
+320,7
@@
static int dns_init (void)
(void *) 0);
if (status != 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);
}
strerror (status));
return (-1);
}
@@
-393,7
+392,7
@@
static int dns_read (void)
for (i = 0; i < len; i++)
{
for (i = 0; i < len; i++)
{
- D
B
G ("qtype = %u; counter = %u;", keys[i], values[i]);
+ D
EBU
G ("qtype = %u; counter = %u;", keys[i], values[i]);
submit_counter ("dns_qtype", qtype_str (keys[i]), values[i]);
}
submit_counter ("dns_qtype", qtype_str (keys[i]), values[i]);
}
@@
-409,7
+408,7
@@
static int dns_read (void)
for (i = 0; i < len; i++)
{
for (i = 0; i < len; i++)
{
- D
B
G ("opcode = %u; counter = %u;", keys[i], values[i]);
+ D
EBU
G ("opcode = %u; counter = %u;", keys[i], values[i]);
submit_counter ("dns_opcode", opcode_str (keys[i]), values[i]);
}
submit_counter ("dns_opcode", opcode_str (keys[i]), values[i]);
}
@@
-425,7
+424,7
@@
static int dns_read (void)
for (i = 0; i < len; i++)
{
for (i = 0; i < len; i++)
{
- D
B
G ("rcode = %u; counter = %u;", keys[i], values[i]);
+ D
EBU
G ("rcode = %u; counter = %u;", keys[i], values[i]);
submit_counter ("dns_rcode", rcode_str (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
ed0f9a2
..
a027833
100644
(file)
--- a/
src/email.c
+++ b/
src/email.c
@@
-81,8
+81,8
@@
#define MAX_CONNS 5
#define MAX_CONNS_LIMIT 16384
#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
/*
* Private data structures
diff --git
a/src/exec.c
b/src/exec.c
index
63401be
..
fa0196b
100644
(file)
--- a/
src/exec.c
+++ b/
src/exec.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#include <sys/types.h>
#include <pwd.h>
#include <sys/types.h>
#include <pwd.h>
@@
-129,7
+128,7
@@
static void submit_counter (const char *type_instance, counter_t value)
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- D
B
G ("type_instance = %s; value = %llu;", type_instance, value);
+ D
EBU
G ("type_instance = %s; value = %llu;", type_instance, value);
values[0].counter = value;
values[0].counter = value;
@@
-149,7
+148,7
@@
static void submit_gauge (const char *type_instance, gauge_t value)
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- D
B
G ("type_instance = %s; value = %lf;", type_instance, value);
+ D
EBU
G ("type_instance = %s; value = %lf;", type_instance, value);
values[0].gauge = value;
values[0].gauge = value;
@@
-178,26
+177,26
@@
static void exec_child (program_list_t *pl)
status = getpwnam_r (pl->user, &sp, pwnambuf, sizeof (pwnambuf), &sp_ptr);
if (status != 0)
{
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)
{
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)
{
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)
{
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);
}
exit (-1);
}
@@
-209,7
+208,7
@@
static void exec_child (program_list_t *pl)
status = execlp (pl->exec, arg0, (char *) 0);
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 */
exit (-1);
} /* void exec_child */
@@
-224,14
+223,14
@@
static int fork_child (program_list_t *pl)
status = pipe (fd_pipe);
if (status != 0)
{
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)
{
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)
return (-1);
}
else if (pl->pid == 0)
@@
-270,7
+269,7
@@
static void *exec_read_one (void *arg)
fh = fdopen (fd, "r");
if (fh == NULL)
{
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);
strerror (errno));
kill (pl->pid, SIGTERM);
close (fd);
@@
-284,7
+283,7
@@
static void *exec_read_one (void *arg)
char *type_instance;
char *value;
char *type_instance;
char *value;
- D
B
G ("buffer = %s", buffer);
+ D
EBU
G ("buffer = %s", buffer);
len = strlen (buffer);
if (len < 5)
len = strlen (buffer);
if (len < 5)
@@
-304,7
+303,7
@@
static void *exec_read_one (void *arg)
if ((strcasecmp ("counter", type) != 0)
&& (strcasecmp ("gauge", type) != 0))
{
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;
}
continue;
}
@@
-314,7
+313,7
@@
static void *exec_read_one (void *arg)
*value = '\0';
value++;
*value = '\0';
value++;
- D
B
G ("value = %s", value);
+ D
EBU
G ("value = %s", value);
if (strcasecmp ("counter", type) == 0)
submit_counter (type_instance, atoll (value));
if (strcasecmp ("counter", type) == 0)
submit_counter (type_instance, atoll (value));
diff --git
a/src/hddtemp.c
b/src/hddtemp.c
index
353fbe3
..
c2ff19e
100644
(file)
--- a/
src/hddtemp.c
+++ b/
src/hddtemp.c
@@
-30,7
+30,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#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 HAVE_NETDB_H && HAVE_SYS_SOCKET_H && HAVE_NETINET_IN_H \
&& HAVE_NETINET_TCP_H && HAVE_LIBGEN_H
@@
-134,7
+133,7
@@
static int hddtemp_query_daemon (char *buffer, int buffer_size)
if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
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);
host, port,
ai_return == EAI_SYSTEM ? strerror (errno) : gai_strerror (ai_return));
return (-1);
@@
-146,7
+145,7
@@
static int hddtemp_query_daemon (char *buffer, int buffer_size)
/* create our socket descriptor */
if ((fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol)) < 0)
{
/* 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;
}
strerror (errno));
continue;
}
@@
-154,7
+153,7
@@
static int hddtemp_query_daemon (char *buffer, int buffer_size)
/* connect to the hddtemp daemon */
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
/* connect to the hddtemp daemon */
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
- D
B
G ("hddtemp: connect (%s, %s): %s", host, port,
+ D
EBU
G ("hddtemp: connect (%s, %s): %s", host, port,
strerror (errno));
close (fd);
fd = -1;
strerror (errno));
close (fd);
fd = -1;
@@
-170,7
+169,7
@@
static int hddtemp_query_daemon (char *buffer, int buffer_size)
if (fd < 0)
{
if (fd < 0)
{
-
syslog (LOG_ERR,
"hddtemp: Could not connect to daemon.");
+
ERROR (
"hddtemp: Could not connect to daemon.");
return (-1);
}
return (-1);
}
@@
-185,7
+184,7
@@
static int hddtemp_query_daemon (char *buffer, int buffer_size)
if ((errno == EAGAIN) || (errno == EINTR))
continue;
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);
strerror (errno));
close (fd);
return (-1);
@@
-199,11
+198,11
@@
static int hddtemp_query_daemon (char *buffer, int buffer_size)
if (buffer_fill >= buffer_size)
{
buffer[buffer_size - 1] = '\0';
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)
{
}
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);
"Buffer: `%s'", buffer);
close (fd);
return (-1);
@@
-267,7
+266,7
@@
static int hddtemp_init (void)
if ((fh = fopen ("/proc/partitions", "r")) != NULL)
{
if ((fh = fopen ("/proc/partitions", "r")) != NULL)
{
- D
B
G ("Looking at /proc/partitions...");
+ D
EBU
G ("Looking at /proc/partitions...");
while (fgets (buf, sizeof (buf), fh) != NULL)
{
while (fgets (buf, sizeof (buf), fh) != NULL)
{
@@
-341,25
+340,25
@@
static int hddtemp_init (void)
/* Skip all other majors. */
default:
/* Skip all other majors. */
default:
- D
B
G ("Skipping unknown major %i", major);
+ D
EBU
G ("Skipping unknown major %i", major);
continue;
} /* switch (major) */
if ((name = strdup (fields[3])) == NULL)
{
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)
{
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;
}
(unsigned int) sizeof (hddname_t));
free (name);
continue;
}
- D
B
G ("Found disk: %s (%u:%u).", name, major, minor);
+ D
EBU
G ("Found disk: %s (%u:%u).", name, major, minor);
entry->major = major;
entry->minor = minor;
entry->major = major;
entry->minor = minor;
@@
-379,7
+378,7
@@
static int hddtemp_init (void)
fclose (fh);
}
else
fclose (fh);
}
else
- D
B
G ("Could not open /proc/partitions: %s",
+ D
EBU
G ("Could not open /proc/partitions: %s",
strerror (errno));
#endif /* KERNEL_LINUX */
strerror (errno));
#endif /* KERNEL_LINUX */
@@
-405,7
+404,7
@@
static char *hddtemp_get_name (char *drive)
if (list == NULL)
{
if (list == NULL)
{
- D
B
G ("Don't know %s, keeping name as-is.", drive);
+ D
EBU
G ("Don't know %s, keeping name as-is.", drive);
return (strdup (drive));
}
return (strdup (drive));
}
diff --git
a/src/iptables.c
b/src/iptables.c
index
b6aa938
..
bc15559
100644
(file)
--- a/
src/iptables.c
+++ b/
src/iptables.c
@@
-24,7
+24,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_LIBIPTC_LIBIPTC_H
# include <libiptc/libiptc.h>
#if HAVE_LIBIPTC_LIBIPTC_H
# include <libiptc/libiptc.h>
diff --git
a/src/irq.c
b/src/irq.c
index
6c30e95
..
d44ac0b
100644
(file)
--- a/
src/irq.c
+++ b/
src/irq.c
@@
-78,7
+78,7
@@
static int irq_config (const char *key, const char *value)
if (temp == NULL)
{
fprintf (stderr, "irq plugin: Cannot allocate more memory.\n");
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;
return (1);
}
irq_list = temp;
@@
-91,7
+91,7
@@
static int irq_config (const char *key, const char *value)
{
fprintf (stderr, "irq plugin: Irq value is not a "
"number: `%s'\n", value);
{
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);
}
"number: `%s'", value);
return (1);
}
@@
-178,7
+178,7
@@
static int irq_read (void)
if ((fh = fopen ("/proc/interrupts", "r")) == NULL)
{
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);
}
strerror (errno));
return (-1);
}
diff --git
a/src/load.c
b/src/load.c
index
0876655
..
aaba3a5
100644
(file)
--- a/
src/load.c
+++ b/
src/load.c
@@
-82,7
+82,7
@@
static int load_read (void)
if (getloadavg (load, 3) == 3)
load_submit (load[LOADAVG_1MIN], load[LOADAVG_5MIN], load[LOADAVG_15MIN]);
else
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)
/* #endif HAVE_GETLOADAVG */
#elif defined(KERNEL_LINUX)
@@
-95,19
+95,19
@@
static int load_read (void)
if ((loadavg = fopen ("/proc/loadavg", "r")) == NULL)
{
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)
{
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))
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);
numfields = strsplit (buffer, fields, 8);
diff --git
a/src/mbmon.c
b/src/mbmon.c
index
e03f2f9
..
241d7d0
100644
(file)
--- a/
src/mbmon.c
+++ b/
src/mbmon.c
@@
-25,7
+25,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#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 HAVE_NETDB_H && HAVE_SYS_SOCKET_H && HAVE_NETINET_IN_H && HAVE_NETINET_TCP_H
# include <netdb.h>
@@
-140,7
+139,7
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
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);
host, port,
ai_return == EAI_SYSTEM ? strerror (errno) : gai_strerror (ai_return));
return (-1);
@@
-152,7
+151,7
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
/* create our socket descriptor */
if ((fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol)) < 0)
{
/* 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;
}
strerror (errno));
continue;
}
@@
-160,7
+159,7
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
/* connect to the mbmon daemon */
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
/* connect to the mbmon daemon */
if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
{
- D
B
G ("mbmon: connect (%s, %s): %s", host, port,
+ D
EBU
G ("mbmon: connect (%s, %s): %s", host, port,
strerror (errno));
close (fd);
fd = -1;
strerror (errno));
close (fd);
fd = -1;
@@
-176,7
+175,7
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
if (fd < 0)
{
if (fd < 0)
{
-
syslog (LOG_ERR,
"mbmon: Could not connect to daemon.");
+
ERROR (
"mbmon: Could not connect to daemon.");
return (-1);
}
return (-1);
}
@@
-191,7
+190,7
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
if ((errno == EAGAIN) || (errno == EINTR))
continue;
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);
strerror (errno));
close (fd);
return (-1);
@@
-205,11
+204,11
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
if (buffer_fill >= buffer_size)
{
buffer[buffer_size - 1] = '\0';
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)
{
}
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);
"Buffer: `%s'", buffer);
close (fd);
return (-1);
@@
-292,7
+291,7
@@
static int mbmon_read (void)
value = strtod (t, &nextc);
if ((*nextc != '\n') && (*nextc != '\0'))
{
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;
}
break;
}
diff --git
a/src/memory.c
b/src/memory.c
index
38a6dc2
..
9168027
100644
(file)
--- a/
src/memory.c
+++ b/
src/memory.c
@@
-22,7
+22,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#ifdef HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#ifdef HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
@@
-149,7
+148,7
@@
static int memory_read (void)
(host_info_t) &vm_data,
&vm_data_len)) != KERN_SUCCESS)
{
(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);
}
return (-1);
}
@@
-215,11
+214,11
@@
static int memory_read (void)
(void *) &sysctl_vals[i], &len,
NULL, 0)) < 0)
{
(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);
}
sysctl_keys[i], strerror (errno));
return (-1);
}
- D
B
G ("%26s: %6i", sysctl_keys[i], sysctl_vals[i]);
+ D
EBU
G ("%26s: %6i", sysctl_keys[i], sysctl_vals[i]);
} /* for i */
/* multiply all all page counts with the pagesize */
} /* for i */
/* multiply all all page counts with the pagesize */
@@
-246,7
+245,7
@@
static int memory_read (void)
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
-
syslog (LOG_WARNING,
"memory: fopen: %s", strerror (errno));
+
WARNING (
"memory: fopen: %s", strerror (errno));
return (-1);
}
return (-1);
}
@@
-274,7
+273,7
@@
static int memory_read (void)
}
if (fclose (fh))
}
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))
{
if (mem_used >= (mem_free + mem_buffered + mem_cached))
{
diff --git
a/src/multimeter.c
b/src/multimeter.c
index
8cb18c8
..
04196bb
100644
(file)
--- a/
src/multimeter.c
+++ b/
src/multimeter.c
@@
-81,7
+81,7
@@
static int multimeter_read_value(double *value)
if (gettimeofday (&time_end, NULL) < 0)
{
if (gettimeofday (&time_end, NULL) < 0)
{
-
syslog (LOG_ERR,
"multimeter plugin: gettimeofday failed: %s",
+
ERROR (
"multimeter plugin: gettimeofday failed: %s",
strerror (errno));
return (-1);
}
strerror (errno));
return (-1);
}
@@
-103,7
+103,7
@@
static int multimeter_read_value(double *value)
if (gettimeofday (&time_now, NULL) < 0)
{
if (gettimeofday (&time_now, NULL) < 0)
{
-
syslog (LOG_ERR,
"multimeter plugin: "
+
ERROR (
"multimeter plugin: "
"gettimeofday failed: %s",
strerror (errno));
return (-1);
"gettimeofday failed: %s",
strerror (errno));
return (-1);
@@
-157,7
+157,7
@@
static int multimeter_read_value(double *value)
}
else /* status == -1 */
{
}
else /* status == -1 */
{
-
syslog (LOG_ERR,
"multimeter plugin: "
+
ERROR (
"multimeter plugin: "
"select failed: %s",
strerror (errno));
break;
"select failed: %s",
strerror (errno));
break;
@@
-201,14
+201,14
@@
static int multimeter_init (void)
}
else
{
}
else
{
-
syslog (LOG_INFO,
"multimeter plugin: Device "
+
INFO (
"multimeter plugin: Device "
"found at %s", device);
return (0);
}
}
}
"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
return (-1);
}
#undef LINE_LENGTH
diff --git
a/src/mysql.c
b/src/mysql.c
index
a2604e4
..
f622d3d
100644
(file)
--- a/
src/mysql.c
+++ b/
src/mysql.c
@@
-120,7
+120,7
@@
static MYSQL *getconnection (void)
int err;
if ((err = mysql_ping (con)) != 0)
{
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
state = 0;
}
else
@@
-145,14
+145,14
@@
static MYSQL *getconnection (void)
if ((con = mysql_init (con)) == NULL)
{
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)
{
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);
}
state = 0;
return (NULL);
}
@@
-291,14
+291,14
@@
static int mysql_read (void)
if (mysql_real_query (con, query, query_len))
{
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)
{
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);
}
mysql_error (con));
return (-1);
}
diff --git
a/src/network.c
b/src/network.c
index
cf2a017
..
6c6e0f6
100644
(file)
--- a/
src/network.c
+++ b/
src/network.c
@@
-23,7
+23,6
@@
#include "plugin.h"
#include "common.h"
#include "configfile.h"
#include "plugin.h"
#include "common.h"
#include "configfile.h"
-#include "utils_debug.h"
#include "network.h"
#include "network.h"
@@
-263,7
+262,7
@@
static int parse_part_values (void **ret_buffer, int *ret_buffer_len,
if (buffer_len < (15))
{
if (buffer_len < (15))
{
- D
B
G ("packet is too short: buffer_len = %i", buffer_len);
+ D
EBU
G ("packet is too short: buffer_len = %i", buffer_len);
return (-1);
}
return (-1);
}
@@
-278,7
+277,7
@@
static int parse_part_values (void **ret_buffer, int *ret_buffer_len,
if (h_num != ((h_length - 6) / 9))
{
if (h_num != ((h_length - 6) / 9))
{
- D
B
G ("`length' and `num of values' don't match");
+ D
EBU
G ("`length' and `num of values' don't match");
return (-1);
}
return (-1);
}
@@
-329,7
+328,7
@@
static int parse_part_string (void **ret_buffer, int *ret_buffer_len,
uint16_t h_length;
uint16_t h_type;
uint16_t h_length;
uint16_t h_type;
- D
B
G ("ret_buffer = %p; ret_buffer_len = %i; output = %p; output_len = %i;",
+ D
EBU
G ("ret_buffer = %p; ret_buffer_len = %i; output = %p; output_len = %i;",
*ret_buffer, *ret_buffer_len,
(void *) output, output_len);
*ret_buffer, *ret_buffer_len,
(void *) output, output_len);
@@
-338,11
+337,11
@@
static int parse_part_string (void **ret_buffer, int *ret_buffer_len,
h_length = ntohs (ps.head->length);
h_type = ntohs (ps.head->type);
h_length = ntohs (ps.head->length);
h_type = ntohs (ps.head->type);
- D
B
G ("length = %hu; type = %hu;", h_length, h_type);
+ D
EBU
G ("length = %hu; type = %hu;", h_length, h_type);
if (buffer_len < h_length)
{
if (buffer_len < h_length)
{
- D
B
G ("packet is too short");
+ D
EBU
G ("packet is too short");
return (-1);
}
assert ((h_type == TYPE_HOST)
return (-1);
}
assert ((h_type == TYPE_HOST)
@@
-354,18
+353,18
@@
static int parse_part_string (void **ret_buffer, int *ret_buffer_len,
ps.value = buffer + 4;
if (ps.value[h_length - 5] != '\0')
{
ps.value = buffer + 4;
if (ps.value[h_length - 5] != '\0')
{
- D
B
G ("String does not end with a nullbyte");
+ D
EBU
G ("String does not end with a nullbyte");
return (-1);
}
if (output_len < (h_length - 4))
{
return (-1);
}
if (output_len < (h_length - 4))
{
- D
B
G ("output buffer is too small");
+ D
EBU
G ("output buffer is too small");
return (-1);
}
strcpy (output, ps.value);
return (-1);
}
strcpy (output, ps.value);
- D
B
G ("output = %s", output);
+ D
EBU
G ("output = %s", output);
*ret_buffer = (void *) (buffer + h_length);
*ret_buffer_len = buffer_len - h_length;
*ret_buffer = (void *) (buffer + h_length);
*ret_buffer_len = buffer_len - h_length;
@@
-381,7
+380,7
@@
static int parse_packet (void *buffer, int buffer_len)
value_list_t vl = VALUE_LIST_INIT;
char type[DATA_MAX_NAME_LEN];
value_list_t vl = VALUE_LIST_INIT;
char type[DATA_MAX_NAME_LEN];
- D
B
G ("buffer = %p; buffer_len = %i;", buffer, buffer_len);
+ D
EBU
G ("buffer = %p; buffer_len = %i;", buffer, buffer_len);
memset (&vl, '\0', sizeof (vl));
memset (&type, '\0', sizeof (type));
memset (&vl, '\0', sizeof (vl));
memset (&type, '\0', sizeof (type));
@@
-401,7
+400,7
@@
static int parse_packet (void *buffer, int buffer_len)
if (status != 0)
{
if (status != 0)
{
- D
B
G ("parse_part_values failed.");
+ D
EBU
G ("parse_part_values failed.");
break;
}
break;
}
@@
-410,12
+409,12
@@
static int parse_packet (void *buffer, int buffer_len)
&& (strlen (vl.plugin) > 0)
&& (strlen (type) > 0))
{
&& (strlen (vl.plugin) > 0)
&& (strlen (type) > 0))
{
- D
B
G ("dispatching values");
+ D
EBU
G ("dispatching values");
plugin_dispatch_values (type, &vl);
}
else
{
plugin_dispatch_values (type, &vl);
}
else
{
- D
B
G ("NOT dispatching values");
+ D
EBU
G ("NOT dispatching values");
}
}
else if (header->type == ntohs (TYPE_TIME))
}
}
else if (header->type == ntohs (TYPE_TIME))
@@
-452,7
+451,7
@@
static int parse_packet (void *buffer, int buffer_len)
}
else
{
}
else
{
- D
B
G ("Unknown part type: 0x%0hx", header->type);
+ D
EBU
G ("Unknown part type: 0x%0hx", header->type);
buffer = ((char *) buffer) + header->length;
}
} /* while (buffer_len > sizeof (part_header_t)) */
buffer = ((char *) buffer) + header->length;
}
} /* while (buffer_len > sizeof (part_header_t)) */
@@
-486,7
+485,7
@@
static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai)
if ((network_config_ttl < 1) || (network_config_ttl > 255))
return (-1);
if ((network_config_ttl < 1) || (network_config_ttl > 255))
return (-1);
- D
B
G ("ttl = %i", network_config_ttl);
+ D
EBU
G ("ttl = %i", network_config_ttl);
if (ai->ai_family == AF_INET)
{
if (ai->ai_family == AF_INET)
{
@@
-502,7
+501,7
@@
static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai)
&network_config_ttl,
sizeof (network_config_ttl)) == -1)
{
&network_config_ttl,
sizeof (network_config_ttl)) == -1)
{
-
syslog (LOG_ERR,
"setsockopt: %s", strerror (errno));
+
ERROR (
"setsockopt: %s", strerror (errno));
return (-1);
}
}
return (-1);
}
}
@@
-521,7
+520,7
@@
static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai)
&network_config_ttl,
sizeof (network_config_ttl)) == -1)
{
&network_config_ttl,
sizeof (network_config_ttl)) == -1)
{
-
syslog (LOG_ERR,
"setsockopt: %s", strerror (errno));
+
ERROR (
"setsockopt: %s", strerror (errno));
return (-1);
}
}
return (-1);
}
}
@@
-533,11
+532,11
@@
static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
{
int loop = 1;
{
int loop = 1;
- D
B
G ("fd = %i; calling `bind'", se->fd);
+ D
EBU
G ("fd = %i; calling `bind'", se->fd);
if (bind (se->fd, ai->ai_addr, ai->ai_addrlen) == -1)
{
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);
}
return (-1);
}
@@
-548,7
+547,7
@@
static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
{
struct ip_mreq mreq;
{
struct ip_mreq mreq;
- D
B
G ("fd = %i; IPv4 multicast address found", se->fd);
+ D
EBU
G ("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);
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)
{
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)
{
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);
}
}
return (-1);
}
}
@@
-576,7
+575,7
@@
static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
{
struct ipv6_mreq mreq;
{
struct ipv6_mreq mreq;
- D
B
G ("fd = %i; IPv6 multicast address found", se->fd);
+ D
EBU
G ("fd = %i; IPv6 multicast address found", se->fd);
memcpy (&mreq.ipv6mr_multiaddr,
&addr->sin6_addr,
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)
{
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)
{
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);
}
}
return (-1);
}
}
@@
-623,7
+622,7
@@
static sockent_t *network_create_socket (const char *node,
sockent_t *se_head = NULL;
sockent_t *se_tail = NULL;
sockent_t *se_head = NULL;
sockent_t *se_tail = NULL;
- D
B
G ("node = %s, service = %s", node, service);
+ D
EBU
G ("node = %s, service = %s", node, service);
memset (&ai_hints, '\0', sizeof (ai_hints));
ai_hints.ai_flags = 0;
memset (&ai_hints, '\0', sizeof (ai_hints));
ai_hints.ai_flags = 0;
@@
-640,7
+639,7
@@
static sockent_t *network_create_socket (const char *node,
ai_return = getaddrinfo (node, service, &ai_hints, &ai_list);
if (ai_return != 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)
(node == NULL) ? "(null)" : node,
(service == NULL) ? "(null)" : service,
(ai_return == EAI_SYSTEM)
@@
-655,13
+654,13
@@
static sockent_t *network_create_socket (const char *node,
if ((se = (sockent_t *) malloc (sizeof (sockent_t))) == NULL)
{
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)
{
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;
}
free (se);
continue;
}
@@
-678,7
+677,7
@@
static sockent_t *network_create_socket (const char *node,
if (se->fd == -1)
{
if (se->fd == -1)
{
-
syslog (LOG_ERR,
"socket: %s", strerror (errno));
+
ERROR (
"socket: %s", strerror (errno));
free (se->addr);
free (se);
continue;
free (se->addr);
free (se);
continue;
@@
-828,7
+827,7
@@
int network_receive (void)
if (listen_sockets_num == 0)
{
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);
}
return (-1);
}
@@
-840,7
+839,7
@@
int network_receive (void)
{
if (errno == EINTR)
continue;
{
if (errno == EINTR)
continue;
-
syslog (LOG_ERR,
"poll failed: %s",
+
ERROR (
"poll failed: %s",
strerror (errno));
return (-1);
}
strerror (errno));
return (-1);
}
@@
-856,7
+855,7
@@
int network_receive (void)
0 /* no flags */);
if (buffer_len < 0)
{
0 /* no flags */);
if (buffer_len < 0)
{
-
syslog (LOG_ERR,
"recv failed: %s", strerror (errno));
+
ERROR (
"recv failed: %s", strerror (errno));
return (-1);
}
return (-1);
}
@@
-877,7
+876,7
@@
static void network_send_buffer (const char *buffer, int buffer_len)
sockent_t *se;
int status;
sockent_t *se;
int status;
- D
B
G ("buffer_len = %i", buffer_len);
+ D
EBU
G ("buffer_len = %i", buffer_len);
for (se = sending_sockets; se != NULL; se = se->next)
{
for (se = sending_sockets; se != NULL; se = se->next)
{
@@
-889,7
+888,7
@@
static void network_send_buffer (const char *buffer, int buffer_len)
{
if (errno == EINTR)
continue;
{
if (errno == EINTR)
continue;
-
syslog (LOG_ERR,
"network plugin: sendto failed: %s",
+
ERROR (
"network plugin: sendto failed: %s",
strerror (errno));
break;
}
strerror (errno));
break;
}
@@
-909,7
+908,7
@@
static int add_to_buffer (char *buffer, int buffer_size,
vl->host, strlen (vl->host)) != 0)
return (-1);
strcpy (vl_def->host, vl->host);
vl->host, strlen (vl->host)) != 0)
return (-1);
strcpy (vl_def->host, vl->host);
- D
B
G ("host = %s", vl->host);
+ D
EBU
G ("host = %s", vl->host);
}
if (vl_def->time != vl->time)
}
if (vl_def->time != vl->time)
@@
-918,7
+917,7
@@
static int add_to_buffer (char *buffer, int buffer_size,
(uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
(uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
- D
B
G ("time = %u", (unsigned int) vl->time);
+ D
EBU
G ("time = %u", (unsigned int) vl->time);
}
if (strcmp (vl_def->plugin, vl->plugin) != 0)
}
if (strcmp (vl_def->plugin, vl->plugin) != 0)
@@
-927,7
+926,7
@@
static int add_to_buffer (char *buffer, int buffer_size,
vl->plugin, strlen (vl->plugin)) != 0)
return (-1);
strcpy (vl_def->plugin, vl->plugin);
vl->plugin, strlen (vl->plugin)) != 0)
return (-1);
strcpy (vl_def->plugin, vl->plugin);
- D
B
G ("plugin = %s", vl->plugin);
+ D
EBU
G ("plugin = %s", vl->plugin);
}
if (strcmp (vl_def->plugin_instance, vl->plugin_instance) != 0)
}
if (strcmp (vl_def->plugin_instance, vl->plugin_instance) != 0)
@@
-937,7
+936,7
@@
static int add_to_buffer (char *buffer, int buffer_size,
strlen (vl->plugin_instance)) != 0)
return (-1);
strcpy (vl_def->plugin_instance, vl->plugin_instance);
strlen (vl->plugin_instance)) != 0)
return (-1);
strcpy (vl_def->plugin_instance, vl->plugin_instance);
- D
B
G ("plugin_instance = %s", vl->plugin_instance);
+ D
EBU
G ("plugin_instance = %s", vl->plugin_instance);
}
if (strcmp (type_def, ds->type) != 0)
}
if (strcmp (type_def, ds->type) != 0)
@@
-946,7
+945,7
@@
static int add_to_buffer (char *buffer, int buffer_size,
ds->type, strlen (ds->type)) != 0)
return (-1);
strcpy (type_def, ds->type);
ds->type, strlen (ds->type)) != 0)
return (-1);
strcpy (type_def, ds->type);
- D
B
G ("type = %s", ds->type);
+ D
EBU
G ("type = %s", ds->type);
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
@@
-956,7
+955,7
@@
static int add_to_buffer (char *buffer, int buffer_size,
strlen (vl->type_instance)) != 0)
return (-1);
strcpy (vl_def->type_instance, vl->type_instance);
strlen (vl->type_instance)) != 0)
return (-1);
strcpy (vl_def->type_instance, vl->type_instance);
- D
B
G ("type_instance = %s", vl->type_instance);
+ D
EBU
G ("type_instance = %s", vl->type_instance);
}
if (write_part_values (&buffer, &buffer_size, ds, vl) != 0)
}
if (write_part_values (&buffer, &buffer_size, ds, vl) != 0)
@@
-1005,7
+1004,7
@@
static int network_write (const data_set_t *ds, const value_list_t *vl)
if (status < 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)
"buffer for some weird reason");
}
else if ((sizeof (send_buffer) - send_buffer_fill) < 15)
@@
-1063,7
+1062,7
@@
static int network_config (const char *key, const char *val)
static int network_shutdown (void)
{
static int network_shutdown (void)
{
- D
B
G ("Shutting down.");
+ D
EBU
G ("Shutting down.");
listen_loop++;
listen_loop++;
@@
-1096,7
+1095,7
@@
static int network_init (void)
receive_thread, NULL /* no argument */);
if (status != 0)
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);
strerror (errno));
}
return (0);
diff --git
a/src/nfs.c
b/src/nfs.c
index
004c8f5
..
81f0793
100644
(file)
--- a/
src/nfs.c
+++ b/
src/nfs.c
@@
-23,7
+23,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#define MODULE_NAME "nfs"
#define MODULE_NAME "nfs"
@@
-215,7
+214,7
@@
static void nfs_procedures_submit (const char *plugin_instance,
values[0].counter = val[i];
strncpy (vl.type_instance, names[i],
sizeof (vl.type_instance));
values[0].counter = val[i];
strncpy (vl.type_instance, names[i],
sizeof (vl.type_instance));
- D
B
G ("%s-%s/nfs_procedure-%s = %llu",
+ D
EBU
G ("%s-%s/nfs_procedure-%s = %llu",
vl.plugin, vl.plugin_instance,
vl.type_instance, val[i]);
plugin_dispatch_values ("nfs_procedure", &vl);
vl.plugin, vl.plugin_instance,
vl.type_instance, val[i]);
plugin_dispatch_values ("nfs_procedure", &vl);
@@
-251,7
+250,7
@@
static void nfs_read_stats_file (FILE *fh, char *inst)
if ((numfields - 2) != nfs2_procedures_names_num)
{
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);
"number of fields (= %i) "
"for NFSv2 statistics.",
numfields - 2);
@@
-265,7
+264,7
@@
static void nfs_read_stats_file (FILE *fh, char *inst)
values = (unsigned long long *) malloc (nfs2_procedures_names_num * sizeof (unsigned long long));
if (values == NULL)
{
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;
"failed: %s",
strerror (errno));
continue;
@@
-287,7
+286,7
@@
static void nfs_read_stats_file (FILE *fh, char *inst)
if ((numfields - 2) != nfs3_procedures_names_num)
{
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);
"number of fields (= %i) "
"for NFSv3 statistics.",
numfields - 2);
@@
-301,7
+300,7
@@
static void nfs_read_stats_file (FILE *fh, char *inst)
values = (unsigned long long *) malloc (nfs3_procedures_names_num * sizeof (unsigned long long));
if (values == NULL)
{
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;
"failed: %s",
strerror (errno));
continue;
diff --git
a/src/ntpd.c
b/src/ntpd.c
index
e4a230b
..
668e302
100644
(file)
--- a/
src/ntpd.c
+++ b/
src/ntpd.c
@@
-23,7
+23,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#if HAVE_SYS_SOCKET_H
# define NTPD_HAVE_READ 1
#if HAVE_SYS_SOCKET_H
# define NTPD_HAVE_READ 1
@@
-372,7
+371,7
@@
static int ntpd_connect (void)
if (sock_descr >= 0)
return (sock_descr);
if (sock_descr >= 0)
return (sock_descr);
- D
B
G ("Opening a new socket");
+ D
EBU
G ("Opening a new socket");
host = ntpd_host;
if (host == NULL)
host = ntpd_host;
if (host == NULL)
@@
-390,10
+389,10
@@
static int ntpd_connect (void)
if ((status = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
if ((status = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
- D
B
G ("getaddrinfo (%s, %s): %s",
+ D
EBU
G ("getaddrinfo (%s, %s): %s",
host, port,
status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
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);
host, port,
status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
return (-1);
@@
-422,8
+421,8
@@
static int ntpd_connect (void)
if (sock_descr < 0)
{
if (sock_descr < 0)
{
- D
B
G ("Unable to connect to server.");
-
syslog (LOG_ERR,
"ntpd plugin: Unable to connect to server.");
+ D
EBU
G ("Unable to connect to server.");
+
ERROR (
"ntpd plugin: Unable to connect to server.");
}
return (sock_descr);
}
return (sock_descr);
@@
-471,7
+470,7
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
if (gettimeofday (&time_end, NULL) < 0)
{
if (gettimeofday (&time_end, NULL) < 0)
{
-
syslog (LOG_ERR,
"ntpd plugin: gettimeofday failed: %s",
+
ERROR (
"ntpd plugin: gettimeofday failed: %s",
strerror (errno));
return (-1);
}
strerror (errno));
return (-1);
}
@@
-482,7
+481,7
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
{
if (gettimeofday (&time_now, NULL) < 0)
{
{
if (gettimeofday (&time_now, NULL) < 0)
{
-
syslog (LOG_ERR,
"ntpd plugin: gettimeofday failed: %s",
+
ERROR (
"ntpd plugin: gettimeofday failed: %s",
strerror (errno));
return (-1);
}
strerror (errno));
return (-1);
}
@@
-495,7
+494,7
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
poll_s.events = POLLIN | POLLPRI;
poll_s.revents = 0;
poll_s.events = POLLIN | POLLPRI;
poll_s.revents = 0;
- D
B
G ("Polling for %ims", timeout);
+ D
EBU
G ("Polling for %ims", timeout);
status = poll (&poll_s, 1, timeout);
if ((status < 0) && ((errno == EAGAIN) || (errno == EINTR)))
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)
{
if (status < 0)
{
- D
B
G ("poll failed: %s", strerror (errno));
-
syslog (LOG_ERR,
"ntpd plugin: poll failed: %s",
+ D
EBU
G ("poll failed: %s", strerror (errno));
+
ERROR (
"ntpd plugin: poll failed: %s",
strerror (errno));
return (-1);
}
if (status == 0) /* timeout */
{
strerror (errno));
return (-1);
}
if (status == 0) /* timeout */
{
- D
B
G ("timeout reached.");
+ D
EBU
G ("timeout reached.");
break;
}
break;
}
@@
-523,50
+522,50
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
if (status < 0)
{
if (status < 0)
{
- D
B
G ("recv(2) failed: %s", strerror (errno));
- D
B
G ("Closing socket #%i", sd);
+ D
EBU
G ("recv(2) failed: %s", strerror (errno));
+ D
EBU
G ("Closing socket #%i", sd);
close (sd);
sock_descr = sd = -1;
return (-1);
}
close (sd);
sock_descr = sd = -1;
return (-1);
}
- D
B
G ("recv'd %i bytes", status);
+ D
EBU
G ("recv'd %i bytes", status);
/*
* Do some sanity checks first
*/
if (status < RESP_HEADER_SIZE)
{
/*
* 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)
{
(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))
{
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))
{
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))
{
"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)
{
"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;
}
"got %i", (int) IMPL_XNTPD, (int) res.implementation);
continue;
}
@@
-574,7
+573,7
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
/* Check for error code */
if (INFO_ERR (res.err_nitems) != 0)
{
/* 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));
}
(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);
/* 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);
- D
B
G ("pkt_item_num = %i; pkt_item_len = %i;",
+ D
EBU
G ("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))
{
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);
"%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 */
{
* items have the same size. Discard invalid packets. */
if (items_num == 0) /* first packet */
{
- D
B
G ("*res_size = %i", pkt_item_len);
+ D
EBU
G ("*res_size = %i", pkt_item_len);
*res_size = pkt_item_len;
}
else if (*res_size != pkt_item_len)
{
*res_size = pkt_item_len;
}
else if (*res_size != pkt_item_len)
{
- D
B
G ("Error: *res_size = %i; pkt_item_len = %i;",
+ D
EBU
G ("Error: *res_size = %i; pkt_item_len = %i;",
*res_size, pkt_item_len);
*res_size, pkt_item_len);
-
syslog (LOG_ERR,
"Item sizes differ.");
+
ERROR (
"Item sizes differ.");
continue;
}
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;
pkt_padding = 0;
if (res_item_size > pkt_item_len)
pkt_padding = res_item_size - pkt_item_len;
- D
B
G ("res_item_size = %i; pkt_padding = %i;",
+ D
EBU
G ("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))
{
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;
}
pkt_sequence);
continue;
}
@@
-630,7
+629,7
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
/* Check if this sequence has been received before. If so, discard it. */
if (pkt_recvd[pkt_sequence] != '\0')
{
/* 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;
}
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)
{
{
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;
"claim to be the last one in the "
"sequence have been received.");
continue;
}
pkt_lastseq = pkt_sequence;
- D
B
G ("Last sequence = %i;", pkt_lastseq);
+ D
EBU
G ("Last sequence = %i;", pkt_lastseq);
}
/*
* Enough with the checks. Copy the data now.
* We start by allocating some more memory.
*/
}
/*
* Enough with the checks. Copy the data now.
* We start by allocating some more memory.
*/
- D
B
G ("realloc (%p, %i)", (void *) *res_data,
+ D
EBU
G ("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);
(items_num + pkt_item_num) * res_item_size);
items = realloc ((void *) *res_data,
(items_num + pkt_item_num) * res_item_size);
@@
-662,7
+661,7
@@
static int ntpd_receive_response (int req_code, int *res_items, int *res_size,
if (items == NULL)
{
items = *res_data;
if (items == NULL)
{
items = *res_data;
-
syslog (LOG_ERR,
"ntpd plugin: realloc failed.");
+
ERROR (
"ntpd plugin: realloc failed.");
continue;
}
*res_data = items;
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);
if (req_data != NULL)
memcpy ((void *) req.data, (const void *) req_data, req_data_len);
- D
B
G ("req_items = %i; req_size = %i; req_data = %p;",
+ D
EBU
G ("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)
{
req_items, req_size, (void *) req_data);
status = swrite (sd, (const char *) &req, REQ_LEN_NOMAC);
if (status < 0)
{
- D
B
G ("`swrite' failed. Closing socket #%i", sd);
+ D
EBU
G ("`swrite' failed. Closing socket #%i", sd);
close (sd);
sock_descr = sd = -1;
return (status);
close (sd);
sock_descr = sd = -1;
return (status);
@@
-798,19
+797,19
@@
static int ntpd_read (void)
if (status != 0)
{
if (status != 0)
{
- D
B
G ("ntpd_do_query failed with status %i", status);
+ D
EBU
G ("ntpd_do_query failed with status %i", status);
return (-1);
}
if ((ik == NULL) || (ik_num == 0) || (ik_size == 0))
{
return (-1);
}
if ((ik == NULL) || (ik_num == 0) || (ik_size == 0))
{
- D
B
G ("ntpd_do_query returned: ik = %p; ik_num = %i; ik_size = %i;",
+ D
EBU
G ("ntpd_do_query returned: ik = %p; ik_num = %i; ik_size = %i;",
(void *) ik, ik_num, ik_size);
return (-1);
}
/* kerninfo -> estimated error */
(void *) ik, ik_num, ik_size);
return (-1);
}
/* kerninfo -> estimated error */
- D
B
G ("info_kernel:\n"
+ D
EBU
G ("info_kernel:\n"
" pll offset = %.8f\n"
" pll frequency = %.8f\n" /* drift compensation */
" est error = %.8f\n",
" pll offset = %.8f\n"
" pll frequency = %.8f\n" /* drift compensation */
" est error = %.8f\n",
@@
-831,12
+830,12
@@
static int ntpd_read (void)
sizeof (struct info_peer_summary));
if (status != 0)
{
sizeof (struct info_peer_summary));
if (status != 0)
{
- D
B
G ("ntpd_do_query failed with status %i", status);
+ D
EBU
G ("ntpd_do_query failed with status %i", status);
return (-1);
}
if ((ps == NULL) || (ps_num == 0) || (ps_size == 0))
{
return (-1);
}
if ((ps == NULL) || (ps_num == 0) || (ps_size == 0))
{
- D
B
G ("ntpd_do_query returned: ps = %p; ps_num = %i; ps_size = %i;",
+ D
EBU
G ("ntpd_do_query returned: ps = %p; ps_num = %i; ps_size = %i;",
(void *) ps, ps_num, ps_size);
return (-1);
}
(void *) ps, ps_num, ps_size);
return (-1);
}
@@
-875,7
+874,7
@@
static int ntpd_read (void)
NULL, 0, 0 /* no flags */);
if (status != 0)
{
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));
status == EAI_SYSTEM
? strerror (errno)
: gai_strerror (status));
@@
-925,7
+924,7
@@
static int ntpd_read (void)
}
}
}
}
- D
B
G ("peer %i:\n"
+ D
EBU
G ("peer %i:\n"
" peername = %s\n"
" srcadr = 0x%08x\n"
" delay = %f\n"
" peername = %s\n"
" srcadr = 0x%08x\n"
" delay = %f\n"
diff --git
a/src/ping.c
b/src/ping.c
index
48cea55
..
48a0ac8
100644
(file)
--- a/
src/ping.c
+++ b/
src/ping.c
@@
-23,7
+23,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "utils_debug.h"
#include <netinet/in.h>
#include "liboping/oping.h"
#include <netinet/in.h>
#include "liboping/oping.h"
@@
-78,14
+77,14
@@
static void add_hosts (void)
hl_prev = NULL;
while (hl_this != NULL)
{
hl_prev = NULL;
while (hl_this != NULL)
{
- D
B
G ("host = %s, wait_left = %i, wait_time = %i, next = %p",
+ D
EBU
G ("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)
{
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)
{
- D
B
G ("Successfully added host %s", hl_this->host);
+ D
EBU
G ("Successfully added host %s", hl_this->host);
/* Remove the host from the linked list */
if (hl_prev != NULL)
hl_prev->next = hl_this->next;
/* Remove the host from the linked list */
if (hl_prev != NULL)
hl_prev->next = hl_this->next;
@@
-130,7
+129,7
@@
static int ping_config (const char *key, const char *value)
{
if ((pingobj = ping_construct ()) == NULL)
{
{
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);
}
ping_get_error (pingobj));
return (1);
}
@@
-144,14
+143,14
@@
static int ping_config (const char *key, const char *value)
if ((hl = (hostlist_t *) malloc (sizeof (hostlist_t))) == NULL)
{
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);
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);
}
strerror (errno));
return (1);
}
@@
-167,7
+166,7
@@
static int ping_config (const char *key, const char *value)
int ttl = atoi (value);
if (ping_setopt (pingobj, PING_DEF_TIMEOUT, (void *) &ttl))
{
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);
}
}
return (1);
}
}
@@
-213,7
+212,7
@@
static int ping_read (void)
if (ping_send (pingobj) < 0)
{
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);
}
ping_get_error (pingobj));
return (-1);
}
@@
-232,7
+231,7
@@
static int ping_read (void)
&latency, &buf_len))
continue;
&latency, &buf_len))
continue;
- D
B
G ("host = %s, latency = %f", host, latency);
+ D
EBU
G ("host = %s, latency = %f", host, latency);
ping_submit (host, latency);
}
ping_submit (host, latency);
}
diff --git
a/src/plugin.c
b/src/plugin.c
index
f2e205a
..
87fdcce
100644
(file)
--- a/
src/plugin.c
+++ b/
src/plugin.c
@@
-26,7
+26,6
@@
#include "plugin.h"
#include "configfile.h"
#include "utils_llist.h"
#include "plugin.h"
#include "configfile.h"
#include "utils_llist.h"
-#include "utils_debug.h"
/*
* Private structures
/*
* Private structures
@@
-112,7
+111,7
@@
static int plugin_load_file (char *file)
lt_dlhandle dlh;
void (*reg_handle) (void);
lt_dlhandle dlh;
void (*reg_handle) (void);
- D
B
G ("file = %s", file);
+ D
EBU
G ("file = %s", file);
lt_dlinit ();
lt_dlerror (); /* clear errors */
lt_dlinit ();
lt_dlerror (); /* clear errors */
@@
-121,14
+120,14
@@
static int plugin_load_file (char *file)
{
const char *error = lt_dlerror ();
{
const char *error = lt_dlerror ();
-
syslog (LOG_ERR,
"lt_dlopen failed: %s", error);
- D
B
G ("lt_dlopen failed: %s", error);
+
ERROR (
"lt_dlopen failed: %s", error);
+ D
EBU
G ("lt_dlopen failed: %s", error);
return (1);
}
if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
{
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);
file, lt_dlerror ());
lt_dlclose (dlh);
return (-1);
@@
-150,7
+149,7
@@
void plugin_set_dir (const char *dir)
if (dir == NULL)
plugindir = NULL;
else if ((plugindir = strdup (dir)) == NULL)
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
}
#define BUFSIZE 512
@@
-165,7
+164,7
@@
int plugin_load (const char *type)
struct stat statbuf;
struct dirent *de;
struct stat statbuf;
struct dirent *de;
- D
B
G ("type = %s", type);
+ D
EBU
G ("type = %s", type);
dir = plugin_get_dir ();
ret = 1;
dir = plugin_get_dir ();
ret = 1;
@@
-174,14
+173,14
@@
int plugin_load (const char *type)
* type when matching the filename */
if (snprintf (typename, BUFSIZE, "%s.so", type) >= BUFSIZE)
{
* 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)
{
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);
}
return (-1);
}
@@
-192,13
+191,13
@@
int plugin_load (const char *type)
if (snprintf (filename, BUFSIZE, "%s/%s", dir, de->d_name) >= BUFSIZE)
{
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)
{
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))
continue;
}
else if (!S_ISREG (statbuf.st_mode))
@@
-245,7
+244,7
@@
int plugin_register_read (const char *name,
rf = (read_func_t *) malloc (sizeof (read_func_t));
if (rf == NULL)
{
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);
}
strerror (errno));
return (-1);
}
@@
-340,7
+339,7
@@
void plugin_init_all (void)
if (status != 0)
{
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);
"failed with status %i. "
"Plugin will be unloaded. TODO!",
le->key, status);
@@
-384,7
+383,7
@@
void plugin_read_all (const int *loop)
if (rf->wait_time > 86400)
rf->wait_time = 86400;
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);
}
"failed. Will syspend it for %i "
"seconds.", le->key, rf->wait_left);
}
@@
-428,13
+427,13
@@
int plugin_dispatch_values (const char *name, const value_list_t *vl)
le = llist_search (list_data_set, name);
if (le == NULL)
{
le = llist_search (list_data_set, name);
if (le == NULL)
{
- D
B
G ("No such dataset registered: %s", name);
+ D
EBU
G ("No such dataset registered: %s", name);
return (-1);
}
ds = (data_set_t *) le->value;
return (-1);
}
ds = (data_set_t *) le->value;
- D
B
G ("time = %u; host = %s; "
+ D
EBU
G ("time = %u; host = %s; "
"plugin = %s; plugin_instance = %s; "
"type = %s; type_instance = %s;",
(unsigned int) vl->time, vl->host,
"plugin = %s; plugin_instance = %s; "
"type = %s; type_instance = %s;",
(unsigned int) vl->time, vl->host,
@@
-511,7
+510,7
@@
void plugin_complain (int level, complain_t *c, const char *format, ...)
message[511] = '\0';
va_end (ap);
message[511] = '\0';
va_end (ap);
-
sys
log (level, message);
+
plugin_
log (level, message);
}
void plugin_relief (int level, complain_t *c, const char *format, ...)
}
void plugin_relief (int level, complain_t *c, const char *format, ...)
@@
-529,5
+528,5
@@
void plugin_relief (int level, complain_t *c, const char *format, ...)
message[511] = '\0';
va_end (ap);
message[511] = '\0';
va_end (ap);
-
sys
log (level, message);
+
plugin_
log (level, message);
}
}
diff --git
a/src/processes.c
b/src/processes.c
index
37d0a75
..
e5c2512
100644
(file)
--- a/
src/processes.c
+++ b/
src/processes.c
@@
-25,7
+25,6
@@
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#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.. */
#include "configfile.h"
/* Include header files for the mach system, if they exist.. */
@@
-388,7
+387,7
@@
static void ps_list_reset (void)
{
if (pse->age > 10)
{
{
if (pse->age > 10)
{
- D
B
G ("Removing this procstat entry cause it's too old: "
+ D
EBU
G ("Removing this procstat entry cause it's too old: "
"id = %lu; name = %s;",
pse->id, ps->name);
"id = %lu; name = %s;",
pse->id, ps->name);
@@
-451,7
+450,7
@@
static int ps_init (void)
&pset_list,
&pset_list_len)) != KERN_SUCCESS)
{
&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;
mach_error_string (status));
pset_list = NULL;
pset_list_len = 0;
@@
-461,7
+460,7
@@
static int ps_init (void)
#elif KERNEL_LINUX
pagesize_g = sysconf(_SC_PAGESIZE);
#elif KERNEL_LINUX
pagesize_g = sysconf(_SC_PAGESIZE);
- D
B
G ("pagesize_g = %li; CONFIG_HZ = %i;",
+ D
EBU
G ("pagesize_g = %li; CONFIG_HZ = %i;",
pagesize_g, CONFIG_HZ);
#endif /* KERNEL_LINUX */
pagesize_g, CONFIG_HZ);
#endif /* KERNEL_LINUX */
@@
-517,7
+516,7
@@
static void ps_submit_proc_list (procstat_t *ps)
vl.values_len = 2;
plugin_dispatch_values ("ps_pagefaults", &vl);
vl.values_len = 2;
plugin_dispatch_values ("ps_pagefaults", &vl);
- D
B
G ("name = %s; num_proc = %lu; num_lwp = %lu; vmem_rss = %lu; "
+ D
EBU
G ("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,
"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,
@@
-541,7
+540,7
@@
static int *ps_read_tasks (int pid)
if ((dh = opendir (dirname)) == NULL)
{
if ((dh = opendir (dirname)) == NULL)
{
- D
B
G ("Failed to open directory `%s'", dirname);
+ D
EBU
G ("Failed to open directory `%s'", dirname);
return (NULL);
}
return (NULL);
}
@@
-561,7
+560,7
@@
static int *ps_read_tasks (int pid)
{
if (list != NULL)
free (list);
{
if (list != NULL)
free (list);
-
syslog (LOG_ERR,
"processes plugin: "
+
ERROR (
"processes plugin: "
"Failed to allocate more memory.");
return (NULL);
}
"Failed to allocate more memory.");
return (NULL);
}
@@
-623,20
+622,20
@@
int ps_read_process (int pid, procstat_t *ps, char *state)
fields_len = strsplit (buffer, fields, 64);
if (fields_len < 24)
{
fields_len = strsplit (buffer, fields, 64);
if (fields_len < 24)
{
- D
B
G ("`%s' has only %i fields..",
+ D
EBU
G ("`%s' has only %i fields..",
filename, fields_len);
return (-1);
}
else if (fields_len != 41)
{
filename, fields_len);
return (-1);
}
else if (fields_len != 41)
{
- D
B
G ("WARNING: (fields_len = %i) != 41", fields_len);
+ D
EBU
G ("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] != ')'))
{
}
/* copy the name, strip brackets in the process */
name_len = strlen (fields[1]) - 2;
if ((fields[1][0] != '(') || (fields[1][name_len + 1] != ')'))
{
- D
B
G ("No brackets found in process name: `%s'", fields[1]);
+ D
EBU
G ("No brackets found in process name: `%s'", fields[1]);
return (-1);
}
fields[1] = fields[1] + 1;
return (-1);
}
fields[1] = fields[1] + 1;
@@
-648,7
+647,7
@@
int ps_read_process (int pid, procstat_t *ps, char *state)
if ((tasks = ps_read_tasks (pid)) == NULL)
{
/* This happends for zombied, e.g. */
if ((tasks = ps_read_tasks (pid)) == NULL)
{
/* This happends for zombied, e.g. */
- D
B
G ("ps_read_tasks (%i) failed.", pid);
+ D
EBU
G ("ps_read_tasks (%i) failed.", pid);
*state = 'Z';
ps->num_lwp = 0;
ps->num_proc = 0;
*state = 'Z';
ps->num_lwp = 0;
ps->num_proc = 0;
@@
-668,7
+667,7
@@
int ps_read_process (int pid, procstat_t *ps, char *state)
/* Leave the rest at zero if this is only an LWP */
if (ps->num_proc == 0)
{
/* Leave the rest at zero if this is only an LWP */
if (ps->num_proc == 0)
{
- D
B
G ("This is only an LWP: pid = %i; name = %s;",
+ D
EBU
G ("This is only an LWP: pid = %i; name = %s;",
pid, ps->name);
return (0);
}
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';
strncpy (name, kp.kp_proc.p_comm, name_max_len - 1);
name[name_max_len - 1] = '\0';
- D
B
G ("pid = %i; name = %s;", *pid, name);
+ D
EBU
G ("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
/* 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
@@
-777,7
+776,7
@@
static int ps_read (void)
pset_list[pset],
&port_pset_priv)) != KERN_SUCCESS)
{
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;
}
mach_error_string (status));
continue;
}
@@
-786,7
+785,7
@@
static int ps_read (void)
&task_list,
&task_list_len)) != KERN_SUCCESS)
{
&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;
mach_error_string (status));
mach_port_deallocate (port_task_self, port_pset_priv);
continue;
@@
-820,7
+819,7
@@
static int ps_read (void)
&task_basic_info_len);
if (status != KERN_SUCCESS)
{
&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 */
}
mach_error_string (status));
continue; /* with next thread_list */
}
@@
-832,7
+831,7
@@
static int ps_read (void)
&task_events_info_len);
if (status != KERN_SUCCESS)
{
&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 */
}
mach_error_string (status));
continue; /* with next thread_list */
}
@@
-844,7
+843,7
@@
static int ps_read (void)
&task_absolutetime_info_len);
if (status != KERN_SUCCESS)
{
&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 */
}
mach_error_string (status));
continue; /* with next thread_list */
}
@@
-868,7
+867,7
@@
static int ps_read (void)
* thread is nonsense, since the task/process
* is dead. */
zombies++;
* thread is nonsense, since the task/process
* is dead. */
zombies++;
- D
B
G ("task_threads failed: %s",
+ D
EBU
G ("task_threads failed: %s",
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
@@
-885,7
+884,7
@@
static int ps_read (void)
&thread_data_len);
if (status != KERN_SUCCESS)
{
&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,
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
@@
-917,8
+916,7
@@
static int ps_read (void)
* There's only zombie tasks, which are
* handled above. */
default:
* 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) */
thread_data.run_state);
break;
} /* switch (thread_data.run_state) */
@@
-928,7
+926,7
@@
static int ps_read (void)
status = mach_port_deallocate (port_task_self,
thread_list[thread]);
if (status != KERN_SUCCESS)
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) */
mach_error_string (status));
}
} /* for (thread_list) */
@@
-938,7
+936,7
@@
static int ps_read (void)
thread_list_len * sizeof (thread_act_t)))
!= KERN_SUCCESS)
{
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;
mach_error_string (status));
}
thread_list = NULL;
@@
-952,7
+950,7
@@
static int ps_read (void)
status = mach_port_deallocate (port_task_self,
task_list[task]);
if (status != KERN_SUCCESS)
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));
}
mach_error_string (status));
}
@@
-964,7
+962,7
@@
static int ps_read (void)
(vm_address_t) task_list,
task_list_len * sizeof (task_t))) != KERN_SUCCESS)
{
(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;
mach_error_string (status));
}
task_list = NULL;
@@
-973,7
+971,7
@@
static int ps_read (void)
if ((status = mach_port_deallocate (port_task_self, port_pset_priv))
!= KERN_SUCCESS)
{
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) */
mach_error_string (status));
}
} /* for (pset_list) */
@@
-1012,7
+1010,7
@@
static int ps_read (void)
if ((proc = opendir ("/proc")) == NULL)
{
if ((proc = opendir ("/proc")) == NULL)
{
-
syslog (LOG_ERR,
"Cannot open `/proc': %s", strerror (errno));
+
ERROR (
"Cannot open `/proc': %s", strerror (errno));
return (-1);
}
return (-1);
}
@@
-1027,7
+1025,7
@@
static int ps_read (void)
status = ps_read_process (pid, &ps, &state);
if (status != 0)
{
status = ps_read_process (pid, &ps, &state);
if (status != 0)
{
- D
B
G ("ps_read_process failed: %i", status);
+ D
EBU
G ("ps_read_process failed: %i", status);
continue;
}
continue;
}
diff --git
a/src/rrdtool.c
b/src/rrdtool.c
index
f19f269
..
ec04642
100644
(file)
--- a/
src/rrdtool.c
+++ b/
src/rrdtool.c
@@
-23,7
+23,6
@@
#include "plugin.h"
#include "common.h"
#include "utils_avltree.h"
#include "plugin.h"
#include "common.h"
#include "utils_avltree.h"
-#include "utils_debug.h"
/*
* Private types
/*
* Private types
@@
-140,7
+139,7
@@
static int rra_get (char ***ret)
rra_types[j], xff,
cdp_len, cdp_num) >= sizeof (buffer))
{
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;
}
continue;
}
@@
-149,9
+148,9
@@
static int rra_get (char ***ret)
}
#if COLLECT_DEBUG
}
#if COLLECT_DEBUG
- D
B
G ("rra_num = %i", rra_num);
+ D
EBU
G ("rra_num = %i", rra_num);
for (i = 0; i < rra_num; i++)
for (i = 0; i < rra_num; i++)
- D
B
G (" %s", rra_def[i]);
+ D
EBU
G (" %s", rra_def[i]);
#endif
*ret = rra_def;
#endif
*ret = rra_def;
@@
-177,12
+176,12
@@
static int ds_get (char ***ret, const data_set_t *ds)
char max[32];
char buffer[128];
char max[32];
char buffer[128];
- D
B
G ("ds->ds_num = %i", ds->ds_num);
+ D
EBU
G ("ds->ds_num = %i", ds->ds_num);
ds_def = (char **) malloc (ds->ds_num * sizeof (char *));
if (ds_def == NULL)
{
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);
}
strerror (errno));
return (-1);
}
@@
-202,7
+201,7
@@
static int ds_get (char ***ret, const data_set_t *ds)
type = "GAUGE";
else
{
type = "GAUGE";
else
{
-
syslog (LOG_ERR,
"rrdtool plugin: Unknown DS type: %i",
+
ERROR (
"rrdtool plugin: Unknown DS type: %i",
d->type);
break;
}
d->type);
break;
}
@@
-240,9
+239,9
@@
static int ds_get (char ***ret, const data_set_t *ds)
#if COLLECT_DEBUG
{
int i;
#if COLLECT_DEBUG
{
int i;
- D
B
G ("ds_num = %i", ds_num);
+ D
EBU
G ("ds_num = %i", ds_num);
for (i = 0; i < ds_num; i++)
for (i = 0; i < ds_num; i++)
- D
B
G (" %s", ds_def[i]);
+ D
EBU
G (" %s", ds_def[i]);
}
#endif
}
#endif
@@
-273,13
+272,13
@@
static int rrd_create_file (char *filename, const data_set_t *ds)
if ((rra_num = rra_get (&rra_def)) < 1)
{
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)
{
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);
}
return (-1);
}
@@
-287,7
+286,7
@@
static int rrd_create_file (char *filename, const data_set_t *ds)
if ((argv = (char **) malloc (sizeof (char *) * (argc + 1))) == NULL)
{
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);
}
return (-1);
}
@@
-295,7
+294,7
@@
static int rrd_create_file (char *filename, const data_set_t *ds)
"%i", stepsize);
if ((status < 1) || (status >= sizeof (stepsize_str)))
{
"%i", stepsize);
if ((status < 1) || (status >= sizeof (stepsize_str)))
{
-
syslog (LOG_ERR,
"rrdtool plugin: snprintf failed.");
+
ERROR (
"rrdtool plugin: snprintf failed.");
return (-1);
}
return (-1);
}
@@
-315,7
+314,7
@@
static int rrd_create_file (char *filename, const data_set_t *ds)
rrd_clear_error ();
if (rrd_create (argc, argv) == -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;
}
status = -1;
}
@@
-429,7
+428,7
@@
static rrd_cache_t *rrd_cache_insert (const char *filename,
(rc->values_num + 1) * sizeof (char *));
if (rc->values == NULL)
{
(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)
{
strerror (errno));
if (cache != NULL)
{
@@
-455,7
+454,7
@@
static rrd_cache_t *rrd_cache_insert (const char *filename,
if (cache_key == 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);
strerror (errno));
sfree (rc->values[0]);
sfree (rc->values);
@@
-466,7
+465,7
@@
static rrd_cache_t *rrd_cache_insert (const char *filename,
avl_insert (cache, cache_key, rc);
}
avl_insert (cache, cache_key, rc);
}
- D
B
G ("rrd_cache_insert (%s, %s) = %p", filename, value, (void *) rc);
+ D
EBU
G ("rrd_cache_insert (%s, %s) = %p", filename, value, (void *) rc);
return (rc);
} /* rrd_cache_t *rrd_cache_insert */
return (rc);
} /* rrd_cache_t *rrd_cache_insert */
@@
-498,7
+497,7
@@
static int rrd_write_cache_entry (const char *filename, rrd_cache_t *rc)
memcpy (argv + 2, rc->values, rc->values_num * sizeof (char *));
argv[argc] = NULL;
memcpy (argv + 2, rc->values, rc->values_num * sizeof (char *));
argv[argc] = NULL;
- D
B
G ("rrd_update (argc = %i, argv = %p)", argc, (void *) argv);
+ D
EBU
G ("rrd_update (argc = %i, argv = %p)", argc, (void *) argv);
optind = 0; /* bug in librrd? */
rrd_clear_error ();
optind = 0; /* bug in librrd? */
rrd_clear_error ();
@@
-516,7
+515,7
@@
static int rrd_write_cache_entry (const char *filename, rrd_cache_t *rc)
if (status != 0)
{
if (status != 0)
{
-
syslog (LOG_WARNING,
"rrd_update failed: %s: %s",
+
WARNING (
"rrd_update failed: %s: %s",
filename, rrd_get_error ());
return (-1);
}
filename, rrd_get_error ());
return (-1);
}
@@
-539,7
+538,7
@@
static void rrd_cache_flush (int timeout)
if (cache == NULL)
return;
if (cache == NULL)
return;
- D
B
G ("Flushing cache, timeout = %i", timeout);
+ D
EBU
G ("Flushing cache, timeout = %i", timeout);
now = time (NULL);
now = time (NULL);
@@
-547,15
+546,15
@@
static void rrd_cache_flush (int timeout)
iter = avl_get_iterator (cache);
while (avl_iterator_next (iter, (void *) &key, (void *) &rc) == 0)
{
iter = avl_get_iterator (cache);
while (avl_iterator_next (iter, (void *) &key, (void *) &rc) == 0)
{
- D
B
G ("key = %s; age = %i;", key, now - rc->first_value);
+ D
EBU
G ("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)
{
if ((now - rc->first_value) >= timeout)
{
keys = (char **) realloc ((void *) keys,
(keys_num + 1) * sizeof (char *));
if (keys == NULL)
{
- D
B
G ("realloc failed: %s", strerror (errno));
-
syslog (LOG_ERR,
"rrdtool plugin: "
+ D
EBU
G ("realloc failed: %s", strerror (errno));
+
ERROR (
"rrdtool plugin: "
"realloc failed: %s",
strerror (errno));
avl_iterator_destroy (iter);
"realloc failed: %s",
strerror (errno));
avl_iterator_destroy (iter);
@@
-571,7
+570,7
@@
static void rrd_cache_flush (int timeout)
{
if (avl_remove (cache, keys[i], (void *) &key, (void *) &rc) != 0)
{
{
if (avl_remove (cache, keys[i], (void *) &key, (void *) &rc) != 0)
{
- D
B
G ("avl_remove (%s) failed.", keys[i]);
+ D
EBU
G ("avl_remove (%s) failed.", keys[i]);
continue;
}
continue;
}
@@
-583,7
+582,7
@@
static void rrd_cache_flush (int timeout)
} /* for (i = 0..keys_num) */
free (keys);
} /* for (i = 0..keys_num) */
free (keys);
- D
B
G ("Flushed %i value(s)", keys_num);
+ D
EBU
G ("Flushed %i value(s)", keys_num);
cache_flush_last = now;
} /* void rrd_cache_flush */
cache_flush_last = now;
} /* void rrd_cache_flush */
@@
-611,14
+610,14
@@
static int rrd_write (const data_set_t *ds, const value_list_t *vl)
}
else
{
}
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))
{
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);
}
filename);
return (-1);
}
@@
-637,7
+636,7
@@
static int rrd_write (const data_set_t *ds, const value_list_t *vl)
now = time (NULL);
now = time (NULL);
- D
B
G ("age (%s) = %i", filename, now - rc->first_value);
+ D
EBU
G ("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. */
/* `rc' is not free'd here, because we'll likely reuse it. If not, then
* the next flush will remove this entry. */
@@
-763,11
+762,11
@@
static int rrd_init (void)
heartbeat = 2 * interval_g;
if (heartbeat < interval_g)
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)
"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.");
"smaller than your `interval'. This will "
"create needlessly big RRD-files.");
@@
-786,7
+785,7
@@
static int rrd_init (void)
plugin_register_shutdown ("rrdtool", rrd_shutdown);
}
plugin_register_shutdown ("rrdtool", rrd_shutdown);
}
- D
B
G ("datadir = %s; stepsize = %i; heartbeat = %i; rrarows = %i; xff = %lf;",
+ D
EBU
G ("datadir = %s; stepsize = %i; heartbeat = %i; rrarows = %i; xff = %lf;",
(datadir == NULL) ? "(null)" : datadir,
stepsize, heartbeat, rrarows, xff);
(datadir == NULL) ? "(null)" : datadir,
stepsize, heartbeat, rrarows, xff);
diff --git
a/src/sensors.c
b/src/sensors.c
index
b1454a6
..
4bb544d
100644
(file)
--- a/
src/sensors.c
+++ b/
src/sensors.c
@@
-33,7
+33,6
@@
#include "plugin.h"
#include "configfile.h"
#include "utils_ignorelist.h"
#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 defined(HAVE_SENSORS_SENSORS_H)
# include <sensors/sensors.h>
@@
-200,7
+199,7
@@
static int sensors_config (const char *key, const char *value)
{
if (ignorelist_add (sensor_list, value))
{
{
if (ignorelist_add (sensor_list, value))
{
-
syslog (LOG_ERR,
"sensors plugin: "
+
ERROR (
"sensors plugin: "
"Cannot add value to ignorelist.");
return (1);
}
"Cannot add value to ignorelist.");
return (1);
}
@@
-257,7
+256,7
@@
static void sensors_load_conf (void)
status = stat (conffile, &statbuf);
if (status != 0)
{
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;
}
conffile, strerror (errno));
sensors_config_mtime = 0;
}
@@
-268,7
+267,7
@@
static void sensors_load_conf (void)
if (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;
conffile);
sensors_free_features ();
sensors_config_mtime = 0;
@@
-277,7
+276,7
@@
static void sensors_load_conf (void)
fh = fopen (conffile, "r");
if (fh == NULL)
{
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;
}
conffile, strerror(errno));
return;
}
@@
-286,7
+285,7
@@
static void sensors_load_conf (void)
fclose (fh);
if (status != 0)
{
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;
}
"Data will not be collected.");
return;
}
@@
-318,15
+317,15
@@
static void sensors_load_conf (void)
if (sensors_get_ignored (*chip, data->number) == 0)
break;
if (sensors_get_ignored (*chip, data->number) == 0)
break;
- D
B
G ("Adding feature: %s-%s-%s",
+ D
EBU
G ("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)
{
chip->prefix,
sensor_to_type[known_features[i].type],
data->name);
if ((new_feature = (featurelist_t *) malloc (sizeof (featurelist_t))) == NULL)
{
- D
B
G ("malloc: %s", strerror (errno));
-
syslog (LOG_ERR,
"sensors plugin: malloc: %s",
+ D
EBU
G ("malloc: %s", strerror (errno));
+
ERROR (
"sensors plugin: malloc: %s",
strerror (errno));
break;
}
strerror (errno));
break;
}
@@
-356,7
+355,7
@@
static void sensors_load_conf (void)
if (first_feature == NULL)
{
sensors_cleanup ();
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 */
"features. Data will not be collected.");
}
} /* void sensors_load_conf */
diff --git
a/src/serial.c
b/src/serial.c
index
8f8e433
..
0cfa382
100644
(file)
--- a/
src/serial.c
+++ b/
src/serial.c
@@
-80,7
+80,7
@@
static int serial_read (void)
if ((fh = fopen ("/proc/tty/driver/serial", "r")) == NULL &&
(fh = fopen ("/proc/tty/driver/ttyS", "r")) == NULL)
{
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);
}
return (-1);
}
diff --git
a/src/swap.c
b/src/swap.c
index
8e04044
..
945c758
100644
(file)
--- a/
src/swap.c
+++ b/
src/swap.c
@@
-111,7
+111,7
@@
static int swap_init (void)
NULL)) /* errstr */
== NULL)
{
NULL)) /* errstr */
== NULL)
{
-
syslog (LOG_ERR,
"swap plugin: kvm_open failed.");
+
ERROR (
"swap plugin: kvm_open failed.");
return (-1);
}
/* #endif HAVE_LIBKVM */
return (-1);
}
/* #endif HAVE_LIBKVM */
@@
-156,7
+156,7
@@
static int swap_read (void)
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
-
syslog (LOG_WARNING,
"memory: fopen: %s", strerror (errno));
+
WARNING (
"memory: fopen: %s", strerror (errno));
return (-1);
}
return (-1);
}
@@
-182,7
+182,7
@@
static int swap_read (void)
}
if (fclose (fh))
}
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 ((swap_total == 0LL) || ((swap_free + swap_cached) > swap_total))
return (-1);
@@
-203,7
+203,7
@@
static int swap_read (void)
if (swapctl (SC_AINFO, &ai) == -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);
}
strerror (errno));
return (-1);
}
diff --git
a/src/traffic.c
b/src/traffic.c
index
619208c
..
7f62450
100644
(file)
--- a/
src/traffic.c
+++ b/
src/traffic.c
@@
-134,14
+134,14
@@
static int interface_config (const char *key, const char *value)
temp = (char **) realloc (if_list, (if_list_num + 1) * sizeof (char *));
if (temp == NULL)
{
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)
{
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++;
return (1);
}
if_list_num++;
@@
-304,7
+304,7
@@
static int traffic_read (void)
if ((fh = fopen ("/proc/net/dev", "r")) == NULL)
{
if ((fh = fopen ("/proc/net/dev", "r")) == NULL)
{
-
syslog (LOG_WARNING,
"traffic: fopen: %s", strerror (errno));
+
WARNING (
"traffic: fopen: %s", strerror (errno));
return (-1);
}
return (-1);
}
diff --git
a/src/unixsock.c
b/src/unixsock.c
index
0008b22
..
17956a1
100644
(file)
--- a/
src/unixsock.c
+++ b/
src/unixsock.c
@@
-23,7
+23,6
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#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>
/* Folks without pthread will need to disable this plugin. */
#include <pthread.h>
@@
-137,7
+136,7
@@
static int cache_insert (const data_set_t *ds, const value_list_t *vl)
value_cache_t *vc;
int i;
value_cache_t *vc;
int i;
- D
B
G ("ds->ds_num = %i; vl->values_len = %i;",
+ D
EBU
G ("ds->ds_num = %i; vl->values_len = %i;",
ds->ds_num, vl->values_len);
assert (ds->ds_num == vl->values_len);
ds->ds_num, vl->values_len);
assert (ds->ds_num == vl->values_len);
@@
-145,7
+144,7
@@
static int cache_insert (const data_set_t *ds, const value_list_t *vl)
if (vc == NULL)
{
pthread_mutex_unlock (&cache_lock);
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);
}
strerror (errno));
return (-1);
}
@@
-154,7
+153,7
@@
static int cache_insert (const data_set_t *ds, const value_list_t *vl)
if (vc->gauge == NULL)
{
pthread_mutex_unlock (&cache_lock);
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);
strerror (errno));
free (vc);
return (-1);
@@
-164,7
+163,7
@@
static int cache_insert (const data_set_t *ds, const value_list_t *vl)
if (vc->counter == NULL)
{
pthread_mutex_unlock (&cache_lock);
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);
strerror (errno));
free (vc->gauge);
free (vc);
@@
-176,7
+175,7
@@
static int cache_insert (const data_set_t *ds, const value_list_t *vl)
ds->type, vl->type_instance) != 0)
{
pthread_mutex_unlock (&cache_lock);
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);
free (vc->counter);
free (vc->gauge);
free (vc);
@@
-352,7
+351,7
@@
static int us_open_socket (void)
sock_fd = socket (PF_UNIX, SOCK_STREAM, 0);
if (sock_fd < 0)
{
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);
}
strerror (errno));
return (-1);
}
@@
-366,9
+365,9
@@
static int us_open_socket (void)
status = bind (sock_fd, (struct sockaddr *) &sa, sizeof (sa));
if (status != 0)
{
status = bind (sock_fd, (struct sockaddr *) &sa, sizeof (sa));
if (status != 0)
{
- D
B
G ("bind failed: %s; sa.sun_path = %s",
+ D
EBU
G ("bind failed: %s; sa.sun_path = %s",
strerror (errno), sa.sun_path);
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;
strerror (errno));
close (sock_fd);
sock_fd = -1;
@@
-378,7
+377,7
@@
static int us_open_socket (void)
status = listen (sock_fd, 8);
if (status != 0)
{
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;
strerror (errno));
close (sock_fd);
sock_fd = -1;
@@
-398,13
+397,13
@@
static int us_open_socket (void)
status = getgrnam_r (grpname, &sg, grbuf, sizeof (grbuf), &g);
if (status != 0)
{
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)
{
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;
}
grpname);
break;
}
@@
-412,7
+411,7
@@
static int us_open_socket (void)
if (chown ((sock_file != NULL) ? sock_file : US_DEFAULT_PATH,
(uid_t) -1, g->gr_gid) != 0)
{
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));
(sock_file != NULL) ? sock_file : US_DEFAULT_PATH,
(int) g->gr_gid,
strerror (errno));
@@
-468,17
+467,17
@@
static int us_handle_getval (FILE *fh, char **fields, int fields_num)
pthread_mutex_lock (&cache_lock);
pthread_mutex_lock (&cache_lock);
- D
B
G ("vc = cache_search (%s)", name);
+ D
EBU
G ("vc = cache_search (%s)", name);
vc = cache_search (name);
if (vc == NULL)
{
vc = cache_search (name);
if (vc == NULL)
{
- D
B
G ("Did not find cache entry.");
+ D
EBU
G ("Did not find cache entry.");
fprintf (fh, "-1 No such value");
}
else
{
fprintf (fh, "-1 No such value");
}
else
{
- D
B
G ("Found cache entry.");
+ D
EBU
G ("Found cache entry.");
fprintf (fh, "%i", vc->values_num);
for (i = 0; i < vc->values_num; i++)
{
fprintf (fh, "%i", vc->values_num);
for (i = 0; i < vc->values_num; i++)
{
@@
-511,12
+510,12
@@
static void *us_handle_client (void *arg)
free (arg);
arg = NULL;
free (arg);
arg = NULL;
- D
B
G ("Reading from fd #%i", fd);
+ D
EBU
G ("Reading from fd #%i", fd);
fh = fdopen (fd, "r+");
if (fh == NULL)
{
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);
strerror (errno));
close (fd);
pthread_exit ((void *) 1);
@@
-534,7
+533,7
@@
static void *us_handle_client (void *arg)
if (len == 0)
continue;
if (len == 0)
continue;
- D
B
G ("fgets -> buffer = %s; len = %i;", buffer, len);
+ D
EBU
G ("fgets -> buffer = %s; len = %i;", buffer, len);
fields_num = strsplit (buffer, fields,
sizeof (fields) / sizeof (fields[0]));
fields_num = strsplit (buffer, fields,
sizeof (fields) / sizeof (fields[0]));
@@
-556,7
+555,7
@@
static void *us_handle_client (void *arg)
}
} /* while (fgets) */
}
} /* while (fgets) */
- D
B
G ("Exiting..");
+ D
EBU
G ("Exiting..");
close (fd);
pthread_exit ((void *) 0);
close (fd);
pthread_exit ((void *) 0);
@@
-574,14
+573,14
@@
static void *us_server_thread (void *arg)
while (42)
{
while (42)
{
- D
B
G ("Calling accept..");
+ D
EBU
G ("Calling accept..");
status = accept (sock_fd, NULL, NULL);
if (status < 0)
{
if (errno == EINTR)
continue;
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;
strerror (errno));
close (sock_fd);
sock_fd = -1;
@@
-591,14
+590,14
@@
static void *us_server_thread (void *arg)
remote_fd = (int *) malloc (sizeof (int));
if (remote_fd == NULL)
{
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;
strerror (errno));
close (status);
continue;
}
*remote_fd = status;
- D
B
G ("Spawning child to handle connection on fd #%i", *remote_fd);
+ D
EBU
G ("Spawning child to handle connection on fd #%i", *remote_fd);
pthread_attr_init (&th_attr);
pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
pthread_attr_init (&th_attr);
pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
@@
-606,7
+605,7
@@
static void *us_server_thread (void *arg)
status = pthread_create (&th, &th_attr, us_handle_client, (void *) remote_fd);
if (status != 0)
{
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);
strerror (status));
close (*remote_fd);
free (remote_fd);
@@
-648,7
+647,7
@@
static int us_init (void)
status = pthread_create (&listen_thread, NULL, us_server_thread, NULL);
if (status != 0)
{
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);
}
strerror (status));
return (-1);
}
diff --git
a/src/utils_debug.c
b/src/utils_debug.c
index
9fc9040
..
cc5ca8e
100644
(file)
--- a/
src/utils_debug.c
+++ b/
src/utils_debug.c
@@
-73,7
+73,7
@@
cu_debug_startfile(const char *file, int line, const char *func,
va_list ap;
if(cu_debug_file != NULL) {
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;
}
" calling cu_debug_stopfile().");
return EXIT_FAILURE;
}
@@
-84,7
+84,7
@@
cu_debug_startfile(const char *file, int line, const char *func,
cu_debug_file = fopen(cu_debug_filename, "a");
if(cu_debug_file == NULL) {
cu_debug_file = fopen(cu_debug_filename, "a");
if(cu_debug_file == NULL) {
- D
B
G("Cannot open debug file %s: %s.\n",
+ D
EBU
G("Cannot open debug file %s: %s.\n",
cu_debug_filename, strerror(errno));
return EXIT_FAILURE;
}
cu_debug_filename, strerror(errno));
return EXIT_FAILURE;
}
@@
-108,13
+108,13
@@
cu_debug_stopfile(const char *file, int line, const char *func,
va_end(ap);
if(cu_debug_file == NULL) {
va_end(ap);
if(cu_debug_file == NULL) {
- D
B
G("Don't call this function more then once or without"
+ D
EBU
G("Don't call this function more then once or without"
" calling cu_debug_startfile().");
return EXIT_FAILURE;
}
if(fclose(cu_debug_file) != 0) {
" calling cu_debug_startfile().");
return EXIT_FAILURE;
}
if(fclose(cu_debug_file) != 0) {
- D
B
G("Cannot close debug file %s: %s.\n",
+ D
EBU
G("Cannot close debug file %s: %s.\n",
cu_debug_filename, strerror(errno));
return EXIT_FAILURE;
}
cu_debug_filename, strerror(errno));
return EXIT_FAILURE;
}
@@
-131,7
+131,7
@@
cu_debug_resetfile(const char *file, int line, const char *func,
const char *filename)
{
if(filename == NULL) {
const char *filename)
{
if(filename == NULL) {
- D
B
G("You have to set filename when calling this function!\n");
+ D
EBU
G("You have to set filename when calling this function!\n");
return EXIT_FAILURE;
}
if(cu_debug_file != NULL) {
return EXIT_FAILURE;
}
if(cu_debug_file != NULL) {
diff --git
a/src/utils_ignorelist.c
b/src/utils_ignorelist.c
index
532eb4b
..
f71ac1d
100644
(file)
--- a/
src/utils_ignorelist.c
+++ b/
src/utils_ignorelist.c
@@
-48,7
+48,7
@@
**/
#include "common.h"
**/
#include "common.h"
-#include "
utils_debug
.h"
+#include "
plugin
.h"
#include "utils_ignorelist.h"
/*
#include "utils_ignorelist.h"
/*
@@
-94,7
+94,7
@@
static int ignorelist_append_regex(ignorelist_t *il, const char *entry)
/* create buffer */
if ((regtemp = malloc(sizeof(regex_t))) == NULL)
{
/* 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));
return (1);
}
memset (regtemp, '\0', sizeof(regex_t));
@@
-111,14
+111,14
@@
static int ignorelist_append_regex(ignorelist_t *il, const char *entry)
{
fprintf (stderr, "Cannot compile regex %s: %i/%s",
entry, rcompile, regerr);
{
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);
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);
}
entry, rcompile);
}
@@
-127,12
+127,12
@@
static int ignorelist_append_regex(ignorelist_t *il, const char *entry)
regfree (regtemp);
return (1);
}
regfree (regtemp);
return (1);
}
- D
B
G("regex compiled: %s - %i", entry, rcompile);
+ D
EBU
G("regex compiled: %s - %i", entry, rcompile);
/* create new entry */
if ((new = malloc(sizeof(ignorelist_item_t))) == NULL)
{
/* 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);
}
regfree (regtemp);
return (1);
}
@@
-153,7
+153,7
@@
static int ignorelist_append_string(ignorelist_t *il, const char *entry)
/* create new entry */
if ((new = malloc(sizeof(ignorelist_item_t))) == NULL )
{
/* 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));
return (1);
}
memset (new, '\0', sizeof(ignorelist_item_t));
@@
-213,7
+213,7
@@
ignorelist_t *ignorelist_create (int invert)
/* smalloc exits if it failes */
il = (ignorelist_t *) smalloc (sizeof (ignorelist_t));
/* smalloc exits if it failes */
il = (ignorelist_t *) smalloc (sizeof (ignorelist_t));
- D
B
G("Ignorelist created 0x%p, default is %s",
+ D
EBU
G("Ignorelist created 0x%p, default is %s",
(void *) il,
invert ? "collect" : "ignore");
(void *) il,
invert ? "collect" : "ignore");
@@
-236,7
+236,7
@@
void ignorelist_free (ignorelist_t *il)
ignorelist_item_t *this;
ignorelist_item_t *next;
ignorelist_item_t *this;
ignorelist_item_t *next;
- D
B
G ("(il = 0x%p)", (void *) il);
+ D
EBU
G ("(il = 0x%p)", (void *) il);
if (il == NULL)
return;
if (il == NULL)
return;
@@
-270,7
+270,7
@@
void ignorelist_set_invert (ignorelist_t *il, int invert)
{
if (il == NULL)
{
{
if (il == NULL)
{
- D
B
G("ignore call with ignorelist_t == NULL");
+ D
EBU
G("ignore call with ignorelist_t == NULL");
return;
}
return;
}
@@
-288,7
+288,7
@@
int ignorelist_add (ignorelist_t *il, const char *entry)
if (il == NULL)
{
if (il == NULL)
{
- D
B
G ("add called with ignorelist_t == NULL");
+ D
EBU
G ("add called with ignorelist_t == NULL");
return (1);
}
return (1);
}
@@
-297,7
+297,7
@@
int ignorelist_add (ignorelist_t *il, const char *entry)
/* append nothing */
if (entry_len == 0)
{
/* append nothing */
if (entry_len == 0)
{
- D
B
G("not appending: empty entry");
+ D
EBU
G("not appending: empty entry");
return (1);
}
return (1);
}
@@
-312,14
+312,14
@@
int ignorelist_add (ignorelist_t *il, const char *entry)
memset (entry_copy, '\0', entry_len);
strncpy (entry_copy, entry + 1, entry_len - 2);
memset (entry_copy, '\0', entry_len);
strncpy (entry_copy, entry + 1, entry_len - 2);
- D
B
G("I'm about to add regex entry: %s", entry_copy);
+ D
EBU
G("I'm about to add regex entry: %s", entry_copy);
ret = ignorelist_append_regex(il, entry_copy);
sfree (entry_copy);
}
else
#endif
{
ret = ignorelist_append_regex(il, entry_copy);
sfree (entry_copy);
}
else
#endif
{
- D
B
G("to add entry: %s", entry);
+ D
EBU
G("to add entry: %s", entry);
ret = ignorelist_append_string(il, entry);
}
ret = ignorelist_append_string(il, entry);
}
diff --git
a/src/utils_mount.c
b/src/utils_mount.c
index
7748c61
..
61eb6d1
100644
(file)
--- a/
src/utils_mount.c
+++ b/
src/utils_mount.c
@@
-30,7
+30,7
@@
#define XFS_SUPER_MAGIC2_STR "BSFX"
#endif
#define XFS_SUPER_MAGIC2_STR "BSFX"
#endif
-#include "
utils_debug
.h"
+#include "
plugin
.h"
#include "utils_mount.h"
#if HAVE_GETVFSSTAT
#include "utils_mount.h"
#if HAVE_GETVFSSTAT
@@
-332,7
+332,7
@@
get_spec_by_uuid(const char *s)
return get_spec_by_x(UUID, uuid);
bad_uuid:
return get_spec_by_x(UUID, uuid);
bad_uuid:
- D
B
G("Found an invalid UUID: %s", s);
+ D
EBU
G("Found an invalid UUID: %s", s);
return NULL;
}
return NULL;
}
@@
-351,12
+351,12
@@
static char *get_device_name(const char *optstr)
}
else if (strncmp (optstr, "UUID=", 5) == 0)
{
}
else if (strncmp (optstr, "UUID=", 5) == 0)
{
- D
B
G ("TODO: check UUID= code!");
+ D
EBU
G ("TODO: check UUID= code!");
rc = get_spec_by_uuid (optstr + 5);
}
else if (strncmp (optstr, "LABEL=", 6) == 0)
{
rc = get_spec_by_uuid (optstr + 5);
}
else if (strncmp (optstr, "LABEL=", 6) == 0)
{
- D
B
G ("TODO: check LABEL= code!");
+ D
EBU
G ("TODO: check LABEL= code!");
rc = get_spec_by_volume_label (optstr + 6);
}
else
rc = get_spec_by_volume_label (optstr + 6);
}
else
@@
-366,7
+366,7
@@
static char *get_device_name(const char *optstr)
if(!rc)
{
if(!rc)
{
- D
B
G ("Error checking device name: optstr = %s", optstr);
+ D
EBU
G ("Error checking device name: optstr = %s", optstr);
}
return rc;
}
}
return rc;
}
@@
-381,7
+381,7
@@
static cu_mount_t *cu_mount_listmntent (void)
struct tabmntent *mntlist;
if(listmntent(&mntlist, COLLECTD_MNTTAB, NULL, NULL) < 0) {
struct tabmntent *mntlist;
if(listmntent(&mntlist, COLLECTD_MNTTAB, NULL, NULL) < 0) {
- D
B
G("calling listmntent() failed: %s", strerror(errno));
+ D
EBU
G("calling listmntent() failed: %s", strerror(errno));
}
for(p = mntlist; p; p = p->next) {
}
for(p = mntlist; p; p = p->next) {
@@
-392,7
+392,7
@@
static cu_mount_t *cu_mount_listmntent (void)
if(loop == NULL) { /* no loop= mount */
device = get_device_name(mnt->mnt_fsname);
if(device == NULL) {
if(loop == NULL) { /* no loop= mount */
device = get_device_name(mnt->mnt_fsname);
if(device == NULL) {
- D
B
G("can't get devicename for fs (%s) %s (%s)"
+ D
EBU
G("can't get devicename for fs (%s) %s (%s)"
": ignored", mnt->mnt_type,
mnt->mnt_dir, mnt->mnt_fsname);
continue;
": ignored", mnt->mnt_type,
mnt->mnt_dir, mnt->mnt_fsname);
continue;
@@
-450,7
+450,7
@@
static cu_mount_t *cu_mount_getfsstat (void)
/* Get the number of mounted file systems */
if ((bufsize = CMD_STATFS (NULL, 0, FLAGS_STATFS)) < 1)
{
/* Get the number of mounted file systems */
if ((bufsize = CMD_STATFS (NULL, 0, FLAGS_STATFS)) < 1)
{
- D
B
G ("getv?fsstat failed: %s", strerror (errno));
+ D
EBU
G ("getv?fsstat failed: %s", strerror (errno));
return (NULL);
}
return (NULL);
}
@@
-463,7
+463,7
@@
static cu_mount_t *cu_mount_getfsstat (void)
* manpage.. -octo */
if ((num = CMD_STATFS (buf, bufsize * sizeof (STRUCT_STATFS), FLAGS_STATFS)) < 1)
{
* manpage.. -octo */
if ((num = CMD_STATFS (buf, bufsize * sizeof (STRUCT_STATFS), FLAGS_STATFS)) < 1)
{
- D
B
G ("getv?fsstat failed: %s", strerror (errno));
+ D
EBU
G ("getv?fsstat failed: %s", strerror (errno));
free (buf);
return (NULL);
}
free (buf);
return (NULL);
}
@@
-512,11
+512,11
@@
static cu_mount_t *cu_mount_gen_getmntent (void)
cu_mount_t *last = NULL;
cu_mount_t *new = NULL;
cu_mount_t *last = NULL;
cu_mount_t *new = NULL;
- D
B
G ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
+ D
EBU
G ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
if ((fp = fopen (COLLECTD_MNTTAB, "r")) == NULL)
{
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);
}
return (NULL);
}
@@
-567,11
+567,11
@@
static cu_mount_t *cu_mount_getmntent (void)
cu_mount_t *last = NULL;
cu_mount_t *new = NULL;
cu_mount_t *last = NULL;
cu_mount_t *new = NULL;
- D
B
G ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
+ D
EBU
G ("(void); COLLECTD_MNTTAB = %s", COLLECTD_MNTTAB);
if ((fp = setmntent (COLLECTD_MNTTAB, "r")) == NULL)
{
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);
}
return (NULL);
}
@@
-589,7
+589,7
@@
static cu_mount_t *cu_mount_getmntent (void)
new->device = get_device_name (new->options);
new->next = NULL;
new->device = get_device_name (new->options);
new->next = NULL;
- D
B
G ("new = {dir = %s, spec_device = %s, type = %s, options = %s, device = %s}",
+ D
EBU
G ("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 */
new->dir, new->spec_device, new->type, new->options, new->device);
/* Append to list */
@@
-607,7
+607,7
@@
static cu_mount_t *cu_mount_getmntent (void)
endmntent (fp);
endmntent (fp);
- D
B
G ("return (0x%p)", (void *) first);
+ D
EBU
G ("return (0x%p)", (void *) first);
return (first);
}
return (first);
}
@@
-670,7
+670,7
@@
void cu_mount_freelist (cu_mount_t *list)
cu_mount_t *this;
cu_mount_t *next;
cu_mount_t *this;
cu_mount_t *next;
- D
B
G ("(list = 0x%p)", (void *) list);
+ D
EBU
G ("(list = 0x%p)", (void *) list);
for (this = list; this != NULL; this = next)
{
for (this = list; this != NULL; this = next)
{
diff --git
a/src/vserver.c
b/src/vserver.c
index
00a1e6a
..
fef4558
100644
(file)
--- a/
src/vserver.c
+++ b/
src/vserver.c
@@
-25,12
+25,7
@@
#include "plugin.h"
#include <dirent.h>
#include "plugin.h"
#include <dirent.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
#include <sys/types.h>
#include <sys/types.h>
-#include <unistd.h>
#define BUFSIZE 512
#define BUFSIZE 512
@@
-218,7
+213,7
@@
static int vserver_read (void)
continue;
if (NULL == (fh = fopen (file, "r")))
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)))
{
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
@@
-261,7
+256,7
@@
static int vserver_read (void)
continue;
if (NULL == (fh = fopen (file, "r")))
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)))
{
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
@@
-309,7
+304,7
@@
static int vserver_read (void)
continue;
if (NULL == (fh = fopen (file, "r")))
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)))
{
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
diff --git
a/src/wireless.c
b/src/wireless.c
index
1041453
..
a704047
100644
(file)
--- a/
src/wireless.c
+++ b/
src/wireless.c
@@
-112,7
+112,7
@@
static int wireless_read (void)
/* there are a variety of names for the wireless device */
if ((fh = fopen (WIRELESS_PROC_FILE, "r")) == NULL)
{
/* 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);
}
return (-1);
}