Elasticsearch/GELF: Add metric unit to performance data fields

Seen this inside the InfluxDBWriter code, makes sense to store
this in Elasticsearch too.
This commit is contained in:
Michael Friedrich 2018-04-03 14:49:50 +02:00
parent 6617214b1c
commit 313f25163b
2 changed files with 6 additions and 0 deletions

View File

@ -166,6 +166,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

@ -269,6 +269,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());
}
}
}