errors in web.log caused by "Events" checks
Message-ID: <574d7607.g1Vmue6ZWkbhBKzm%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 86e7ac489e07fe58e83b555bc949f7e415ba705d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=86e7ac489e07fe…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 31 13:31:14 2016 +0200
3584 FIX check_mkevents: Fixed "failed to parse perfdata" errors in web.log
caused by "Events" checks
When the last worst event found in the Event Console contained a pipe character the
remaining
output was treated as performance data string and resulted in "failed to parse
perfdata" errors
in web.log e.g. when opening the service detail page of such an Events service.
---
.werks/3584 | 12 ++++++++++++
ChangeLog | 1 +
doc/treasures/active_checks/check_mkevents.cc | 17 +++++++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/.werks/3584 b/.werks/3584
new file mode 100644
index 0000000..c784ac4
--- /dev/null
+++ b/.werks/3584
@@ -0,0 +1,12 @@
+Title: check_mkevents: Fixed "failed to parse perfdata" errors in web.log
caused by "Events" checks
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464694172
+
+When the last worst event found in the Event Console contained a pipe character the
remaining
+output was treated as performance data string and resulted in "failed to parse
perfdata" errors
+in web.log e.g. when opening the service detail page of such an Events service.
diff --git a/ChangeLog b/ChangeLog
index a6b5856..8cdf0c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -249,6 +249,7 @@
* 3626 FIX: dell_eql_storage: fixed scan function if sysDescr is empty
* 3582 FIX: check_mail: Fixed issue with processing multipart mails...
* 3630 FIX: docsis_channels_upstream: fixed channel discovery
+ * 3584 FIX: check_mkevents: Fixed "failed to parse perfdata" errors in
web.log caused by "Events" checks...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/doc/treasures/active_checks/check_mkevents.cc
b/doc/treasures/active_checks/check_mkevents.cc
index d7ac3ec..f5f309f 100644
--- a/doc/treasures/active_checks/check_mkevents.cc
+++ b/doc/treasures/active_checks/check_mkevents.cc
@@ -309,6 +309,19 @@ int main(int argc, char** argv)
unhandled++;
}
+ // make sure that plugin output does not contain a vertical bar. If that is the
+ // case then replace it with a Uniocode "Light vertical bar". Same as in
Check_MK.
+ string text;
+ text.reserve(worst_row_event_text.size());
+ for (size_t i = 0; i < worst_row_event_text.size(); i++) {
+ if (worst_row_event_text[i] == '|') {
+ text += "\xe2\x94\x82"; // \u2758 (utf-8 encoded light vertical
bar)
+ }
+ else {
+ text += worst_row_event_text[i];
+ }
+ }
+
if (count == 0 && application)
printf("OK - no events for %s on host %s\n", application, host);
else if (count == 0)
@@ -316,8 +329,8 @@ int main(int argc, char** argv)
else {
const char* state_text = worst_state == 0 ? "OK" : worst_state == 1 ?
"WARN" : worst_state == 2 ? "CRIT" : "UNKNOWN";
printf("%s - %d events (%d unacknowledged)", state_text, count,
unhandled);
- if (worst_row_event_text.length() > 0)
- printf(", worst state is %s (Last line: %s)", state_text,
worst_row_event_text.c_str());
+ if (text.length() > 0)
+ printf(", worst state is %s (Last line: %s)", state_text,
text.c_str());
printf("\n");
}
return worst_state;