summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4ebf1f9)
raw | patch | inline | side by side (parent: 4ebf1f9)
author | Krzysztof Matczak <krzysztofx.matczak@intel.com> | |
Fri, 23 Dec 2016 00:21:53 +0000 (00:21 +0000) | ||
committer | Krzysztof Matczak <krzysztofx.matczak@intel.com> | |
Sun, 25 Dec 2016 20:23:40 +0000 (20:23 +0000) |
Change-Id: I0ddfd6dcd911ab46fcbc032081a2980b1f1f549b
Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
Signed-off-by: Krzysztof Matczak <krzysztofx.matczak@intel.com>
Makefile.am | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/mcelog.c | patch | blob | history |
diff --git a/Makefile.am b/Makefile.am
index 9f33cdc64ebc0e7fd6b31b2ff6fff60a505e23e6..9f0506a7649049fb0c9247ba27f15793416d47c9 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
pkglib_LTLIBRARIES += mcelog.la
mcelog_la_SOURCES = mcelog.c
mcelog_la_LDFLAGS = $(PLUGIN_LDFLAGS)
-mcelog_la_LIBADD =
endif
if BUILD_PLUGIN_MD
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index e6f771e524141c75db7b9f093c0219283d462d87..2f29713a70d97e9a24ad72e4806f307e22fba0cb 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
=head2 Plugin C<mcelog>
-The C<mcelog plugin> uses mcelog to retrieve machine check exceptions, etc.
+The C<mcelog plugin> uses mcelog to retrieve machine check exceptions.
By default the plugin connects to B<"/var/run/mcelog-client"> to check if the
mcelog server is running. When the server is running, the plugin will tail the
specified logfile to retrieve machine check exception information and send a
notification with the details from the logfile. The plugin will use the mcelog
-client protocol to retrieve memory errors.
+client protocol to retrieve memory related machine check exceptions.
=over 4
=item B<McelogClientSocket> I<Path>
-Connect to mcelog client socket using the UNIX domain socket at I<Path>.
+Connect to the mcelog client socket using the UNIX domain socket at I<Path>.
Defaults to B<"/var/run/mcelog-client">.
=item B<McelogLogfile> I<Path>
-mcelog file to parse. Defaults to B<"/var/log/mcelog">.
+The mcelog file to parse. Defaults to B<"/var/log/mcelog">.
=back
diff --git a/src/mcelog.c b/src/mcelog.c
index f1b4318a4a2b3c936dcc5be3b2d136c109b5738a..9fad0be8c476910af57b55efe89231a573a51e6c 100644 (file)
--- a/src/mcelog.c
+++ b/src/mcelog.c
static int socket_reinit(socket_adapter_t *self) {
char errbuff[MCELOG_BUFF_SIZE];
- int flags;
int ret = -1;
cdtime_t interval = plugin_get_interval();
struct timeval socket_timeout = CDTIME_T_TO_TIMEVAL(interval);
/* synchronization via write lock since sock_fd may be changed here */
pthread_rwlock_wrlock(&self->lock);
- self->sock_fd = socket(PF_UNIX, SOCK_STREAM, 0);
+ self->sock_fd = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
if (self->sock_fd < 0) {
ERROR("%s: Could not create a socket. %s", MCELOG_PLUGIN,
sstrerror(errno, errbuff, sizeof(errbuff)));
return ret;
}
- flags = fcntl(self->sock_fd, F_GETFL, 0);
- flags |= O_NONBLOCK;
- fcntl(self->sock_fd, F_SETFL, flags);
-
/* Set socket timeout option */
if (setsockopt(self->sock_fd, SOL_SOCKET, SO_SNDTIMEO,
- (char *)&socket_timeout, sizeof(socket_timeout)) < 0)
+ &socket_timeout, sizeof(socket_timeout)) < 0)
ERROR("%s: Failed to set the socket timeout option.", MCELOG_PLUGIN);
/* downgrading to read lock due to possible recursive read locks
static void *poll_worker(__attribute__((unused)) void *arg) {
char errbuf[MCELOG_BUFF_SIZE];
mcelog_thread_running = 1;
- FILE **pp_file = calloc(1, sizeof(FILE *));
+ FILE **pp_file = calloc(1, sizeof(*pp_file));
if (pp_file == NULL) {
ERROR("mcelog: memory allocation failed: %s",
sstrerror(errno, errbuf, sizeof(errbuf)));
if (*pp_file == NULL)
continue;
- mcelog_memory_rec_t memory_record;
- memset(&memory_record, 0, sizeof(memory_record));
+ mcelog_memory_rec_t memory_record = {0};
while (parse_memory_info(*pp_file, &memory_record)) {
notification_t n = {NOTIF_OKAY, cdtime(), "", "", MCELOG_PLUGIN,
"", "", "", NULL};