Merge pull request #6194 from Icinga/feature/metric-unit-elastic-gelf

Elasticsearch/GELF: Add metric unit to performance data fields
This commit is contained in:
Michael Friedrich 2018-04-03 17:12:29 +02:00 committed by GitHub
commit ecbbc2fcc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -167,6 +167,9 @@ void ElasticsearchWriter::AddCheckResult(const Dictionary::Ptr& fields, const Ch
fields->Set(perfdataPrefix + ".warn", pdv->GetWarn());
if (pdv->GetCrit())
fields->Set(perfdataPrefix + ".crit", pdv->GetCrit());
if (!pdv->GetUnit().IsEmpty())
fields->Set(perfdataPrefix + ".unit", pdv->GetUnit());
}
}
}

View File

@ -270,6 +270,9 @@ void GelfWriter::CheckResultHandlerInternal(const Checkable::Ptr& checkable, con
fields->Set("_" + escaped_key + "_warn", pdv->GetWarn());
if (pdv->GetCrit())
fields->Set("_" + escaped_key + "_crit", pdv->GetCrit());
if (!pdv->GetUnit().IsEmpty())
fields->Set("_" + escaped_key + "_unit", pdv->GetUnit());
}
}
}