summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c888188)
raw | patch | inline | side by side (parent: c888188)
author | Florian Forster <octo@collectd.org> | |
Sat, 25 Feb 2012 16:31:23 +0000 (17:31 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 25 Feb 2012 16:31:23 +0000 (17:31 +0100) |
This way it is more like log severity handling, i.e. "OKAY" implies
"WARNING" and "WARNING" implies "FAILURE".
Change-Id: I972c09e4bc9e26b5abeb17cc4d8c5e0e1a42e1c3
"WARNING" and "WARNING" implies "FAILURE".
Change-Id: I972c09e4bc9e26b5abeb17cc4d8c5e0e1a42e1c3
src/collectd.conf.pod | patch | blob | history | |
src/syslog.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index c5a75dc77fe9dd21af6182977cb69cdb65c7fd97..2be3c939fa410900bb27b30ec7b6a0c4ad12c22a 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Please note that B<debug> is only available if collectd has been compiled with
debugging support.
-=item B<NotifyLevel> B<WARNING>|B<FAILURE>
+=item B<NotifyLevel> B<OKAY>|B<WARNING>|B<FAILURE>
Controls which notifications should be sent to syslog. The default behaviour is
-not to send any. If either of C<WARNING> or C<FAILURE> is used, C<OKAY> notifications
-will also be sent to syslog.
-Notifications will be sent using severities based on their own levels. B<OKAY>
-and B<WARNING> will be sent using syslog B<WARNING> severity, whereas B<FAILURE>
-will yield a B<ERROR> syslog entry.
+not to send any. Less severe notifications always imply logging more severe
+notifications: Setting this to B<OKAY> means all notifications will be sent to
+syslog, setting this to B<WARNING> will send B<WARNING> and B<FAILURE>
+notifications but will dismiss B<OKAY> notifications. Setting this option to
+B<FAILURE> will only send failures to syslog.
=back
diff --git a/src/syslog.c b/src/syslog.c
index d584eec905a03560228e05afac03e41769c42edd..fd313dd710b0aa04e58aee4cea041d216132460f 100644 (file)
--- a/src/syslog.c
+++ b/src/syslog.c
int status;
int severity;
- /* do nothing if parsing of NotifSeverity failed */
- if (notif_severity == -1)
- return 0;
- /* do nothing if NotifSeverity is higer than notification
- * note that OKAY notifs will always be displayed */
- if ((notif_severity == NOTIF_FAILURE) && (n -> severity == NOTIF_WARNING))
- return 0;
+ if (n->severity > notif_severity)
+ return (0);
status = ssnprintf (buf_ptr, buf_len, "Notification: severity = %s",
(n->severity == NOTIF_FAILURE) ? "FAILURE"