mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
F #3859: Few minor monitoring fixes
This commit is contained in:
commit
8d2cdf8f16
@ -401,6 +401,12 @@ string one_util::trim(const string& str)
|
||||
string::const_reverse_iterator rwlast;
|
||||
|
||||
wfirst = find_if(str.begin(), str.end(), not_space);
|
||||
|
||||
if (wfirst == str.end())
|
||||
{
|
||||
return string();
|
||||
}
|
||||
|
||||
rwlast = find_if(str.rbegin(),str.rend(),not_space);
|
||||
|
||||
string::const_iterator wlast(rwlast.base());
|
||||
|
@ -262,7 +262,8 @@ void InformationManager::_host_system(unique_ptr<Message<OpenNebulaMessages>> ms
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "Error parsing monitoring template for host " << msg->oid()
|
||||
<< ", error: " << error_msg;
|
||||
<< "\nMessage: " << msg->payload()
|
||||
<< "Error: " << error_msg;
|
||||
NebulaLog::error("InM", oss.str());
|
||||
|
||||
free(error_msg);
|
||||
|
@ -184,8 +184,8 @@ class ProbeRunner
|
||||
runner = ProbeRunner.new(hyperv, probe[:path], stdin)
|
||||
rc, dt = runner.run_probes
|
||||
|
||||
dt64 = Base64.encode64(dt).gsub("\n", '')
|
||||
ret += "<#{probe[:elem_name]}>#{dt64}</#{probe[:elem_name]}>\n"
|
||||
dt = Base64.encode64(dt).gsub("\n", '') if rc == 0
|
||||
ret += "<#{probe[:elem_name]}>#{dt}</#{probe[:elem_name]}>\n"
|
||||
|
||||
return rc, ret if rc == -1
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ void Monitor::start()
|
||||
// -------------------------------------------------------------------------
|
||||
// Configuration File
|
||||
// -------------------------------------------------------------------------
|
||||
OpenNebulaTemplate oned_config(get_defaults_location(), oned_filename);
|
||||
OpenNebulaTemplate oned_config(get_defaults_location(), get_var_location());
|
||||
|
||||
if (oned_config.load_configuration() != 0)
|
||||
{
|
||||
|
@ -46,9 +46,11 @@ void MonitorDriverProtocol::_monitor_vm(message_t msg)
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
NebulaLog::error("MDP", msg->payload());
|
||||
NebulaLog::error("MDP", string("Error parsing VM monitoring template: ")
|
||||
+ error_msg);
|
||||
ostringstream oss;
|
||||
oss << "Error parsing VM monitoring template from host " << msg->oid()
|
||||
<< "\nMessage: " << msg->payload()
|
||||
<< "\nError: " << error_msg;
|
||||
NebulaLog::error("MDP", oss.str());
|
||||
|
||||
free(error_msg);
|
||||
return;
|
||||
@ -143,8 +145,11 @@ void MonitorDriverProtocol::_monitor_host(message_t msg)
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
NebulaLog::error("MDP", string("Error parsing monitoring template: ")
|
||||
+ error_msg);
|
||||
ostringstream oss;
|
||||
oss << "Error parsing monitoring template for host " << msg->oid()
|
||||
<< "\nMessage: " << msg->payload()
|
||||
<< "\nError: " << error_msg;
|
||||
NebulaLog::error("MDP", oss.str());
|
||||
|
||||
free(error_msg);
|
||||
return;
|
||||
@ -200,7 +205,7 @@ void MonitorDriverProtocol::_state_vm(message_t msg)
|
||||
*/
|
||||
void MonitorDriverProtocol::_start_monitor(message_t msg)
|
||||
{
|
||||
NebulaLog::ddebug("MDP", "Received start monitor for host " +
|
||||
NebulaLog::debug("MDP", "Received start monitor for host " +
|
||||
to_string(msg->oid()) + ": " + msg->payload());
|
||||
|
||||
if (msg->status() != "SUCCESS")
|
||||
@ -213,6 +218,14 @@ void MonitorDriverProtocol::_start_monitor(message_t msg)
|
||||
return;
|
||||
}
|
||||
|
||||
auto data = one_util::trim(msg->payload());
|
||||
if (data.empty())
|
||||
{
|
||||
hm->start_monitor_success(msg->oid());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectXML msg_xml;
|
||||
|
||||
if ( msg_xml.update_from_str(msg->payload()) != 0 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user