projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
virt plugin: Added ExtraStats selector 'vcpu'
[collectd.git]
/
src
/
notify_nagios.c
diff --git
a/src/notify_nagios.c
b/src/notify_nagios.c
index
f744d48
..
79926b5
100644
(file)
--- a/
src/notify_nagios.c
+++ b/
src/notify_nagios.c
@@
-26,8
+26,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#define NAGIOS_OK 0
#define NAGIOS_WARNING 1
#define NAGIOS_OK 0
#define NAGIOS_WARNING 1
@@
-67,10
+67,8
@@
static int nagios_print(char const *buffer) /* {{{ */
fd = open(file, O_WRONLY | O_APPEND);
if (fd < 0) {
fd = open(file, O_WRONLY | O_APPEND);
if (fd < 0) {
- char errbuf[1024];
status = errno;
status = errno;
- ERROR("notify_nagios plugin: Opening \"%s\" failed: %s", file,
- sstrerror(status, errbuf, sizeof(errbuf)));
+ ERROR("notify_nagios plugin: Opening \"%s\" failed: %s", file, STRERRNO);
return status;
}
return status;
}
@@
-79,30
+77,26
@@
static int nagios_print(char const *buffer) /* {{{ */
status = fcntl(fd, F_GETLK, &lock);
if (status != 0) {
status = fcntl(fd, F_GETLK, &lock);
if (status != 0) {
- char errbuf[1024];
status = errno;
ERROR("notify_nagios plugin: Failed to acquire write lock on \"%s\": %s",
status = errno;
ERROR("notify_nagios plugin: Failed to acquire write lock on \"%s\": %s",
- file,
sstrerror(status, errbuf, sizeof(errbuf))
);
+ file,
STRERRNO
);
close(fd);
return status;
}
status = (int)lseek(fd, 0, SEEK_END);
if (status == -1) {
close(fd);
return status;
}
status = (int)lseek(fd, 0, SEEK_END);
if (status == -1) {
- char errbuf[1024];
status = errno;
ERROR("notify_nagios plugin: Seeking to end of \"%s\" failed: %s", file,
status = errno;
ERROR("notify_nagios plugin: Seeking to end of \"%s\" failed: %s", file,
-
sstrerror(status, errbuf, sizeof(errbuf))
);
+
STRERRNO
);
close(fd);
return status;
}
status = (int)swrite(fd, buffer, strlen(buffer));
if (status != 0) {
close(fd);
return status;
}
status = (int)swrite(fd, buffer, strlen(buffer));
if (status != 0) {
- char errbuf[1024];
status = errno;
status = errno;
- ERROR("notify_nagios plugin: Writing to \"%s\" failed: %s", file,
- sstrerror(status, errbuf, sizeof(errbuf)));
+ ERROR("notify_nagios plugin: Writing to \"%s\" failed: %s", file, STRERRNO);
close(fd);
return status;
}
close(fd);
return status;
}