2009-09-11 Ramon Novoa <rnovoa@artica.es>
* modules/pandora_module_inventory.h, modules/pandora_module_inventory.cc, modules/pandora_module_factory.cc: Fixed inventory module interval calculation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1931 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
63179fc5c4
commit
21f0962ca0
|
@ -1,3 +1,10 @@
|
|||
2009-09-11 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* modules/pandora_module_inventory.h,
|
||||
modules/pandora_module_inventory.cc,
|
||||
modules/pandora_module_factory.cc: Fixed inventory module interval
|
||||
calculation.
|
||||
|
||||
2009-09-10 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* windows/pandora_wmi.cc,
|
||||
|
|
|
@ -123,7 +123,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||
Pandora_Module *module;
|
||||
bool numeric;
|
||||
Module_Type type;
|
||||
|
||||
long agent_interval;
|
||||
|
||||
module_name = "";
|
||||
module_type = "";
|
||||
module_min = "";
|
||||
|
@ -339,16 +340,6 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||
|
||||
} else if (module_inventory != "") {
|
||||
module = new Pandora_Module_Inventory (module_name, module_inventory);
|
||||
if (module_interval != "") {
|
||||
try {
|
||||
// Convert the interval to seconds...
|
||||
int interval = strtoint (module_interval) *60 *60 *24 ;
|
||||
module->setInterval(interval);
|
||||
} catch (Invalid_Conversion e) {
|
||||
pandoraLog("Error in conversion of module_inventory_interval");
|
||||
}
|
||||
|
||||
}
|
||||
} else if (module_odbc != "") {
|
||||
module = new Pandora_Module_Odbc (module_name,
|
||||
module_odbc,
|
||||
|
|
|
@ -22,6 +22,7 @@ the agent is instaled.
|
|||
#include "pandora_module_inventory.h"
|
||||
#include "../windows/pandora_wmi.h"
|
||||
#include "../windows/pandora_windows_info.h"
|
||||
#include "../pandora_windows_service.h"
|
||||
#include "../pandora_strutils.h"
|
||||
|
||||
using namespace Pandora;
|
||||
|
@ -37,6 +38,7 @@ Pandora_Module_Inventory::Pandora_Module_Inventory (string name, string options)
|
|||
: Pandora_Module (name) {
|
||||
this->setKind (module_inventory_str);
|
||||
this->options = options;
|
||||
this->interval_fixed = 0;
|
||||
}
|
||||
/**
|
||||
* Run the module and generates the output.
|
||||
|
@ -52,13 +54,21 @@ Pandora_Module_Inventory::Pandora_Module_Inventory (string name, string options)
|
|||
*/
|
||||
void
|
||||
Pandora_Module_Inventory::run () {
|
||||
|
||||
list<string> rows;
|
||||
list<string>::iterator row;
|
||||
int num_results = 0;
|
||||
string res;
|
||||
size_t found;
|
||||
|
||||
// Agent interval unknown at module creation time, module interval cannot be
|
||||
// set in constructor.
|
||||
if (this->interval_fixed == 0) {
|
||||
int agent_interval = Pandora_Windows_Service::getInstance ()->interval;
|
||||
// Module interval specified in days for inventory modules (86400 = 60 * 60 * 24)
|
||||
this->setInterval (this->getInterval () * 86400 / (agent_interval / 1000));
|
||||
this->interval_fixed = 1;
|
||||
}
|
||||
|
||||
// Until no data data is gathered there will be no output
|
||||
this->has_output = false;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Pandora_Modules {
|
|||
class Pandora_Module_Inventory : public Pandora_Module {
|
||||
private:
|
||||
string options;
|
||||
unsigned char interval_fixed;
|
||||
public:
|
||||
Pandora_Module_Inventory (string name, string options);
|
||||
|
||||
|
|
Loading…
Reference in New Issue