diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index c7d33a6c5..6870198e4 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -170,13 +170,13 @@ void ElasticsearchWriter::AddCheckResult(const Dictionary::Ptr& fields, const Ch fields->Set(perfdataPrefix + ".value", pdv->GetValue()); - if (pdv->GetMin()) + if (!pdv->GetMin().IsEmpty()) fields->Set(perfdataPrefix + ".min", pdv->GetMin()); - if (pdv->GetMax()) + if (!pdv->GetMax().IsEmpty()) fields->Set(perfdataPrefix + ".max", pdv->GetMax()); - if (pdv->GetWarn()) + if (!pdv->GetWarn().IsEmpty()) fields->Set(perfdataPrefix + ".warn", pdv->GetWarn()); - if (pdv->GetCrit()) + if (!pdv->GetCrit().IsEmpty()) fields->Set(perfdataPrefix + ".crit", pdv->GetCrit()); if (!pdv->GetUnit().IsEmpty()) diff --git a/lib/perfdata/gelfwriter.cpp b/lib/perfdata/gelfwriter.cpp index 9ea470107..adab3f854 100644 --- a/lib/perfdata/gelfwriter.cpp +++ b/lib/perfdata/gelfwriter.cpp @@ -328,13 +328,13 @@ void GelfWriter::CheckResultHandlerInternal(const Checkable::Ptr& checkable, con fields->Set("_" + escaped_key, pdv->GetValue()); - if (pdv->GetMin()) + if (!pdv->GetMin().IsEmpty()) fields->Set("_" + escaped_key + "_min", pdv->GetMin()); - if (pdv->GetMax()) + if (!pdv->GetMax().IsEmpty()) fields->Set("_" + escaped_key + "_max", pdv->GetMax()); - if (pdv->GetWarn()) + if (!pdv->GetWarn().IsEmpty()) fields->Set("_" + escaped_key + "_warn", pdv->GetWarn()); - if (pdv->GetCrit()) + if (!pdv->GetCrit().IsEmpty()) fields->Set("_" + escaped_key + "_crit", pdv->GetCrit()); if (!pdv->GetUnit().IsEmpty()) diff --git a/lib/perfdata/graphitewriter.cpp b/lib/perfdata/graphitewriter.cpp index a1f5a19ec..2e24eea33 100644 --- a/lib/perfdata/graphitewriter.cpp +++ b/lib/perfdata/graphitewriter.cpp @@ -360,13 +360,13 @@ void GraphiteWriter::SendPerfdata(const Checkable::Ptr& checkable, const String& SendMetric(checkable, prefix, escapedKey + ".value", pdv->GetValue(), ts); if (GetEnableSendThresholds()) { - if (pdv->GetCrit()) + if (!pdv->GetCrit().IsEmpty()) SendMetric(checkable, prefix, escapedKey + ".crit", pdv->GetCrit(), ts); - if (pdv->GetWarn()) + if (!pdv->GetWarn().IsEmpty()) SendMetric(checkable, prefix, escapedKey + ".warn", pdv->GetWarn(), ts); - if (pdv->GetMin()) + if (!pdv->GetMin().IsEmpty()) SendMetric(checkable, prefix, escapedKey + ".min", pdv->GetMin(), ts); - if (pdv->GetMax()) + if (!pdv->GetMax().IsEmpty()) SendMetric(checkable, prefix, escapedKey + ".max", pdv->GetMax(), ts); } } diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index 9ea2a95dd..4692b8b5d 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -298,13 +298,13 @@ void InfluxdbWriter::CheckResultHandlerWQ(const Checkable::Ptr& checkable, const fields->Set("value", pdv->GetValue()); if (GetEnableSendThresholds()) { - if (pdv->GetCrit()) + if (!pdv->GetCrit().IsEmpty()) fields->Set("crit", pdv->GetCrit()); - if (pdv->GetWarn()) + if (!pdv->GetWarn().IsEmpty()) fields->Set("warn", pdv->GetWarn()); - if (pdv->GetMin()) + if (!pdv->GetMin().IsEmpty()) fields->Set("min", pdv->GetMin()); - if (pdv->GetMax()) + if (!pdv->GetMax().IsEmpty()) fields->Set("max", pdv->GetMax()); } if (!pdv->GetUnit().IsEmpty()) { diff --git a/lib/perfdata/opentsdbwriter.cpp b/lib/perfdata/opentsdbwriter.cpp index 125ecaaed..4ed02b873 100644 --- a/lib/perfdata/opentsdbwriter.cpp +++ b/lib/perfdata/opentsdbwriter.cpp @@ -332,13 +332,13 @@ void OpenTsdbWriter::SendPerfdata(const Checkable::Ptr& checkable, const String& SendMetric(checkable, metric_name, tags_new, pdv->GetValue(), ts); - if (pdv->GetCrit()) + if (!pdv->GetCrit().IsEmpty()) SendMetric(checkable, metric_name + "_crit", tags_new, pdv->GetCrit(), ts); - if (pdv->GetWarn()) + if (!pdv->GetWarn().IsEmpty()) SendMetric(checkable, metric_name + "_warn", tags_new, pdv->GetWarn(), ts); - if (pdv->GetMin()) + if (!pdv->GetMin().IsEmpty()) SendMetric(checkable, metric_name + "_min", tags_new, pdv->GetMin(), ts); - if (pdv->GetMax()) + if (!pdv->GetMax().IsEmpty()) SendMetric(checkable, metric_name + "_max", tags_new, pdv->GetMax(), ts); } } @@ -511,4 +511,4 @@ void OpenTsdbWriter::ValidateServiceTemplate(const Lazy& lvalue BOOST_THROW_EXCEPTION(ValidationError(this, { "service_template", "tags", pair.first }, "Closing $ not found in macro format string '" + pair.second)); } } -} \ No newline at end of file +}