Merge pull request #7696 from Icinga/bugfix/metrics-zero-thresholds

Metrics: Always send '0' as value for thresholds
This commit is contained in:
Michael Friedrich 2019-12-06 11:01:35 +01:00 committed by GitHub
commit 65ab6b256f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 21 deletions

View File

@ -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())

View File

@ -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())

View File

@ -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);
}
}

View File

@ -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()) {

View File

@ -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<Dictionary::Ptr>& lvalue
BOOST_THROW_EXCEPTION(ValidationError(this, { "service_template", "tags", pair.first }, "Closing $ not found in macro format string '" + pair.second));
}
}
}
}