Array::Ptr perfdata = cr->GetPerformanceData();
+ CheckCommand::Ptr checkCommand = checkable->GetCheckCommand();
+
if (perfdata) {
ObjectLock olock(perfdata);
for (const Value& val : perfdata) {
pdv = PerfdataValue::Parse(val);
} catch (const std::exception&) {
Log(LogWarning, "ElasticsearchWriter")
- << "Ignoring invalid perfdata value: '" << val << "' for object '"
- << checkable->GetName() << "'.";
+ << "Ignoring invalid perfdata for checkable '"
+ << checkable->GetName() << "' and command '"
+ << checkCommand->GetName() << "' with value: " << val;
continue;
}
}
ts = cr->GetExecutionEnd();
}
- Enqueue("checkresult", fields, ts);
+ Enqueue(checkable, "checkresult", fields, ts);
}
void ElasticsearchWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type)
ts = cr->GetExecutionEnd();
}
- Enqueue("statechange", fields, ts);
+ Enqueue(checkable, "statechange", fields, ts);
}
void ElasticsearchWriter::NotificationSentToAllUsersHandler(const Notification::Ptr& notification,
ts = cr->GetExecutionEnd();
}
- Enqueue("notification", fields, ts);
+ Enqueue(checkable, "notification", fields, ts);
}
-void ElasticsearchWriter::Enqueue(const String& type, const Dictionary::Ptr& fields, double ts)
+void ElasticsearchWriter::Enqueue(const Checkable::Ptr& checkable, const String& type,
+ const Dictionary::Ptr& fields, double ts)
{
/* Atomically buffer the data point. */
boost::mutex::scoped_lock lock(m_DataBufferMutex);
String fieldsBody = JsonEncode(fields);
Log(LogDebug, "ElasticsearchWriter")
- << "Add to fields to message list: '" << fieldsBody << "'.";
+ << "Checkable '" << checkable->GetName() << "' adds to metric list: '" << fieldsBody << "'.";
m_DataBuffer.emplace_back(indexBody + fieldsBody);
const Checkable::Ptr& checkable, const std::set<User::Ptr>& users, NotificationType type,
const CheckResult::Ptr& cr, const String& author, const String& text);
- void Enqueue(const String& type, const Dictionary::Ptr& fields, double ts);
+ void Enqueue(const Checkable::Ptr& checkable, const String& type,
+ const Dictionary::Ptr& fields, double ts);
Stream::Ptr Connect();
void AssertOnWorkQueue();