From a4b7984719489d66b0492c20390d7276f90fc41f Mon Sep 17 00:00:00 2001 From: Gerd von Egidy Date: Tue, 5 Aug 2014 00:48:32 +0200 Subject: [PATCH] Add warning messages when performance data could not be parsed or not be sent to Graphite refs #6550 --- components/perfdata/graphitewriter.cpp | 3 +++ lib/icinga/perfdatavalue.cpp | 1 + lib/icinga/pluginutility.cpp | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/perfdata/graphitewriter.cpp b/components/perfdata/graphitewriter.cpp index ec8190d8e..331f62084 100644 --- a/components/perfdata/graphitewriter.cpp +++ b/components/perfdata/graphitewriter.cpp @@ -142,7 +142,10 @@ void GraphiteWriter::SendPerfdata(const String& prefix, const CheckResult::Ptr& Value pdv = cr->GetPerformanceData(); if (!pdv.IsObjectType()) + { + Log(LogWarning, "GraphiteWriter", "Could not send performance data: unparsed data."); return; + } Dictionary::Ptr perfdata = pdv; diff --git a/lib/icinga/perfdatavalue.cpp b/lib/icinga/perfdatavalue.cpp index 194938070..e34d833ee 100644 --- a/lib/icinga/perfdatavalue.cpp +++ b/lib/icinga/perfdatavalue.cpp @@ -19,6 +19,7 @@ #include "icinga/perfdatavalue.hpp" #include "base/convert.hpp" +#include "base/exception.hpp" #include #include #include diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index 77f7cc7a7..f2b280184 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -252,7 +252,8 @@ Value PluginUtility::ParsePerfdata(const String& perfdata) } return result; - } catch (const std::exception&) { + } catch (const std::exception& ex) { + Log(LogWarning, "PluginUtility", "Error parsing performance data '" + perfdata + "': " + ex.what()); return perfdata; } } -- 2.49.0