Summary: Statistics collection and monitoring daemon
Name: collectd
Version: 5.6.1
-Release: 2%{?dist}
+Release: 3%{?dist}
URL: https://collectd.org
Source: https://collectd.org/files/%{name}-%{version}.tar.bz2
License: GPLv2
Group: System Environment/Daemons
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel, libcap-devel, which
+BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel, libcap-devel, which, xfsprogs-devel
Vendor: collectd development team <collectd@verplant.org>
%if 0%{?fedora} || 0%{?rhel} >= 7
%doc contrib/
%changelog
+* Wed Feb 22 2017 Ruben Kerkhof <ruben@rubenkerkhof.com> - 5.6.1-3
+- Enable XFS support in df plugin
+
* Tue Nov 29 2016 Ruben Kerkhof <ruben@rubenkerkhof.com> - 5.6.1-2
- Disable redis plugin on RHEL < 7, hiredis has been retired from EPEL6
# exec CAP_SETUID CAP_SETGID
# iptables CAP_NET_ADMIN
# ping CAP_NET_RAW
+# smart CAP_SYS_RAWIO
# turbostat CAP_SYS_RAWIO
#
# Example, if you use the iptables plugin alongside the dns or ping plugin:
pkglib_LTLIBRARIES += notify_email.la
notify_email_la_SOURCES = notify_email.c
notify_email_la_LDFLAGS = $(PLUGIN_LDFLAGS)
-notify_email_la_LIBADD = -lesmtp -lssl -lcrypto
+notify_email_la_LIBADD = -lesmtp
endif
if BUILD_PLUGIN_NOTIFY_NAGIOS
*/
if (cf_read(configfile)) {
fprintf(stderr, "Error: Reading the config file failed!\n"
- "Read the syslog for details.\n");
+ "Read the logs for details.\n");
return (1);
}
#define UTILS_MATCH_FLAGS_FREE_USER_DATA 0x01
#define UTILS_MATCH_FLAGS_EXCLUDE_REGEX 0x02
+#define UTILS_MATCH_FLAGS_REGEX 0x04
struct cu_match_s {
regex_t regex;
sfree(obj);
return (NULL);
}
+ obj->flags |= UTILS_MATCH_FLAGS_REGEX;
if (excluderegex && strcmp(excluderegex, "") != 0) {
status = regcomp(&obj->excluderegex, excluderegex, REG_EXTENDED);
if (obj == NULL)
return;
- if (obj->flags & UTILS_MATCH_FLAGS_FREE_USER_DATA) {
+ if (obj->flags & UTILS_MATCH_FLAGS_FREE_USER_DATA)
sfree(obj->user_data);
- }
+ if (obj->flags & UTILS_MATCH_FLAGS_REGEX)
+ regfree(&obj->regex);
+ if (obj->flags & UTILS_MATCH_FLAGS_EXCLUDE_REGEX)
+ regfree(&obj->excluderegex);
sfree(obj);
} /* void match_destroy */
#define HAVE_YAJL_V2 1
#endif
-#define DEFAULT_LOGFILE LOCALSTATEDIR "/log/" PACKAGE_NAME ".json.log"
-
#if COLLECT_DEBUG
static int log_level = LOG_DEBUG;
#else
pthread_mutex_lock(&file_lock);
if (log_file == NULL) {
- fh = fopen(DEFAULT_LOGFILE, "a");
- do_close = 1;
+ fh = stderr;
} else if (strcasecmp(log_file, "stdout") == 0) {
fh = stdout;
do_close = 0;
if (fh == NULL) {
char errbuf[1024];
- fprintf(stderr, "log_logstash plugin: fopen (%s) failed: %s\n",
- (log_file == NULL) ? DEFAULT_LOGFILE : log_file,
+ fprintf(stderr, "log_logstash plugin: fopen (%s) failed: %s\n", log_file,
sstrerror(errno, errbuf, sizeof(errbuf)));
} else {
fprintf(fh, "%s\n", buf);
#include "common.h"
#include "plugin.h"
-#define DEFAULT_LOGFILE LOCALSTATEDIR "/log/collectd.log"
-
#if COLLECT_DEBUG
static int log_level = LOG_DEBUG;
#else
pthread_mutex_lock(&file_lock);
if (log_file == NULL) {
- fh = fopen(DEFAULT_LOGFILE, "a");
- do_close = 1;
+ fh = stderr;
} else if (strcasecmp(log_file, "stderr") == 0)
fh = stderr;
else if (strcasecmp(log_file, "stdout") == 0)
if (fh == NULL) {
char errbuf[1024];
- fprintf(stderr, "logfile plugin: fopen (%s) failed: %s\n",
- (log_file == NULL) ? DEFAULT_LOGFILE : log_file,
+ fprintf(stderr, "logfile plugin: fopen (%s) failed: %s\n", log_file,
sstrerror(errno, errbuf, sizeof(errbuf)));
} else {
if (print_timestamp)
#include <atasmart.h>
#include <libudev.h>
+#ifdef HAVE_SYS_CAPABILITY_H
+#include <sys/capability.h>
+#endif
+
static const char *config_keys[] = {"Disk", "IgnoreSelected", "IgnoreSleepMode",
"UseSerial"};
return (0);
} /* int smart_read */
+static int smart_init(void) {
+#if defined(HAVE_SYS_CAPABILITY_H) && defined(CAP_SYS_RAWIO)
+ if (check_capability(CAP_SYS_RAWIO) != 0) {
+ if (getuid() == 0)
+ WARNING("smart plugin: Running collectd as root, but the "
+ "CAP_SYS_RAWIO capability is missing. The plugin's read "
+ "function will probably fail. Is your init system dropping "
+ "capabilities?");
+ else
+ WARNING("smart plugin: collectd doesn't have the CAP_SYS_RAWIO "
+ "capability. If you don't want to run collectd as root, try "
+ "running \"setcap cap_sys_rawio=ep\" on the collectd binary.");
+ }
+#endif
+ return (0);
+} /* int smart_init */
+
void module_register(void) {
plugin_register_config("smart", smart_config, config_keys, config_keys_num);
+ plugin_register_init("smart", smart_init);
plugin_register_read("smart", smart_read);
} /* void module_register */