From 3efe31ea0f64b93c7398d8eda84736ce93f5fd22 Mon Sep 17 00:00:00 2001 From: ramonn Date: Wed, 23 Sep 2009 07:04:04 +0000 Subject: [PATCH] 2009-09-23 Ramon Novoa * windows/pandora_wmi.h, modules/pandora_module_inventory.cc: Changed the format of the inventory XML. * main.cc: Execute the agent and exit when compiled with debugging enabled. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1968 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/win32/ChangeLog | 8 ++++++++ pandora_agents/win32/main.cc | 8 +++++++- .../win32/modules/pandora_module_inventory.cc | 14 ++------------ pandora_agents/win32/windows/pandora_wmi.h | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/pandora_agents/win32/ChangeLog b/pandora_agents/win32/ChangeLog index 88de240414..feeeeda985 100644 --- a/pandora_agents/win32/ChangeLog +++ b/pandora_agents/win32/ChangeLog @@ -1,3 +1,11 @@ +2009-09-23 Ramon Novoa + + * windows/pandora_wmi.h, modules/pandora_module_inventory.cc: Changed + the format of the inventory XML. + + * main.cc: Execute the agent and exit when compiled with debugging + enabled. + 2009-09-22 Ramon Novoa * debug_new.h, fast_mutex.h, diff --git a/pandora_agents/win32/main.cc b/pandora_agents/win32/main.cc index 7d7771be33..45343cad1d 100644 --- a/pandora_agents/win32/main.cc +++ b/pandora_agents/win32/main.cc @@ -132,16 +132,22 @@ main (int argc, char *argv[]) { return 1; } } + +#ifdef __DEBUG__ + service->pandora_init (); + service->pandora_run (); +#else if (process) { cout << "Pandora agent is now running" << endl; service->pandora_init (); while (1) { service->pandora_run (); - Sleep (service->interval / 1000); + Sleep (service->interval * 1000); } } else { service->run (); } +#endif delete service; diff --git a/pandora_agents/win32/modules/pandora_module_inventory.cc b/pandora_agents/win32/modules/pandora_module_inventory.cc index f43582290a..0389d2f469 100644 --- a/pandora_agents/win32/modules/pandora_module_inventory.cc +++ b/pandora_agents/win32/modules/pandora_module_inventory.cc @@ -354,28 +354,18 @@ Pandora_Module_Inventory::getXml() { inventory_list_element = new TiXmlElement ("datalist"); } data_element = new TiXmlElement ("data"); - element = new TiXmlElement ("value"); try { data_clean = strreplace (this->getDataOutput (data), "%", "%%" ); } catch (Output_Error e) { - delete element; + delete data_element; continue; } text = new TiXmlText (data_clean); - element->InsertEndChild (*text); - data_element->InsertEndChild (*element); + data_element->InsertEndChild (*text); delete text; - delete element; - element = new TiXmlElement ("timestamp"); - text = new TiXmlText (data->getTimestamp ()); - element->InsertEndChild (*text); - data_element->InsertEndChild (*element); - delete text; - delete element; - inventory_list_element->InsertEndChild (*data_element); delete data_element; } diff --git a/pandora_agents/win32/windows/pandora_wmi.h b/pandora_agents/win32/windows/pandora_wmi.h index ceca2fea6c..adfd8aa4ef 100644 --- a/pandora_agents/win32/windows/pandora_wmi.h +++ b/pandora_agents/win32/windows/pandora_wmi.h @@ -40,7 +40,7 @@ namespace Pandora_Wmi { */ class Pandora_Wmi_Exception : public Pandora_Exception { }; - const string inventory_field_separator = "#$|$#"; + const string inventory_field_separator = ";"; int isProcessRunning (string process_name); int isServiceRunning (string service_name); unsigned long getDiskFreeSpace (string disk_id);