diff --git a/monitord/plugins/libmplugin_mqtt.cpp b/monitord/plugins/libmplugin_mqtt.cpp index 49c247f..95f2269 100644 --- a/monitord/plugins/libmplugin_mqtt.cpp +++ b/monitord/plugins/libmplugin_mqtt.cpp @@ -25,17 +25,12 @@ MonitorPlugInMQTT::MonitorPlugInMQTT() { DD("start"); - - // init vars, TODO: use c++11 declaration in header file - bConnected = false; - pMQTT = nullptr; - strTopic = ""; } MonitorPlugInMQTT::~MonitorPlugInMQTT() { - DD("start"); + DD("stop"); } @@ -90,6 +85,9 @@ topic += typ; msg += "{"; + // add timestamp + msg += "\"timestamp\":" + (*pRes)["timestamp"] + ", "; + if (typ == "fms") { msg += ""; diff --git a/monitord/plugins/libmplugin_mqtt.h b/monitord/plugins/libmplugin_mqtt.h index 6ed247c..d316db9 100644 --- a/monitord/plugins/libmplugin_mqtt.h +++ b/monitord/plugins/libmplugin_mqtt.h @@ -56,9 +56,9 @@ void check(const int returnValue, const std::string &errorMessage, const bool throwException = true); // variables - bool bConnected; - myMQTT *pMQTT; - std::string strTopic; + bool bConnected = false; + myMQTT *pMQTT = nullptr; + std::string strTopic = ""; };